diff --git a/packages/google-cloud-visionai/.eslintignore b/packages/google-cloud-visionai/.eslintignore new file mode 100644 index 000000000000..cfc348ec4d11 --- /dev/null +++ b/packages/google-cloud-visionai/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/packages/google-cloud-visionai/.eslintrc.json b/packages/google-cloud-visionai/.eslintrc.json new file mode 100644 index 000000000000..3e8d97ccb390 --- /dev/null +++ b/packages/google-cloud-visionai/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "./node_modules/gts", + "root": true +} diff --git a/packages/google-cloud-visionai/README.md b/packages/google-cloud-visionai/README.md index f2cd8bfe8b6c..fef0995758a3 100644 --- a/packages/google-cloud-visionai/README.md +++ b/packages/google-cloud-visionai/README.md @@ -228,7 +228,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-visionai/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). Please note that this `README.md` and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) @@ -238,7 +238,7 @@ are generated from a central template. Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-visionai/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project diff --git a/packages/google-cloud-visionai/protos/protos.d.ts b/packages/google-cloud-visionai/protos/protos.d.ts index bc63043bc105..821b6b8a177c 100644 --- a/packages/google-cloud-visionai/protos/protos.d.ts +++ b/packages/google-cloud-visionai/protos/protos.d.ts @@ -552,6 +552,7 @@ export namespace google { /** Edition enum. */ enum Edition { EDITION_UNKNOWN = 0, + EDITION_LEGACY = 900, EDITION_PROTO2 = 998, EDITION_PROTO3 = 999, EDITION_2023 = 1000, @@ -582,6 +583,9 @@ export namespace google { /** FileDescriptorProto weakDependency */ weakDependency?: (number[]|null); + /** FileDescriptorProto optionDependency */ + optionDependency?: (string[]|null); + /** FileDescriptorProto messageType */ messageType?: (google.protobuf.IDescriptorProto[]|null); @@ -631,6 +635,9 @@ export namespace google { /** FileDescriptorProto weakDependency. */ public weakDependency: number[]; + /** FileDescriptorProto optionDependency. */ + public optionDependency: string[]; + /** FileDescriptorProto messageType. */ public messageType: google.protobuf.IDescriptorProto[]; @@ -765,6 +772,9 @@ export namespace google { /** DescriptorProto reservedName */ reservedName?: (string[]|null); + + /** DescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents a DescriptorProto. */ @@ -806,6 +816,9 @@ export namespace google { /** DescriptorProto reservedName. */ public reservedName: string[]; + /** DescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new DescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -1653,6 +1666,9 @@ export namespace google { /** EnumDescriptorProto reservedName */ reservedName?: (string[]|null); + + /** EnumDescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents an EnumDescriptorProto. */ @@ -1679,6 +1695,9 @@ export namespace google { /** EnumDescriptorProto reservedName. */ public reservedName: string[]; + /** EnumDescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -2613,6 +2632,9 @@ export namespace google { /** FieldOptions features */ features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); @@ -2668,6 +2690,9 @@ export namespace google { /** FieldOptions features. */ public features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -2888,6 +2913,121 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a FeatureSupport. */ + interface IFeatureSupport { + + /** FeatureSupport editionIntroduced */ + editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport editionDeprecated */ + editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport deprecationWarning */ + deprecationWarning?: (string|null); + + /** FeatureSupport editionRemoved */ + editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSupport. */ + class FeatureSupport implements IFeatureSupport { + + /** + * Constructs a new FeatureSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); + + /** FeatureSupport editionIntroduced. */ + public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport editionDeprecated. */ + public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport deprecationWarning. */ + public deprecationWarning: string; + + /** FeatureSupport editionRemoved. */ + public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSupport instance + */ + public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Verifies a FeatureSupport 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 FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSupport + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @param message FeatureSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of an OneofOptions. */ @@ -3126,6 +3266,9 @@ export namespace google { /** EnumValueOptions debugRedact */ debugRedact?: (boolean|null); + /** EnumValueOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); } @@ -3148,6 +3291,9 @@ export namespace google { /** EnumValueOptions debugRedact. */ public debugRedact: boolean; + /** EnumValueOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -3740,6 +3886,12 @@ export namespace google { /** FeatureSet jsonFormat */ jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); + + /** FeatureSet enforceNamingStyle */ + enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); + + /** FeatureSet defaultSymbolVisibility */ + defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); } /** Represents a FeatureSet. */ @@ -3769,6 +3921,12 @@ export namespace google { /** FeatureSet jsonFormat. */ public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); + /** FeatureSet enforceNamingStyle. */ + public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); + + /** FeatureSet defaultSymbolVisibility. */ + public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); + /** * Creates a new FeatureSet instance using the specified properties. * @param [properties] Properties to set @@ -3891,6 +4049,116 @@ export namespace google { ALLOW = 1, LEGACY_BEST_EFFORT = 2 } + + /** EnforceNamingStyle enum. */ + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2 + } + + /** Properties of a VisibilityFeature. */ + interface IVisibilityFeature { + } + + /** Represents a VisibilityFeature. */ + class VisibilityFeature implements IVisibilityFeature { + + /** + * Constructs a new VisibilityFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns VisibilityFeature instance + */ + public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Verifies a VisibilityFeature 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 VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisibilityFeature + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @param message VisibilityFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisibilityFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisibilityFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VisibilityFeature { + + /** DefaultSymbolVisibility enum. */ + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + EXPORT_ALL = 1, + EXPORT_TOP_LEVEL = 2, + LOCAL_ALL = 3, + STRICT = 4 + } + } } /** Properties of a FeatureSetDefaults. */ @@ -4010,8 +4278,11 @@ export namespace google { /** FeatureSetEditionDefault edition */ edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - /** FeatureSetEditionDefault features */ - features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures */ + overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures */ + fixedFeatures?: (google.protobuf.IFeatureSet|null); } /** Represents a FeatureSetEditionDefault. */ @@ -4026,8 +4297,11 @@ export namespace google { /** FeatureSetEditionDefault edition. */ public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - /** FeatureSetEditionDefault features. */ - public features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures. */ + public overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures. */ + public fixedFeatures?: (google.protobuf.IFeatureSet|null); /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -4560,6 +4834,13 @@ export namespace google { } } + /** SymbolVisibility enum. */ + enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2 + } + /** Properties of a Duration. */ interface IDuration { @@ -53572,6 +53853,9 @@ export namespace google { /** CommonLanguageSettings destinations */ destinations?: (google.api.ClientLibraryDestination[]|null); + + /** CommonLanguageSettings selectiveGapicGeneration */ + selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); } /** Represents a CommonLanguageSettings. */ @@ -53589,6 +53873,9 @@ export namespace google { /** CommonLanguageSettings destinations. */ public destinations: google.api.ClientLibraryDestination[]; + /** CommonLanguageSettings selectiveGapicGeneration. */ + public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @param [properties] Properties to set @@ -54289,6 +54576,9 @@ export namespace google { /** PythonSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures */ + experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); } /** Represents a PythonSettings. */ @@ -54303,6 +54593,9 @@ export namespace google { /** PythonSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** PythonSettings experimentalFeatures. */ + public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + /** * Creates a new PythonSettings instance using the specified properties. * @param [properties] Properties to set @@ -54381,6 +54674,118 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace PythonSettings { + + /** Properties of an ExperimentalFeatures. */ + interface IExperimentalFeatures { + + /** ExperimentalFeatures restAsyncIoEnabled */ + restAsyncIoEnabled?: (boolean|null); + + /** ExperimentalFeatures protobufPythonicTypesEnabled */ + protobufPythonicTypesEnabled?: (boolean|null); + + /** ExperimentalFeatures unversionedPackageDisabled */ + unversionedPackageDisabled?: (boolean|null); + } + + /** Represents an ExperimentalFeatures. */ + class ExperimentalFeatures implements IExperimentalFeatures { + + /** + * Constructs a new ExperimentalFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); + + /** ExperimentalFeatures restAsyncIoEnabled. */ + public restAsyncIoEnabled: boolean; + + /** ExperimentalFeatures protobufPythonicTypesEnabled. */ + public protobufPythonicTypesEnabled: boolean; + + /** ExperimentalFeatures unversionedPackageDisabled. */ + public unversionedPackageDisabled: boolean; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns ExperimentalFeatures instance + */ + public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Verifies an ExperimentalFeatures 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 an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExperimentalFeatures + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @param message ExperimentalFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExperimentalFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Properties of a NodeSettings. */ interface INodeSettings { @@ -54707,6 +55112,9 @@ export namespace google { /** GoSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); } /** Represents a GoSettings. */ @@ -54721,6 +55129,9 @@ export namespace google { /** GoSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** GoSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + /** * Creates a new GoSettings instance using the specified properties. * @param [properties] Properties to set @@ -55045,6 +55456,109 @@ export namespace google { PACKAGE_MANAGER = 20 } + /** Properties of a SelectiveGapicGeneration. */ + interface ISelectiveGapicGeneration { + + /** SelectiveGapicGeneration methods */ + methods?: (string[]|null); + + /** SelectiveGapicGeneration generateOmittedAsInternal */ + generateOmittedAsInternal?: (boolean|null); + } + + /** Represents a SelectiveGapicGeneration. */ + class SelectiveGapicGeneration implements ISelectiveGapicGeneration { + + /** + * Constructs a new SelectiveGapicGeneration. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ISelectiveGapicGeneration); + + /** SelectiveGapicGeneration methods. */ + public methods: string[]; + + /** SelectiveGapicGeneration generateOmittedAsInternal. */ + public generateOmittedAsInternal: boolean; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectiveGapicGeneration instance + */ + public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Verifies a SelectiveGapicGeneration 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 SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectiveGapicGeneration + */ + public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @param message SelectiveGapicGeneration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** LaunchStage enum. */ enum LaunchStage { LAUNCH_STAGE_UNSPECIFIED = 0, diff --git a/packages/google-cloud-visionai/protos/protos.js b/packages/google-cloud-visionai/protos/protos.js index 7a0d406b3f49..50848d3085c6 100644 --- a/packages/google-cloud-visionai/protos/protos.js +++ b/packages/google-cloud-visionai/protos/protos.js @@ -1401,6 +1401,7 @@ * @name google.protobuf.Edition * @enum {number} * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_LEGACY=900 EDITION_LEGACY value * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value * @property {number} EDITION_2023=1000 EDITION_2023 value @@ -1415,6 +1416,7 @@ protobuf.Edition = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[900] = "EDITION_LEGACY"] = 900; values[valuesById[998] = "EDITION_PROTO2"] = 998; values[valuesById[999] = "EDITION_PROTO3"] = 999; values[valuesById[1000] = "EDITION_2023"] = 1000; @@ -1439,6 +1441,7 @@ * @property {Array.|null} [dependency] FileDescriptorProto dependency * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [optionDependency] FileDescriptorProto optionDependency * @property {Array.|null} [messageType] FileDescriptorProto messageType * @property {Array.|null} [enumType] FileDescriptorProto enumType * @property {Array.|null} [service] FileDescriptorProto service @@ -1461,6 +1464,7 @@ this.dependency = []; this.publicDependency = []; this.weakDependency = []; + this.optionDependency = []; this.messageType = []; this.enumType = []; this.service = []; @@ -1511,6 +1515,14 @@ */ FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + /** + * FileDescriptorProto optionDependency. + * @member {Array.} optionDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.optionDependency = $util.emptyArray; + /** * FileDescriptorProto messageType. * @member {Array.} messageType @@ -1632,6 +1644,9 @@ writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + if (message.optionDependency != null && message.optionDependency.length) + for (var i = 0; i < message.optionDependency.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.optionDependency[i]); return writer; }; @@ -1704,6 +1719,12 @@ message.weakDependency.push(reader.int32()); break; } + case 15: { + if (!(message.optionDependency && message.optionDependency.length)) + message.optionDependency = []; + message.optionDependency.push(reader.string()); + break; + } case 4: { if (!(message.messageType && message.messageType.length)) message.messageType = []; @@ -1806,6 +1827,13 @@ if (!$util.isInteger(message.weakDependency[i])) return "weakDependency: integer[] expected"; } + if (message.optionDependency != null && message.hasOwnProperty("optionDependency")) { + if (!Array.isArray(message.optionDependency)) + return "optionDependency: array expected"; + for (var i = 0; i < message.optionDependency.length; ++i) + if (!$util.isString(message.optionDependency[i])) + return "optionDependency: string[] expected"; + } if (message.messageType != null && message.hasOwnProperty("messageType")) { if (!Array.isArray(message.messageType)) return "messageType: array expected"; @@ -1860,6 +1888,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -1912,6 +1941,13 @@ for (var i = 0; i < object.weakDependency.length; ++i) message.weakDependency[i] = object.weakDependency[i] | 0; } + if (object.optionDependency) { + if (!Array.isArray(object.optionDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.optionDependency: array expected"); + message.optionDependency = []; + for (var i = 0; i < object.optionDependency.length; ++i) + message.optionDependency[i] = String(object.optionDependency[i]); + } if (object.messageType) { if (!Array.isArray(object.messageType)) throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); @@ -1975,6 +2011,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -2040,6 +2080,7 @@ object.extension = []; object.publicDependency = []; object.weakDependency = []; + object.optionDependency = []; } if (options.defaults) { object.name = ""; @@ -2096,6 +2137,11 @@ object.syntax = message.syntax; if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.optionDependency && message.optionDependency.length) { + object.optionDependency = []; + for (var j = 0; j < message.optionDependency.length; ++j) + object.optionDependency[j] = message.optionDependency[j]; + } return object; }; @@ -2144,6 +2190,7 @@ * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options * @property {Array.|null} [reservedRange] DescriptorProto reservedRange * @property {Array.|null} [reservedName] DescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] DescriptorProto visibility */ /** @@ -2249,6 +2296,14 @@ */ DescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * DescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.visibility = 0; + /** * Creates a new DescriptorProto instance using the specified properties. * @function create @@ -2301,6 +2356,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.visibility); return writer; }; @@ -2393,6 +2450,10 @@ message.reservedName.push(reader.string()); break; } + case 11: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -2506,6 +2567,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -2605,6 +2675,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -2634,6 +2724,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -2679,6 +2770,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -4723,6 +4816,7 @@ * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] EnumDescriptorProto visibility */ /** @@ -4783,6 +4877,14 @@ */ EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * EnumDescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.visibility = 0; + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @function create @@ -4820,6 +4922,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.visibility); return writer; }; @@ -4882,6 +4986,10 @@ message.reservedName.push(reader.string()); break; } + case 6: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -4950,6 +5058,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -4999,6 +5116,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -5023,6 +5160,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -5043,6 +5181,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -7361,6 +7501,7 @@ * @property {Array.|null} [targets] FieldOptions targets * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] FieldOptions featureSupport * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference @@ -7481,6 +7622,14 @@ */ FieldOptions.prototype.features = null; + /** + * FieldOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.featureSupport = null; + /** * FieldOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -7555,6 +7704,8 @@ $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); if (message.features != null && Object.hasOwnProperty.call(message, "features")) $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -7656,6 +7807,10 @@ message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } + case 22: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -7791,6 +7946,11 @@ if (error) return "features." + error; } + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -7979,6 +8139,11 @@ throw TypeError(".google.protobuf.FieldOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); } + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); @@ -8076,6 +8241,7 @@ object.debugRedact = false; object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; object.features = null; + object.featureSupport = null; object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) @@ -8108,6 +8274,8 @@ } if (message.features != null && message.hasOwnProperty("features")) object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -8380,6 +8548,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -8421,6 +8590,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -8520,6 +8693,488 @@ return EditionDefault; })(); + FieldOptions.FeatureSupport = (function() { + + /** + * Properties of a FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @interface IFeatureSupport + * @property {google.protobuf.Edition|null} [editionIntroduced] FeatureSupport editionIntroduced + * @property {google.protobuf.Edition|null} [editionDeprecated] FeatureSupport editionDeprecated + * @property {string|null} [deprecationWarning] FeatureSupport deprecationWarning + * @property {google.protobuf.Edition|null} [editionRemoved] FeatureSupport editionRemoved + */ + + /** + * Constructs a new FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents a FeatureSupport. + * @implements IFeatureSupport + * @constructor + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + */ + function FeatureSupport(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]]; + } + + /** + * FeatureSupport editionIntroduced. + * @member {google.protobuf.Edition} editionIntroduced + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionIntroduced = 0; + + /** + * FeatureSupport editionDeprecated. + * @member {google.protobuf.Edition} editionDeprecated + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionDeprecated = 0; + + /** + * FeatureSupport deprecationWarning. + * @member {string} deprecationWarning + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.deprecationWarning = ""; + + /** + * FeatureSupport editionRemoved. + * @member {google.protobuf.Edition} editionRemoved + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionRemoved = 0; + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport instance + */ + FeatureSupport.create = function create(properties) { + return new FeatureSupport(properties); + }; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editionDeprecated); + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.deprecationWarning); + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.editionRemoved); + return writer; + }; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.editionIntroduced = reader.int32(); + break; + } + case 2: { + message.editionDeprecated = reader.int32(); + break; + } + case 3: { + message.deprecationWarning = reader.string(); + break; + } + case 4: { + message.editionRemoved = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSupport message. + * @function verify + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSupport.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + switch (message.editionIntroduced) { + default: + return "editionIntroduced: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + switch (message.editionDeprecated) { + default: + return "editionDeprecated: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + if (!$util.isString(message.deprecationWarning)) + return "deprecationWarning: string expected"; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + switch (message.editionRemoved) { + default: + return "editionRemoved: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + */ + FeatureSupport.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) + return object; + var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + switch (object.editionIntroduced) { + default: + if (typeof object.editionIntroduced === "number") { + message.editionIntroduced = object.editionIntroduced; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionIntroduced = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionIntroduced = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionIntroduced = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionIntroduced = 999; + break; + case "EDITION_2023": + case 1000: + message.editionIntroduced = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionIntroduced = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionIntroduced = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionIntroduced = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionIntroduced = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionIntroduced = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionIntroduced = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionIntroduced = 2147483647; + break; + } + switch (object.editionDeprecated) { + default: + if (typeof object.editionDeprecated === "number") { + message.editionDeprecated = object.editionDeprecated; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionDeprecated = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionDeprecated = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionDeprecated = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionDeprecated = 999; + break; + case "EDITION_2023": + case 1000: + message.editionDeprecated = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionDeprecated = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionDeprecated = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionDeprecated = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionDeprecated = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionDeprecated = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionDeprecated = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionDeprecated = 2147483647; + break; + } + if (object.deprecationWarning != null) + message.deprecationWarning = String(object.deprecationWarning); + switch (object.editionRemoved) { + default: + if (typeof object.editionRemoved === "number") { + message.editionRemoved = object.editionRemoved; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionRemoved = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionRemoved = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionRemoved = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionRemoved = 999; + break; + case "EDITION_2023": + case 1000: + message.editionRemoved = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionRemoved = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionRemoved = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionRemoved = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionRemoved = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionRemoved = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionRemoved = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionRemoved = 2147483647; + break; + } + return message; + }; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.FeatureSupport} message FeatureSupport + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSupport.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionDeprecated = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.deprecationWarning = ""; + object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + object.deprecationWarning = message.deprecationWarning; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; + return object; + }; + + /** + * Converts this FeatureSupport to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + * @returns {Object.} JSON object + */ + FeatureSupport.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSupport + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.FeatureSupport"; + }; + + return FeatureSupport; + })(); + return FieldOptions; })(); @@ -9112,6 +9767,7 @@ * @property {boolean|null} [deprecated] EnumValueOptions deprecated * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] EnumValueOptions featureSupport * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption */ @@ -9155,6 +9811,14 @@ */ EnumValueOptions.prototype.debugRedact = false; + /** + * EnumValueOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.featureSupport = null; + /** * EnumValueOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -9193,6 +9857,8 @@ $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -9244,6 +9910,10 @@ message.debugRedact = reader.bool(); break; } + case 4: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -9296,6 +9966,11 @@ if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) if (typeof message.debugRedact !== "boolean") return "debugRedact: boolean expected"; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -9329,6 +10004,11 @@ } if (object.debugRedact != null) message.debugRedact = Boolean(object.debugRedact); + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); @@ -9361,6 +10041,7 @@ object.deprecated = false; object.features = null; object.debugRedact = false; + object.featureSupport = null; } if (message.deprecated != null && message.hasOwnProperty("deprecated")) object.deprecated = message.deprecated; @@ -9368,6 +10049,8 @@ object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) object.debugRedact = message.debugRedact; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -10835,6 +11518,8 @@ * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + * @property {google.protobuf.FeatureSet.EnforceNamingStyle|null} [enforceNamingStyle] FeatureSet enforceNamingStyle + * @property {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null} [defaultSymbolVisibility] FeatureSet defaultSymbolVisibility */ /** @@ -10900,6 +11585,22 @@ */ FeatureSet.prototype.jsonFormat = 0; + /** + * FeatureSet enforceNamingStyle. + * @member {google.protobuf.FeatureSet.EnforceNamingStyle} enforceNamingStyle + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enforceNamingStyle = 0; + + /** + * FeatureSet defaultSymbolVisibility. + * @member {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility} defaultSymbolVisibility + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.defaultSymbolVisibility = 0; + /** * Creates a new FeatureSet instance using the specified properties. * @function create @@ -10936,6 +11637,10 @@ writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enforceNamingStyle); + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.defaultSymbolVisibility); return writer; }; @@ -10996,6 +11701,14 @@ message.jsonFormat = reader.int32(); break; } + case 7: { + message.enforceNamingStyle = reader.int32(); + break; + } + case 8: { + message.defaultSymbolVisibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -11086,6 +11799,26 @@ case 2: break; } + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + switch (message.enforceNamingStyle) { + default: + return "enforceNamingStyle: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + switch (message.defaultSymbolVisibility) { + default: + return "defaultSymbolVisibility: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } return null; }; @@ -11225,6 +11958,54 @@ message.jsonFormat = 2; break; } + switch (object.enforceNamingStyle) { + default: + if (typeof object.enforceNamingStyle === "number") { + message.enforceNamingStyle = object.enforceNamingStyle; + break; + } + break; + case "ENFORCE_NAMING_STYLE_UNKNOWN": + case 0: + message.enforceNamingStyle = 0; + break; + case "STYLE2024": + case 1: + message.enforceNamingStyle = 1; + break; + case "STYLE_LEGACY": + case 2: + message.enforceNamingStyle = 2; + break; + } + switch (object.defaultSymbolVisibility) { + default: + if (typeof object.defaultSymbolVisibility === "number") { + message.defaultSymbolVisibility = object.defaultSymbolVisibility; + break; + } + break; + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + case 0: + message.defaultSymbolVisibility = 0; + break; + case "EXPORT_ALL": + case 1: + message.defaultSymbolVisibility = 1; + break; + case "EXPORT_TOP_LEVEL": + case 2: + message.defaultSymbolVisibility = 2; + break; + case "LOCAL_ALL": + case 3: + message.defaultSymbolVisibility = 3; + break; + case "STRICT": + case 4: + message.defaultSymbolVisibility = 4; + break; + } return message; }; @@ -11248,6 +12029,8 @@ object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; + object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; } if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; @@ -11261,6 +12044,10 @@ object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; return object; }; @@ -11388,6 +12175,219 @@ return values; })(); + /** + * EnforceNamingStyle enum. + * @name google.protobuf.FeatureSet.EnforceNamingStyle + * @enum {number} + * @property {number} ENFORCE_NAMING_STYLE_UNKNOWN=0 ENFORCE_NAMING_STYLE_UNKNOWN value + * @property {number} STYLE2024=1 STYLE2024 value + * @property {number} STYLE_LEGACY=2 STYLE_LEGACY value + */ + FeatureSet.EnforceNamingStyle = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENFORCE_NAMING_STYLE_UNKNOWN"] = 0; + values[valuesById[1] = "STYLE2024"] = 1; + values[valuesById[2] = "STYLE_LEGACY"] = 2; + return values; + })(); + + FeatureSet.VisibilityFeature = (function() { + + /** + * Properties of a VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @interface IVisibilityFeature + */ + + /** + * Constructs a new VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @classdesc Represents a VisibilityFeature. + * @implements IVisibilityFeature + * @constructor + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + */ + function VisibilityFeature(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]]; + } + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature instance + */ + VisibilityFeature.create = function create(properties) { + return new VisibilityFeature(properties); + }; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisibilityFeature message. + * @function verify + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisibilityFeature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + */ + VisibilityFeature.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) + return object; + return new $root.google.protobuf.FeatureSet.VisibilityFeature(); + }; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.VisibilityFeature} message VisibilityFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisibilityFeature.toObject = function toObject() { + return {}; + }; + + /** + * Converts this VisibilityFeature to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @instance + * @returns {Object.} JSON object + */ + VisibilityFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VisibilityFeature + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisibilityFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet.VisibilityFeature"; + }; + + /** + * DefaultSymbolVisibility enum. + * @name google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + * @enum {number} + * @property {number} DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN value + * @property {number} EXPORT_ALL=1 EXPORT_ALL value + * @property {number} EXPORT_TOP_LEVEL=2 EXPORT_TOP_LEVEL value + * @property {number} LOCAL_ALL=3 LOCAL_ALL value + * @property {number} STRICT=4 STRICT value + */ + VisibilityFeature.DefaultSymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0; + values[valuesById[1] = "EXPORT_ALL"] = 1; + values[valuesById[2] = "EXPORT_TOP_LEVEL"] = 2; + values[valuesById[3] = "LOCAL_ALL"] = 3; + values[valuesById[4] = "STRICT"] = 4; + return values; + })(); + + return VisibilityFeature; + })(); + return FeatureSet; })(); @@ -11572,6 +12572,7 @@ default: return "minimumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -11589,6 +12590,7 @@ default: return "maximumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -11637,6 +12639,10 @@ case 0: message.minimumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.minimumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.minimumEdition = 998; @@ -11689,6 +12695,10 @@ case 0: message.maximumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.maximumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.maximumEdition = 998; @@ -11797,7 +12807,8 @@ * @memberof google.protobuf.FeatureSetDefaults * @interface IFeatureSetEditionDefault * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition - * @property {google.protobuf.IFeatureSet|null} [features] FeatureSetEditionDefault features + * @property {google.protobuf.IFeatureSet|null} [overridableFeatures] FeatureSetEditionDefault overridableFeatures + * @property {google.protobuf.IFeatureSet|null} [fixedFeatures] FeatureSetEditionDefault fixedFeatures */ /** @@ -11824,12 +12835,20 @@ FeatureSetEditionDefault.prototype.edition = 0; /** - * FeatureSetEditionDefault features. - * @member {google.protobuf.IFeatureSet|null|undefined} features + * FeatureSetEditionDefault overridableFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} overridableFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.overridableFeatures = null; + + /** + * FeatureSetEditionDefault fixedFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} fixedFeatures * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @instance */ - FeatureSetEditionDefault.prototype.features = null; + FeatureSetEditionDefault.prototype.fixedFeatures = null; /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -11855,10 +12874,12 @@ FeatureSetEditionDefault.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -11899,8 +12920,12 @@ message.edition = reader.int32(); break; } - case 2: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + case 4: { + message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 5: { + message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } default: @@ -11943,6 +12968,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -11955,10 +12981,15 @@ case 2147483647: break; } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures); + if (error) + return "overridableFeatures." + error; + } + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures); if (error) - return "features." + error; + return "fixedFeatures." + error; } return null; }; @@ -11986,6 +13017,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -12027,10 +13062,15 @@ message.edition = 2147483647; break; } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + if (object.overridableFeatures != null) { + if (typeof object.overridableFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); + message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures); + } + if (object.fixedFeatures != null) { + if (typeof object.fixedFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); + message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures); } return message; }; @@ -12049,13 +13089,16 @@ options = {}; var object = {}; if (options.defaults) { - object.features = null; object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.overridableFeatures = null; + object.fixedFeatures = null; } - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) + object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options); + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) + object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options); return object; }; @@ -13270,6 +14313,22 @@ return GeneratedCodeInfo; })(); + /** + * SymbolVisibility enum. + * @name google.protobuf.SymbolVisibility + * @enum {number} + * @property {number} VISIBILITY_UNSET=0 VISIBILITY_UNSET value + * @property {number} VISIBILITY_LOCAL=1 VISIBILITY_LOCAL value + * @property {number} VISIBILITY_EXPORT=2 VISIBILITY_EXPORT value + */ + protobuf.SymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VISIBILITY_UNSET"] = 0; + values[valuesById[1] = "VISIBILITY_LOCAL"] = 1; + values[valuesById[2] = "VISIBILITY_EXPORT"] = 2; + return values; + })(); + protobuf.Duration = (function() { /** @@ -130912,6 +131971,7 @@ * @interface ICommonLanguageSettings * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri * @property {Array.|null} [destinations] CommonLanguageSettings destinations + * @property {google.api.ISelectiveGapicGeneration|null} [selectiveGapicGeneration] CommonLanguageSettings selectiveGapicGeneration */ /** @@ -130946,6 +132006,14 @@ */ CommonLanguageSettings.prototype.destinations = $util.emptyArray; + /** + * CommonLanguageSettings selectiveGapicGeneration. + * @member {google.api.ISelectiveGapicGeneration|null|undefined} selectiveGapicGeneration + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.selectiveGapicGeneration = null; + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @function create @@ -130978,6 +132046,8 @@ writer.int32(message.destinations[i]); writer.ldelim(); } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -131029,6 +132099,10 @@ message.destinations.push(reader.int32()); break; } + case 3: { + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -131080,6 +132154,11 @@ break; } } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { + var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration); + if (error) + return "selectiveGapicGeneration." + error; + } return null; }; @@ -131122,6 +132201,11 @@ break; } } + if (object.selectiveGapicGeneration != null) { + if (typeof object.selectiveGapicGeneration !== "object") + throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration); + } return message; }; @@ -131140,8 +132224,10 @@ var object = {}; if (options.arrays || options.defaults) object.destinations = []; - if (options.defaults) + if (options.defaults) { object.referenceDocsUri = ""; + object.selectiveGapicGeneration = null; + } if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) object.referenceDocsUri = message.referenceDocsUri; if (message.destinations && message.destinations.length) { @@ -131149,6 +132235,8 @@ for (var j = 0; j < message.destinations.length; ++j) object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) + object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options); return object; }; @@ -132971,6 +134059,7 @@ * @memberof google.api * @interface IPythonSettings * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common + * @property {google.api.PythonSettings.IExperimentalFeatures|null} [experimentalFeatures] PythonSettings experimentalFeatures */ /** @@ -132996,6 +134085,14 @@ */ PythonSettings.prototype.common = null; + /** + * PythonSettings experimentalFeatures. + * @member {google.api.PythonSettings.IExperimentalFeatures|null|undefined} experimentalFeatures + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.experimentalFeatures = null; + /** * Creates a new PythonSettings instance using the specified properties. * @function create @@ -133022,6 +134119,8 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -133062,6 +134161,10 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -133102,6 +134205,11 @@ if (error) return "common." + error; } + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { + var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures); + if (error) + return "experimentalFeatures." + error; + } return null; }; @@ -133122,6 +134230,11 @@ throw TypeError(".google.api.PythonSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.experimentalFeatures != null) { + if (typeof object.experimentalFeatures !== "object") + throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures); + } return message; }; @@ -133138,10 +134251,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.common = null; + object.experimentalFeatures = null; + } if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) + object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options); return object; }; @@ -133171,6 +134288,258 @@ return typeUrlPrefix + "/google.api.PythonSettings"; }; + PythonSettings.ExperimentalFeatures = (function() { + + /** + * Properties of an ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @interface IExperimentalFeatures + * @property {boolean|null} [restAsyncIoEnabled] ExperimentalFeatures restAsyncIoEnabled + * @property {boolean|null} [protobufPythonicTypesEnabled] ExperimentalFeatures protobufPythonicTypesEnabled + * @property {boolean|null} [unversionedPackageDisabled] ExperimentalFeatures unversionedPackageDisabled + */ + + /** + * Constructs a new ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @classdesc Represents an ExperimentalFeatures. + * @implements IExperimentalFeatures + * @constructor + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + */ + function ExperimentalFeatures(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]]; + } + + /** + * ExperimentalFeatures restAsyncIoEnabled. + * @member {boolean} restAsyncIoEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.restAsyncIoEnabled = false; + + /** + * ExperimentalFeatures protobufPythonicTypesEnabled. + * @member {boolean} protobufPythonicTypesEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.protobufPythonicTypesEnabled = false; + + /** + * ExperimentalFeatures unversionedPackageDisabled. + * @member {boolean} unversionedPackageDisabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.unversionedPackageDisabled = false; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures instance + */ + ExperimentalFeatures.create = function create(properties) { + return new ExperimentalFeatures(properties); + }; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.protobufPythonicTypesEnabled); + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unversionedPackageDisabled); + return writer; + }; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restAsyncIoEnabled = reader.bool(); + break; + } + case 2: { + message.protobufPythonicTypesEnabled = reader.bool(); + break; + } + case 3: { + message.unversionedPackageDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExperimentalFeatures message. + * @function verify + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExperimentalFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + if (typeof message.restAsyncIoEnabled !== "boolean") + return "restAsyncIoEnabled: boolean expected"; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + if (typeof message.protobufPythonicTypesEnabled !== "boolean") + return "protobufPythonicTypesEnabled: boolean expected"; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + if (typeof message.unversionedPackageDisabled !== "boolean") + return "unversionedPackageDisabled: boolean expected"; + return null; + }; + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + */ + ExperimentalFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) + return object; + var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + if (object.restAsyncIoEnabled != null) + message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); + if (object.protobufPythonicTypesEnabled != null) + message.protobufPythonicTypesEnabled = Boolean(object.protobufPythonicTypesEnabled); + if (object.unversionedPackageDisabled != null) + message.unversionedPackageDisabled = Boolean(object.unversionedPackageDisabled); + return message; + }; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.ExperimentalFeatures} message ExperimentalFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExperimentalFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.restAsyncIoEnabled = false; + object.protobufPythonicTypesEnabled = false; + object.unversionedPackageDisabled = false; + } + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + object.restAsyncIoEnabled = message.restAsyncIoEnabled; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + object.unversionedPackageDisabled = message.unversionedPackageDisabled; + return object; + }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @function toJSON + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + * @returns {Object.} JSON object + */ + ExperimentalFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExperimentalFeatures + * @function getTypeUrl + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExperimentalFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings.ExperimentalFeatures"; + }; + + return ExperimentalFeatures; + })(); + return PythonSettings; })(); @@ -134047,6 +135416,7 @@ * @memberof google.api * @interface IGoSettings * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common + * @property {Object.|null} [renamedServices] GoSettings renamedServices */ /** @@ -134058,6 +135428,7 @@ * @param {google.api.IGoSettings=} [properties] Properties to set */ function GoSettings(properties) { + this.renamedServices = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -134072,6 +135443,14 @@ */ GoSettings.prototype.common = null; + /** + * GoSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.renamedServices = $util.emptyObject; + /** * Creates a new GoSettings instance using the specified properties. * @function create @@ -134098,6 +135477,9 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); return writer; }; @@ -134128,7 +135510,7 @@ GoSettings.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) @@ -134138,6 +135520,29 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedServices[key] = value; + break; + } default: reader.skipType(tag & 7); break; @@ -134178,6 +135583,14 @@ if (error) return "common." + error; } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } return null; }; @@ -134198,6 +135611,13 @@ throw TypeError(".google.api.GoSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.GoSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } return message; }; @@ -134214,10 +135634,18 @@ if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) + object.renamedServices = {}; if (options.defaults) object.common = null; if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } return object; }; @@ -134856,6 +136284,251 @@ return values; })(); + api.SelectiveGapicGeneration = (function() { + + /** + * Properties of a SelectiveGapicGeneration. + * @memberof google.api + * @interface ISelectiveGapicGeneration + * @property {Array.|null} [methods] SelectiveGapicGeneration methods + * @property {boolean|null} [generateOmittedAsInternal] SelectiveGapicGeneration generateOmittedAsInternal + */ + + /** + * Constructs a new SelectiveGapicGeneration. + * @memberof google.api + * @classdesc Represents a SelectiveGapicGeneration. + * @implements ISelectiveGapicGeneration + * @constructor + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + */ + function SelectiveGapicGeneration(properties) { + this.methods = []; + 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]]; + } + + /** + * SelectiveGapicGeneration methods. + * @member {Array.} methods + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.methods = $util.emptyArray; + + /** + * SelectiveGapicGeneration generateOmittedAsInternal. + * @member {boolean} generateOmittedAsInternal + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.generateOmittedAsInternal = false; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @function create + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration instance + */ + SelectiveGapicGeneration.create = function create(properties) { + return new SelectiveGapicGeneration(properties); + }; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methods != null && message.methods.length) + for (var i = 0; i < message.methods.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.generateOmittedAsInternal); + return writer; + }; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @function decode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.methods && message.methods.length)) + message.methods = []; + message.methods.push(reader.string()); + break; + } + case 2: { + message.generateOmittedAsInternal = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectiveGapicGeneration message. + * @function verify + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectiveGapicGeneration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methods != null && message.hasOwnProperty("methods")) { + if (!Array.isArray(message.methods)) + return "methods: array expected"; + for (var i = 0; i < message.methods.length; ++i) + if (!$util.isString(message.methods[i])) + return "methods: string[] expected"; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + if (typeof message.generateOmittedAsInternal !== "boolean") + return "generateOmittedAsInternal: boolean expected"; + return null; + }; + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} object Plain object + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + */ + SelectiveGapicGeneration.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.SelectiveGapicGeneration) + return object; + var message = new $root.google.api.SelectiveGapicGeneration(); + if (object.methods) { + if (!Array.isArray(object.methods)) + throw TypeError(".google.api.SelectiveGapicGeneration.methods: array expected"); + message.methods = []; + for (var i = 0; i < object.methods.length; ++i) + message.methods[i] = String(object.methods[i]); + } + if (object.generateOmittedAsInternal != null) + message.generateOmittedAsInternal = Boolean(object.generateOmittedAsInternal); + return message; + }; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.SelectiveGapicGeneration} message SelectiveGapicGeneration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectiveGapicGeneration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.methods = []; + if (options.defaults) + object.generateOmittedAsInternal = false; + if (message.methods && message.methods.length) { + object.methods = []; + for (var j = 0; j < message.methods.length; ++j) + object.methods[j] = message.methods[j]; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + object.generateOmittedAsInternal = message.generateOmittedAsInternal; + return object; + }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @function toJSON + * @memberof google.api.SelectiveGapicGeneration + * @instance + * @returns {Object.} JSON object + */ + SelectiveGapicGeneration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @function getTypeUrl + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectiveGapicGeneration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.SelectiveGapicGeneration"; + }; + + return SelectiveGapicGeneration; + })(); + /** * LaunchStage enum. * @name google.api.LaunchStage diff --git a/packages/google-cloud-visionai/protos/protos.json b/packages/google-cloud-visionai/protos/protos.json index 5e4db398e154..b7c9bd43cce5 100644 --- a/packages/google-cloud-visionai/protos/protos.json +++ b/packages/google-cloud-visionai/protos/protos.json @@ -96,12 +96,19 @@ "type": "FileDescriptorProto", "id": 1 } - } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ] }, "Edition": { "edition": "proto2", "values": { "EDITION_UNKNOWN": 0, + "EDITION_LEGACY": 900, "EDITION_PROTO2": 998, "EDITION_PROTO3": 999, "EDITION_2023": 1000, @@ -140,6 +147,11 @@ "type": "int32", "id": 11 }, + "optionDependency": { + "rule": "repeated", + "type": "string", + "id": 15 + }, "messageType": { "rule": "repeated", "type": "DescriptorProto", @@ -228,6 +240,10 @@ "rule": "repeated", "type": "string", "id": 10 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 11 } }, "nested": { @@ -453,6 +469,10 @@ "rule": "repeated", "type": "string", "id": 5 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 6 } }, "nested": { @@ -503,7 +523,14 @@ "type": "ServiceOptions", "id": 3 } - } + }, + "reserved": [ + [ + 4, + 4 + ], + "stream" + ] }, "MethodDescriptorProto": { "edition": "proto2", @@ -667,6 +694,7 @@ 42, 42 ], + "php_generic_services", [ 38, 38 @@ -802,7 +830,8 @@ "type": "bool", "id": 10, "options": { - "default": false + "default": false, + "deprecated": true } }, "debugRedact": { @@ -830,6 +859,10 @@ "type": "FeatureSet", "id": 21 }, + "featureSupport": { + "type": "FeatureSupport", + "id": 22 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -899,6 +932,26 @@ "id": 2 } } + }, + "FeatureSupport": { + "fields": { + "editionIntroduced": { + "type": "Edition", + "id": 1 + }, + "editionDeprecated": { + "type": "Edition", + "id": 2 + }, + "deprecationWarning": { + "type": "string", + "id": 3 + }, + "editionRemoved": { + "type": "Edition", + "id": 4 + } + } } } }, @@ -987,6 +1040,10 @@ "default": false } }, + "featureSupport": { + "type": "FieldOptions.FeatureSupport", + "id": 4 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -1129,6 +1186,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_2023", "edition_defaults.value": "EXPLICIT" } @@ -1139,6 +1197,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "OPEN" } @@ -1149,6 +1208,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "PACKED" } @@ -1159,6 +1219,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "VERIFY" } @@ -1169,7 +1230,8 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "EDITION_PROTO2", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_LEGACY", "edition_defaults.value": "LENGTH_PREFIXED" } }, @@ -1179,27 +1241,38 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "ALLOW" } + }, + "enforceNamingStyle": { + "type": "EnforceNamingStyle", + "id": 7, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_METHOD", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "STYLE2024" + } + }, + "defaultSymbolVisibility": { + "type": "VisibilityFeature.DefaultSymbolVisibility", + "id": 8, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "EXPORT_TOP_LEVEL" + } } }, "extensions": [ [ 1000, - 1000 - ], - [ - 1001, - 1001 - ], - [ - 1002, - 1002 - ], - [ - 9990, - 9990 + 9994 ], [ 9995, @@ -1244,7 +1317,13 @@ "UTF8_VALIDATION_UNKNOWN": 0, "VERIFY": 2, "NONE": 3 - } + }, + "reserved": [ + [ + 1, + 1 + ] + ] }, "MessageEncoding": { "values": { @@ -1259,6 +1338,33 @@ "ALLOW": 1, "LEGACY_BEST_EFFORT": 2 } + }, + "EnforceNamingStyle": { + "values": { + "ENFORCE_NAMING_STYLE_UNKNOWN": 0, + "STYLE2024": 1, + "STYLE_LEGACY": 2 + } + }, + "VisibilityFeature": { + "fields": {}, + "reserved": [ + [ + 1, + 536870911 + ] + ], + "nested": { + "DefaultSymbolVisibility": { + "values": { + "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, + "EXPORT_ALL": 1, + "EXPORT_TOP_LEVEL": 2, + "LOCAL_ALL": 3, + "STRICT": 4 + } + } + } } } }, @@ -1286,11 +1392,26 @@ "type": "Edition", "id": 3 }, - "features": { + "overridableFeatures": { "type": "FeatureSet", - "id": 2 + "id": 4 + }, + "fixedFeatures": { + "type": "FeatureSet", + "id": 5 } - } + }, + "reserved": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + "features" + ] } } }, @@ -1303,6 +1424,12 @@ "id": 1 } }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ], "nested": { "Location": { "fields": { @@ -1388,6 +1515,14 @@ } } }, + "SymbolVisibility": { + "edition": "proto2", + "values": { + "VISIBILITY_UNSET": 0, + "VISIBILITY_LOCAL": 1, + "VISIBILITY_EXPORT": 2 + } + }, "Duration": { "fields": { "seconds": { @@ -13073,8 +13208,7 @@ "java_multiple_files": true, "java_outer_classname": "LaunchStageProto", "java_package": "com.google.api", - "objc_class_prefix": "GAPI", - "cc_enable_arenas": true + "objc_class_prefix": "GAPI" }, "nested": { "fieldBehavior": { @@ -13297,6 +13431,10 @@ "rule": "repeated", "type": "ClientLibraryDestination", "id": 2 + }, + "selectiveGapicGeneration": { + "type": "SelectiveGapicGeneration", + "id": 3 } } }, @@ -13437,6 +13575,28 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "experimentalFeatures": { + "type": "ExperimentalFeatures", + "id": 2 + } + }, + "nested": { + "ExperimentalFeatures": { + "fields": { + "restAsyncIoEnabled": { + "type": "bool", + "id": 1 + }, + "protobufPythonicTypesEnabled": { + "type": "bool", + "id": 2 + }, + "unversionedPackageDisabled": { + "type": "bool", + "id": 3 + } + } } } }, @@ -13494,6 +13654,11 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 } } }, @@ -13555,6 +13720,19 @@ "PACKAGE_MANAGER": 20 } }, + "SelectiveGapicGeneration": { + "fields": { + "methods": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "generateOmittedAsInternal": { + "type": "bool", + "id": 2 + } + } + }, "LaunchStage": { "values": { "LAUNCH_STAGE_UNSPECIFIED": 0, @@ -13577,6 +13755,7 @@ "java_multiple_files": true, "java_outer_classname": "OperationsProto", "java_package": "com.google.longrunning", + "objc_class_prefix": "GLRUN", "php_namespace": "Google\\LongRunning" }, "nested": { diff --git a/packages/google-cloud-visionai/src/v1/app_platform_client.ts b/packages/google-cloud-visionai/src/v1/app_platform_client.ts index 6b4cfe4cb823..0bdea04929e6 100644 --- a/packages/google-cloud-visionai/src/v1/app_platform_client.ts +++ b/packages/google-cloud-visionai/src/v1/app_platform_client.ts @@ -18,11 +18,24 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +57,7 @@ export class AppPlatformClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('visionai'); @@ -57,12 +70,12 @@ export class AppPlatformClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - appPlatformStub?: Promise<{[name: string]: Function}>; + appPlatformStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of AppPlatformClient. @@ -103,21 +116,42 @@ export class AppPlatformClient { * const client = new AppPlatformClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof AppPlatformClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'warehouse-visionai.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -142,7 +176,7 @@ export class AppPlatformClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,18 +189,14 @@ export class AppPlatformClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -188,73 +218,73 @@ export class AppPlatformClient { // Create useful helper objects for these. this.pathTemplates = { analysisPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/analyses/{analysis}' + 'projects/{project}/locations/{location}/clusters/{cluster}/analyses/{analysis}', ), annotationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}', ), applicationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}' + 'projects/{project}/locations/{location}/applications/{application}', ), assetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}', ), channelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/channels/{channel}' + 'projects/{project}/locations/{location}/clusters/{cluster}/channels/{channel}', ), clusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}' + 'projects/{project}/locations/{location}/clusters/{cluster}', ), collectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}', ), corpusPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}', ), dataSchemaPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}', ), draftPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}/drafts/{draft}' + 'projects/{project}/locations/{location}/applications/{application}/drafts/{draft}', ), eventPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/events/{event}' + 'projects/{project}/locations/{location}/clusters/{cluster}/events/{event}', ), indexPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}', ), indexEndpointPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}' + 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}', ), instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}/instances/{instance}' + 'projects/{project}/locations/{location}/applications/{application}/instances/{instance}', ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), operatorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/operators/{operator}' + 'projects/{project}/locations/{location}/operators/{operator}', ), processPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/processes/{process}' + 'projects/{project}/locations/{location}/clusters/{cluster}/processes/{process}', ), processorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/processors/{processor}' + 'projects/{project}/locations/{location}/processors/{processor}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), searchConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}', ), searchHypernymPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}', ), seriesPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/series/{series}' + 'projects/{project}/locations/{location}/clusters/{cluster}/series/{series}', ), streamPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/streams/{stream}' + 'projects/{project}/locations/{location}/clusters/{cluster}/streams/{stream}', ), }; @@ -262,14 +292,26 @@ export class AppPlatformClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listApplications: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'applications'), - listInstances: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instances'), - listDrafts: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'drafts'), - listProcessors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'processors') + listApplications: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'applications', + ), + listInstances: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'instances', + ), + listDrafts: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'drafts', + ), + listProcessors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'processors', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -278,158 +320,282 @@ export class AppPlatformClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/warehouseOperations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/assets/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/collections/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/imageIndexes/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/indexes/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { get: '/v1/{name=projects/*/locations/*/warehouseOperations/*}' }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/assets/*/operations/*}', + }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/collections/*/operations/*}', + }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/imageIndexes/*/operations/*}', + }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/indexes/*/operations/*}', + }, + { get: '/v1/{name=projects/*/locations/*/corpora/*/operations/*}' }, + { + get: '/v1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createApplicationResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Application') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Application', + ) as gax.protobuf.Type; const createApplicationMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateApplicationResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Application') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Application', + ) as gax.protobuf.Type; const updateApplicationMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteApplicationResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteApplicationMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const deployApplicationResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.DeployApplicationResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.DeployApplicationResponse', + ) as gax.protobuf.Type; const deployApplicationMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const undeployApplicationResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.UndeployApplicationResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.UndeployApplicationResponse', + ) as gax.protobuf.Type; const undeployApplicationMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const addApplicationStreamInputResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.AddApplicationStreamInputResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.AddApplicationStreamInputResponse', + ) as gax.protobuf.Type; const addApplicationStreamInputMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const removeApplicationStreamInputResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.RemoveApplicationStreamInputResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.RemoveApplicationStreamInputResponse', + ) as gax.protobuf.Type; const removeApplicationStreamInputMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateApplicationStreamInputResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.UpdateApplicationStreamInputResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.UpdateApplicationStreamInputResponse', + ) as gax.protobuf.Type; const updateApplicationStreamInputMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const createApplicationInstancesResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.CreateApplicationInstancesResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.CreateApplicationInstancesResponse', + ) as gax.protobuf.Type; const createApplicationInstancesMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteApplicationInstancesResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Instance') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Instance', + ) as gax.protobuf.Type; const deleteApplicationInstancesMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateApplicationInstancesResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.UpdateApplicationInstancesResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.UpdateApplicationInstancesResponse', + ) as gax.protobuf.Type; const updateApplicationInstancesMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const createDraftResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Draft') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Draft', + ) as gax.protobuf.Type; const createDraftMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateDraftResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Draft') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Draft', + ) as gax.protobuf.Type; const updateDraftMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteDraftResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteDraftMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const createProcessorResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Processor') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Processor', + ) as gax.protobuf.Type; const createProcessorMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateProcessorResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Processor') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Processor', + ) as gax.protobuf.Type; const updateProcessorMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteProcessorResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteProcessorMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createApplication: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createApplicationResponse.decode.bind(createApplicationResponse), - createApplicationMetadata.decode.bind(createApplicationMetadata)), + createApplicationMetadata.decode.bind(createApplicationMetadata), + ), updateApplication: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateApplicationResponse.decode.bind(updateApplicationResponse), - updateApplicationMetadata.decode.bind(updateApplicationMetadata)), + updateApplicationMetadata.decode.bind(updateApplicationMetadata), + ), deleteApplication: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteApplicationResponse.decode.bind(deleteApplicationResponse), - deleteApplicationMetadata.decode.bind(deleteApplicationMetadata)), + deleteApplicationMetadata.decode.bind(deleteApplicationMetadata), + ), deployApplication: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deployApplicationResponse.decode.bind(deployApplicationResponse), - deployApplicationMetadata.decode.bind(deployApplicationMetadata)), + deployApplicationMetadata.decode.bind(deployApplicationMetadata), + ), undeployApplication: new this._gaxModule.LongrunningDescriptor( this.operationsClient, undeployApplicationResponse.decode.bind(undeployApplicationResponse), - undeployApplicationMetadata.decode.bind(undeployApplicationMetadata)), + undeployApplicationMetadata.decode.bind(undeployApplicationMetadata), + ), addApplicationStreamInput: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - addApplicationStreamInputResponse.decode.bind(addApplicationStreamInputResponse), - addApplicationStreamInputMetadata.decode.bind(addApplicationStreamInputMetadata)), + addApplicationStreamInputResponse.decode.bind( + addApplicationStreamInputResponse, + ), + addApplicationStreamInputMetadata.decode.bind( + addApplicationStreamInputMetadata, + ), + ), removeApplicationStreamInput: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - removeApplicationStreamInputResponse.decode.bind(removeApplicationStreamInputResponse), - removeApplicationStreamInputMetadata.decode.bind(removeApplicationStreamInputMetadata)), + removeApplicationStreamInputResponse.decode.bind( + removeApplicationStreamInputResponse, + ), + removeApplicationStreamInputMetadata.decode.bind( + removeApplicationStreamInputMetadata, + ), + ), updateApplicationStreamInput: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateApplicationStreamInputResponse.decode.bind(updateApplicationStreamInputResponse), - updateApplicationStreamInputMetadata.decode.bind(updateApplicationStreamInputMetadata)), + updateApplicationStreamInputResponse.decode.bind( + updateApplicationStreamInputResponse, + ), + updateApplicationStreamInputMetadata.decode.bind( + updateApplicationStreamInputMetadata, + ), + ), createApplicationInstances: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createApplicationInstancesResponse.decode.bind(createApplicationInstancesResponse), - createApplicationInstancesMetadata.decode.bind(createApplicationInstancesMetadata)), + createApplicationInstancesResponse.decode.bind( + createApplicationInstancesResponse, + ), + createApplicationInstancesMetadata.decode.bind( + createApplicationInstancesMetadata, + ), + ), deleteApplicationInstances: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteApplicationInstancesResponse.decode.bind(deleteApplicationInstancesResponse), - deleteApplicationInstancesMetadata.decode.bind(deleteApplicationInstancesMetadata)), + deleteApplicationInstancesResponse.decode.bind( + deleteApplicationInstancesResponse, + ), + deleteApplicationInstancesMetadata.decode.bind( + deleteApplicationInstancesMetadata, + ), + ), updateApplicationInstances: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateApplicationInstancesResponse.decode.bind(updateApplicationInstancesResponse), - updateApplicationInstancesMetadata.decode.bind(updateApplicationInstancesMetadata)), + updateApplicationInstancesResponse.decode.bind( + updateApplicationInstancesResponse, + ), + updateApplicationInstancesMetadata.decode.bind( + updateApplicationInstancesMetadata, + ), + ), createDraft: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createDraftResponse.decode.bind(createDraftResponse), - createDraftMetadata.decode.bind(createDraftMetadata)), + createDraftMetadata.decode.bind(createDraftMetadata), + ), updateDraft: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateDraftResponse.decode.bind(updateDraftResponse), - updateDraftMetadata.decode.bind(updateDraftMetadata)), + updateDraftMetadata.decode.bind(updateDraftMetadata), + ), deleteDraft: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteDraftResponse.decode.bind(deleteDraftResponse), - deleteDraftMetadata.decode.bind(deleteDraftMetadata)), + deleteDraftMetadata.decode.bind(deleteDraftMetadata), + ), createProcessor: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createProcessorResponse.decode.bind(createProcessorResponse), - createProcessorMetadata.decode.bind(createProcessorMetadata)), + createProcessorMetadata.decode.bind(createProcessorMetadata), + ), updateProcessor: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateProcessorResponse.decode.bind(updateProcessorResponse), - updateProcessorMetadata.decode.bind(updateProcessorMetadata)), + updateProcessorMetadata.decode.bind(updateProcessorMetadata), + ), deleteProcessor: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteProcessorResponse.decode.bind(deleteProcessorResponse), - deleteProcessorMetadata.decode.bind(deleteProcessorMetadata)) + deleteProcessorMetadata.decode.bind(deleteProcessorMetadata), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.visionai.v1.AppPlatform', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.visionai.v1.AppPlatform', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -460,28 +626,60 @@ export class AppPlatformClient { // Put together the "service stub" for // google.cloud.visionai.v1.AppPlatform. this.appPlatformStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.visionai.v1.AppPlatform') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.visionai.v1.AppPlatform', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.visionai.v1.AppPlatform, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const appPlatformStubMethods = - ['listApplications', 'getApplication', 'createApplication', 'updateApplication', 'deleteApplication', 'deployApplication', 'undeployApplication', 'addApplicationStreamInput', 'removeApplicationStreamInput', 'updateApplicationStreamInput', 'listInstances', 'getInstance', 'createApplicationInstances', 'deleteApplicationInstances', 'updateApplicationInstances', 'listDrafts', 'getDraft', 'createDraft', 'updateDraft', 'deleteDraft', 'listProcessors', 'listPrebuiltProcessors', 'getProcessor', 'createProcessor', 'updateProcessor', 'deleteProcessor']; + const appPlatformStubMethods = [ + 'listApplications', + 'getApplication', + 'createApplication', + 'updateApplication', + 'deleteApplication', + 'deployApplication', + 'undeployApplication', + 'addApplicationStreamInput', + 'removeApplicationStreamInput', + 'updateApplicationStreamInput', + 'listInstances', + 'getInstance', + 'createApplicationInstances', + 'deleteApplicationInstances', + 'updateApplicationInstances', + 'listDrafts', + 'getDraft', + 'createDraft', + 'updateDraft', + 'deleteDraft', + 'listProcessors', + 'listPrebuiltProcessors', + 'getProcessor', + 'createProcessor', + 'updateProcessor', + 'deleteProcessor', + ]; for (const methodName of appPlatformStubMethods) { const callPromise = this.appPlatformStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); const descriptor = this.descriptors.page[methodName] || @@ -491,7 +689,7 @@ export class AppPlatformClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -506,8 +704,14 @@ export class AppPlatformClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'warehouse-visionai.googleapis.com'; } @@ -518,8 +722,14 @@ export class AppPlatformClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'warehouse-visionai.googleapis.com'; } @@ -550,9 +760,7 @@ export class AppPlatformClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -561,8 +769,9 @@ export class AppPlatformClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -573,2714 +782,3986 @@ export class AppPlatformClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single Application. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @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 protos.google.cloud.visionai.v1.Application|Application}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.get_application.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_GetApplication_async - */ + /** + * Gets details of a single Application. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @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 protos.google.cloud.visionai.v1.Application|Application}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.get_application.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_GetApplication_async + */ getApplication( - request?: protos.google.cloud.visionai.v1.IGetApplicationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IApplication, - protos.google.cloud.visionai.v1.IGetApplicationRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetApplicationRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IGetApplicationRequest | undefined, + {} | undefined, + ] + >; getApplication( - request: protos.google.cloud.visionai.v1.IGetApplicationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IApplication, - protos.google.cloud.visionai.v1.IGetApplicationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetApplicationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IGetApplicationRequest | null | undefined, + {} | null | undefined + >, + ): void; getApplication( - request: protos.google.cloud.visionai.v1.IGetApplicationRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IApplication, - protos.google.cloud.visionai.v1.IGetApplicationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetApplicationRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IGetApplicationRequest | null | undefined, + {} | null | undefined + >, + ): void; getApplication( - request?: protos.google.cloud.visionai.v1.IGetApplicationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IApplication, - protos.google.cloud.visionai.v1.IGetApplicationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetApplicationRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IApplication, - protos.google.cloud.visionai.v1.IGetApplicationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IApplication, - protos.google.cloud.visionai.v1.IGetApplicationRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IGetApplicationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IGetApplicationRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IGetApplicationRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getApplication request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IApplication, - protos.google.cloud.visionai.v1.IGetApplicationRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IApplication, + | protos.google.cloud.visionai.v1.IGetApplicationRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getApplication response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getApplication(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IApplication, - protos.google.cloud.visionai.v1.IGetApplicationRequest|undefined, - {}|undefined - ]) => { - this._log.info('getApplication response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getApplication(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IGetApplicationRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getApplication response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single Instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @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 protos.google.cloud.visionai.v1.Instance|Instance}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.get_instance.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_GetInstance_async - */ + /** + * Gets details of a single Instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @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 protos.google.cloud.visionai.v1.Instance|Instance}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.get_instance.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_GetInstance_async + */ getInstance( - request?: protos.google.cloud.visionai.v1.IGetInstanceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IInstance, - protos.google.cloud.visionai.v1.IGetInstanceRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetInstanceRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IGetInstanceRequest | undefined, + {} | undefined, + ] + >; getInstance( - request: protos.google.cloud.visionai.v1.IGetInstanceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IInstance, - protos.google.cloud.visionai.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetInstanceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IGetInstanceRequest | null | undefined, + {} | null | undefined + >, + ): void; getInstance( - request: protos.google.cloud.visionai.v1.IGetInstanceRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IInstance, - protos.google.cloud.visionai.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetInstanceRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IGetInstanceRequest | null | undefined, + {} | null | undefined + >, + ): void; getInstance( - request?: protos.google.cloud.visionai.v1.IGetInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IInstance, - protos.google.cloud.visionai.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetInstanceRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IInstance, - protos.google.cloud.visionai.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IInstance, - protos.google.cloud.visionai.v1.IGetInstanceRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IGetInstanceRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IGetInstanceRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IGetInstanceRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getInstance request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IInstance, - protos.google.cloud.visionai.v1.IGetInstanceRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IInstance, + | protos.google.cloud.visionai.v1.IGetInstanceRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getInstance response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getInstance(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IInstance, - protos.google.cloud.visionai.v1.IGetInstanceRequest|undefined, - {}|undefined - ]) => { - this._log.info('getInstance response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getInstance(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IGetInstanceRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getInstance response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single Draft. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @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 protos.google.cloud.visionai.v1.Draft|Draft}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.get_draft.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_GetDraft_async - */ + /** + * Gets details of a single Draft. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @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 protos.google.cloud.visionai.v1.Draft|Draft}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.get_draft.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_GetDraft_async + */ getDraft( - request?: protos.google.cloud.visionai.v1.IGetDraftRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IDraft, - protos.google.cloud.visionai.v1.IGetDraftRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetDraftRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IGetDraftRequest | undefined, + {} | undefined, + ] + >; getDraft( - request: protos.google.cloud.visionai.v1.IGetDraftRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IDraft, - protos.google.cloud.visionai.v1.IGetDraftRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetDraftRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IGetDraftRequest | null | undefined, + {} | null | undefined + >, + ): void; getDraft( - request: protos.google.cloud.visionai.v1.IGetDraftRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IDraft, - protos.google.cloud.visionai.v1.IGetDraftRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetDraftRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IGetDraftRequest | null | undefined, + {} | null | undefined + >, + ): void; getDraft( - request?: protos.google.cloud.visionai.v1.IGetDraftRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IDraft, - protos.google.cloud.visionai.v1.IGetDraftRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetDraftRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IDraft, - protos.google.cloud.visionai.v1.IGetDraftRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IDraft, - protos.google.cloud.visionai.v1.IGetDraftRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.visionai.v1.IGetDraftRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IGetDraftRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IGetDraftRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getDraft request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IDraft, - protos.google.cloud.visionai.v1.IGetDraftRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IGetDraftRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getDraft response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getDraft(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IDraft, - protos.google.cloud.visionai.v1.IGetDraftRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDraft response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getDraft(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IGetDraftRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getDraft response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * ListPrebuiltProcessors is a custom pass-through verb that Lists Prebuilt - * Processors. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent path. - * @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 protos.google.cloud.visionai.v1.ListPrebuiltProcessorsResponse|ListPrebuiltProcessorsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.list_prebuilt_processors.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_ListPrebuiltProcessors_async - */ + /** + * ListPrebuiltProcessors is a custom pass-through verb that Lists Prebuilt + * Processors. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent path. + * @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 protos.google.cloud.visionai.v1.ListPrebuiltProcessorsResponse|ListPrebuiltProcessorsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.list_prebuilt_processors.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_ListPrebuiltProcessors_async + */ listPrebuiltProcessors( - request?: protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, + ( + | protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest + | undefined + ), + {} | undefined, + ] + >; listPrebuiltProcessors( - request: protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, + | protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listPrebuiltProcessors( - request: protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, + | protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listPrebuiltProcessors( - request?: protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, + | protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, + ( + | protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('listPrebuiltProcessors request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, + | protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('listPrebuiltProcessors response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.listPrebuiltProcessors(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, - protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest|undefined, - {}|undefined - ]) => { - this._log.info('listPrebuiltProcessors response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .listPrebuiltProcessors(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse, + ( + | protos.google.cloud.visionai.v1.IListPrebuiltProcessorsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listPrebuiltProcessors response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single Processor. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @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 protos.google.cloud.visionai.v1.Processor|Processor}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.get_processor.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_GetProcessor_async - */ + /** + * Gets details of a single Processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @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 protos.google.cloud.visionai.v1.Processor|Processor}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.get_processor.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_GetProcessor_async + */ getProcessor( - request?: protos.google.cloud.visionai.v1.IGetProcessorRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IProcessor, - protos.google.cloud.visionai.v1.IGetProcessorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetProcessorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IGetProcessorRequest | undefined, + {} | undefined, + ] + >; getProcessor( - request: protos.google.cloud.visionai.v1.IGetProcessorRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IProcessor, - protos.google.cloud.visionai.v1.IGetProcessorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetProcessorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IGetProcessorRequest | null | undefined, + {} | null | undefined + >, + ): void; getProcessor( - request: protos.google.cloud.visionai.v1.IGetProcessorRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IProcessor, - protos.google.cloud.visionai.v1.IGetProcessorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetProcessorRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IGetProcessorRequest | null | undefined, + {} | null | undefined + >, + ): void; getProcessor( - request?: protos.google.cloud.visionai.v1.IGetProcessorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IProcessor, - protos.google.cloud.visionai.v1.IGetProcessorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IProcessor, - protos.google.cloud.visionai.v1.IGetProcessorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IProcessor, - protos.google.cloud.visionai.v1.IGetProcessorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IGetProcessorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IGetProcessorRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IGetProcessorRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getProcessor request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IProcessor, - protos.google.cloud.visionai.v1.IGetProcessorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IProcessor, + | protos.google.cloud.visionai.v1.IGetProcessorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getProcessor response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getProcessor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IProcessor, - protos.google.cloud.visionai.v1.IGetProcessorRequest|undefined, - {}|undefined - ]) => { - this._log.info('getProcessor response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getProcessor(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IGetProcessorRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getProcessor response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new Application in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.applicationId - * Required. Id of the requesting object. - * @param {google.cloud.visionai.v1.Application} request.application - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.create_application.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateApplication_async - */ - createApplication( - request?: protos.google.cloud.visionai.v1.ICreateApplicationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createApplication( - request: protos.google.cloud.visionai.v1.ICreateApplicationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createApplication( - request: protos.google.cloud.visionai.v1.ICreateApplicationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createApplication( - request?: protos.google.cloud.visionai.v1.ICreateApplicationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; + /** + * Creates a new Application in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.applicationId + * Required. Id of the requesting object. + * @param {google.cloud.visionai.v1.Application} request.application + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.create_application.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateApplication_async + */ + createApplication( + request?: protos.google.cloud.visionai.v1.ICreateApplicationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + createApplication( + request: protos.google.cloud.visionai.v1.ICreateApplicationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createApplication( + request: protos.google.cloud.visionai.v1.ICreateApplicationRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createApplication( + request?: protos.google.cloud.visionai.v1.ICreateApplicationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createApplication response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createApplication request %j', request); - return this.innerApiCalls.createApplication(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createApplication response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createApplication(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createApplication response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createApplication()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.create_application.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateApplication_async - */ - async checkCreateApplicationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createApplication()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.create_application.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateApplication_async + */ + async checkCreateApplicationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Application, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('createApplication long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createApplication, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createApplication, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Application, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single Application. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * Application resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.visionai.v1.Application} request.application - * Required. The resource being updated. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.update_application.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateApplication_async - */ + /** + * Updates the parameters of a single Application. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * Application resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.visionai.v1.Application} request.application + * Required. The resource being updated. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.update_application.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateApplication_async + */ updateApplication( - request?: protos.google.cloud.visionai.v1.IUpdateApplicationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateApplicationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateApplication( - request: protos.google.cloud.visionai.v1.IUpdateApplicationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateApplicationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateApplication( - request: protos.google.cloud.visionai.v1.IUpdateApplicationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateApplicationRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateApplication( - request?: protos.google.cloud.visionai.v1.IUpdateApplicationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUpdateApplicationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'application.name': request.application!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'application.name': request.application!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateApplication response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateApplication request %j', request); - return this.innerApiCalls.updateApplication(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateApplication response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateApplication(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateApplication response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateApplication()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.update_application.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateApplication_async - */ - async checkUpdateApplicationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateApplication()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.update_application.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateApplication_async + */ + async checkUpdateApplicationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Application, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('updateApplication long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateApplication, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateApplication, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Application, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Deletes a single Application. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.force] - * Optional. If set to true, any instances and drafts from this application - * will also be deleted. (Otherwise, the request will only work if the - * application has no instances and drafts.) - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.delete_application.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteApplication_async - */ + /** + * Deletes a single Application. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.force] + * Optional. If set to true, any instances and drafts from this application + * will also be deleted. (Otherwise, the request will only work if the + * application has no instances and drafts.) + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.delete_application.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteApplication_async + */ deleteApplication( - request?: protos.google.cloud.visionai.v1.IDeleteApplicationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteApplicationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteApplication( - request: protos.google.cloud.visionai.v1.IDeleteApplicationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteApplicationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteApplication( - request: protos.google.cloud.visionai.v1.IDeleteApplicationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteApplicationRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteApplication( - request?: protos.google.cloud.visionai.v1.IDeleteApplicationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteApplicationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteApplication response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteApplication request %j', request); - return this.innerApiCalls.deleteApplication(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteApplication response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteApplication(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteApplication response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteApplication()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.delete_application.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteApplication_async - */ - async checkDeleteApplicationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteApplication()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.delete_application.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteApplication_async + */ + async checkDeleteApplicationProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('deleteApplication long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteApplication, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteApplication, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Deploys a single Application. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. the name of the application to retrieve. - * Format: - * "projects/{project}/locations/{location}/applications/{application}" - * @param {boolean} request.validateOnly - * If set, validate the request and preview the application graph, but do not - * actually deploy it. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.enableMonitoring] - * Optional. Whether or not to enable monitoring for the application on - * deployment. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.deploy_application.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeployApplication_async - */ + /** + * Deploys a single Application. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. the name of the application to retrieve. + * Format: + * "projects/{project}/locations/{location}/applications/{application}" + * @param {boolean} request.validateOnly + * If set, validate the request and preview the application graph, but do not + * actually deploy it. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.enableMonitoring] + * Optional. Whether or not to enable monitoring for the application on + * deployment. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.deploy_application.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeployApplication_async + */ deployApplication( - request?: protos.google.cloud.visionai.v1.IDeployApplicationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeployApplicationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IDeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deployApplication( - request: protos.google.cloud.visionai.v1.IDeployApplicationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeployApplicationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IDeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deployApplication( - request: protos.google.cloud.visionai.v1.IDeployApplicationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeployApplicationRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IDeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deployApplication( - request?: protos.google.cloud.visionai.v1.IDeployApplicationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeployApplicationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IDeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IDeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IDeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IDeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deployApplication response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deployApplication request %j', request); - return this.innerApiCalls.deployApplication(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deployApplication response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deployApplication(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IDeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deployApplication response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deployApplication()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.deploy_application.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeployApplication_async - */ - async checkDeployApplicationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deployApplication()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.deploy_application.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeployApplication_async + */ + async checkDeployApplicationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.DeployApplicationResponse, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('deployApplication long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deployApplication, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deployApplication, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.DeployApplicationResponse, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Undeploys a single Application. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. the name of the application to retrieve. - * Format: - * "projects/{project}/locations/{location}/applications/{application}" - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.undeploy_application.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_UndeployApplication_async - */ + /** + * Undeploys a single Application. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. the name of the application to retrieve. + * Format: + * "projects/{project}/locations/{location}/applications/{application}" + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.undeploy_application.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_UndeployApplication_async + */ undeployApplication( - request?: protos.google.cloud.visionai.v1.IUndeployApplicationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUndeployApplicationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IUndeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; undeployApplication( - request: protos.google.cloud.visionai.v1.IUndeployApplicationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUndeployApplicationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUndeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; undeployApplication( - request: protos.google.cloud.visionai.v1.IUndeployApplicationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUndeployApplicationRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUndeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; undeployApplication( - request?: protos.google.cloud.visionai.v1.IUndeployApplicationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUndeployApplicationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IUndeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUndeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IUndeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IUndeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('undeployApplication response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('undeployApplication request %j', request); - return this.innerApiCalls.undeployApplication(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('undeployApplication response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .undeployApplication(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IUndeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('undeployApplication response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `undeployApplication()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.undeploy_application.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_UndeployApplication_async - */ - async checkUndeployApplicationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `undeployApplication()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.undeploy_application.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_UndeployApplication_async + */ + async checkUndeployApplicationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.UndeployApplicationResponse, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('undeployApplication long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.undeployApplication, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.undeployApplication, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.UndeployApplicationResponse, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Adds target stream input to the Application. - * If the Application is deployed, the corresponding new Application instance - * will be created. If the stream has already been in the Application, the RPC - * will fail. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. the name of the application to retrieve. - * Format: - * "projects/{project}/locations/{location}/applications/{application}" - * @param {number[]} request.applicationStreamInputs - * The stream inputs to add, the stream resource name is the key of each - * StreamInput, and it must be unique within each application. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.add_application_stream_input.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_AddApplicationStreamInput_async - */ + /** + * Adds target stream input to the Application. + * If the Application is deployed, the corresponding new Application instance + * will be created. If the stream has already been in the Application, the RPC + * will fail. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. the name of the application to retrieve. + * Format: + * "projects/{project}/locations/{location}/applications/{application}" + * @param {number[]} request.applicationStreamInputs + * The stream inputs to add, the stream resource name is the key of each + * StreamInput, and it must be unique within each application. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.add_application_stream_input.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_AddApplicationStreamInput_async + */ addApplicationStreamInput( - request?: protos.google.cloud.visionai.v1.IAddApplicationStreamInputRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IAddApplicationStreamInputRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IAddApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; addApplicationStreamInput( - request: protos.google.cloud.visionai.v1.IAddApplicationStreamInputRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IAddApplicationStreamInputRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAddApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; addApplicationStreamInput( - request: protos.google.cloud.visionai.v1.IAddApplicationStreamInputRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IAddApplicationStreamInputRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAddApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; addApplicationStreamInput( - request?: protos.google.cloud.visionai.v1.IAddApplicationStreamInputRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IAddApplicationStreamInputRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IAddApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAddApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IAddApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IAddApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('addApplicationStreamInput response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('addApplicationStreamInput request %j', request); - return this.innerApiCalls.addApplicationStreamInput(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('addApplicationStreamInput response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .addApplicationStreamInput(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IAddApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('addApplicationStreamInput response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `addApplicationStreamInput()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.add_application_stream_input.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_AddApplicationStreamInput_async - */ - async checkAddApplicationStreamInputProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `addApplicationStreamInput()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.add_application_stream_input.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_AddApplicationStreamInput_async + */ + async checkAddApplicationStreamInputProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.AddApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('addApplicationStreamInput long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.addApplicationStreamInput, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.addApplicationStreamInput, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.AddApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Remove target stream input to the Application, if the Application is - * deployed, the corresponding instance based will be deleted. If the stream - * is not in the Application, the RPC will fail. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. the name of the application to retrieve. - * Format: - * "projects/{project}/locations/{location}/applications/{application}" - * @param {number[]} request.targetStreamInputs - * The target stream to remove. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.remove_application_stream_input.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_RemoveApplicationStreamInput_async - */ + /** + * Remove target stream input to the Application, if the Application is + * deployed, the corresponding instance based will be deleted. If the stream + * is not in the Application, the RPC will fail. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. the name of the application to retrieve. + * Format: + * "projects/{project}/locations/{location}/applications/{application}" + * @param {number[]} request.targetStreamInputs + * The target stream to remove. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.remove_application_stream_input.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_RemoveApplicationStreamInput_async + */ removeApplicationStreamInput( - request?: protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; removeApplicationStreamInput( - request: protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; removeApplicationStreamInput( - request: protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; removeApplicationStreamInput( - request?: protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('removeApplicationStreamInput response %j', rawResponse); + this._log.info( + 'removeApplicationStreamInput response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('removeApplicationStreamInput request %j', request); - return this.innerApiCalls.removeApplicationStreamInput(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('removeApplicationStreamInput response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .removeApplicationStreamInput(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'removeApplicationStreamInput response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `removeApplicationStreamInput()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.remove_application_stream_input.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_RemoveApplicationStreamInput_async - */ - async checkRemoveApplicationStreamInputProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `removeApplicationStreamInput()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.remove_application_stream_input.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_RemoveApplicationStreamInput_async + */ + async checkRemoveApplicationStreamInputProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.RemoveApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('removeApplicationStreamInput long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.removeApplicationStreamInput, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.removeApplicationStreamInput, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.RemoveApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Update target stream input to the Application, if the Application is - * deployed, the corresponding instance based will be deployed. For - * CreateOrUpdate behavior, set allow_missing to true. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. the name of the application to retrieve. - * Format: - * "projects/{project}/locations/{location}/applications/{application}" - * @param {number[]} request.applicationStreamInputs - * The stream inputs to update, the stream resource name is the key of each - * StreamInput, and it must be unique within each application. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} request.allowMissing - * If true, UpdateApplicationStreamInput will insert stream input to - * application even if the target stream is not included in the application. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.update_application_stream_input.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateApplicationStreamInput_async - */ + /** + * Update target stream input to the Application, if the Application is + * deployed, the corresponding instance based will be deployed. For + * CreateOrUpdate behavior, set allow_missing to true. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. the name of the application to retrieve. + * Format: + * "projects/{project}/locations/{location}/applications/{application}" + * @param {number[]} request.applicationStreamInputs + * The stream inputs to update, the stream resource name is the key of each + * StreamInput, and it must be unique within each application. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} request.allowMissing + * If true, UpdateApplicationStreamInput will insert stream input to + * application even if the target stream is not included in the application. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.update_application_stream_input.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateApplicationStreamInput_async + */ updateApplicationStreamInput( - request?: protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateApplicationStreamInput( - request: protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateApplicationStreamInput( - request: protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateApplicationStreamInput( - request?: protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateApplicationStreamInput response %j', rawResponse); + this._log.info( + 'updateApplicationStreamInput response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateApplicationStreamInput request %j', request); - return this.innerApiCalls.updateApplicationStreamInput(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateApplicationStreamInput response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateApplicationStreamInput(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateApplicationStreamInput response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateApplicationStreamInput()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.update_application_stream_input.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateApplicationStreamInput_async - */ - async checkUpdateApplicationStreamInputProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateApplicationStreamInput()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.update_application_stream_input.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateApplicationStreamInput_async + */ + async checkUpdateApplicationStreamInputProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.UpdateApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('updateApplicationStreamInput long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateApplicationStreamInput, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateApplicationStreamInput, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.UpdateApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Adds target stream input to the Application. - * If the Application is deployed, the corresponding new Application instance - * will be created. If the stream has already been in the Application, the RPC - * will fail. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. the name of the application to retrieve. - * Format: - * "projects/{project}/locations/{location}/applications/{application}" - * @param {number[]} request.applicationInstances - * Required. The resources being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.create_application_instances.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateApplicationInstances_async - */ + /** + * Adds target stream input to the Application. + * If the Application is deployed, the corresponding new Application instance + * will be created. If the stream has already been in the Application, the RPC + * will fail. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. the name of the application to retrieve. + * Format: + * "projects/{project}/locations/{location}/applications/{application}" + * @param {number[]} request.applicationInstances + * Required. The resources being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.create_application_instances.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateApplicationInstances_async + */ createApplicationInstances( - request?: protos.google.cloud.visionai.v1.ICreateApplicationInstancesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateApplicationInstancesRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.ICreateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createApplicationInstances( - request: protos.google.cloud.visionai.v1.ICreateApplicationInstancesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateApplicationInstancesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICreateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createApplicationInstances( - request: protos.google.cloud.visionai.v1.ICreateApplicationInstancesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateApplicationInstancesRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICreateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createApplicationInstances( - request?: protos.google.cloud.visionai.v1.ICreateApplicationInstancesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.ICreateApplicationInstancesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.ICreateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICreateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.ICreateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.ICreateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createApplicationInstances response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createApplicationInstances request %j', request); - return this.innerApiCalls.createApplicationInstances(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createApplicationInstances response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createApplicationInstances(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.ICreateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createApplicationInstances response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createApplicationInstances()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.create_application_instances.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateApplicationInstances_async - */ - async checkCreateApplicationInstancesProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createApplicationInstances()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.create_application_instances.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateApplicationInstances_async + */ + async checkCreateApplicationInstancesProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.CreateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('createApplicationInstances long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createApplicationInstances, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createApplicationInstances, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.CreateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Remove target stream input to the Application, if the Application is - * deployed, the corresponding instance based will be deleted. If the stream - * is not in the Application, the RPC will fail. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. the name of the application to retrieve. - * Format: - * "projects/{project}/locations/{location}/applications/{application}" - * @param {string[]} request.instanceIds - * Required. Id of the requesting object. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.delete_application_instances.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteApplicationInstances_async - */ + /** + * Remove target stream input to the Application, if the Application is + * deployed, the corresponding instance based will be deleted. If the stream + * is not in the Application, the RPC will fail. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. the name of the application to retrieve. + * Format: + * "projects/{project}/locations/{location}/applications/{application}" + * @param {string[]} request.instanceIds + * Required. Id of the requesting object. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.delete_application_instances.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteApplicationInstances_async + */ deleteApplicationInstances( - request?: protos.google.cloud.visionai.v1.IDeleteApplicationInstancesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteApplicationInstancesRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteApplicationInstances( - request: protos.google.cloud.visionai.v1.IDeleteApplicationInstancesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteApplicationInstancesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteApplicationInstances( - request: protos.google.cloud.visionai.v1.IDeleteApplicationInstancesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteApplicationInstancesRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteApplicationInstances( - request?: protos.google.cloud.visionai.v1.IDeleteApplicationInstancesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteApplicationInstancesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteApplicationInstances response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteApplicationInstances request %j', request); - return this.innerApiCalls.deleteApplicationInstances(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteApplicationInstances response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteApplicationInstances(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteApplicationInstances response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteApplicationInstances()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.delete_application_instances.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteApplicationInstances_async - */ - async checkDeleteApplicationInstancesProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteApplicationInstances()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.delete_application_instances.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteApplicationInstances_async + */ + async checkDeleteApplicationInstancesProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Instance, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('deleteApplicationInstances long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteApplicationInstances, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteApplicationInstances, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Instance, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Adds target stream input to the Application. - * If the Application is deployed, the corresponding new Application instance - * will be created. If the stream has already been in the Application, the RPC - * will fail. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. the name of the application to retrieve. - * Format: - * "projects/{project}/locations/{location}/applications/{application}" - * @param {number[]} request.applicationInstances - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} request.allowMissing - * If true, Update Request will create one resource if the target resource - * doesn't exist, this time, the field_mask will be ignored. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.update_application_instances.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateApplicationInstances_async - */ + /** + * Adds target stream input to the Application. + * If the Application is deployed, the corresponding new Application instance + * will be created. If the stream has already been in the Application, the RPC + * will fail. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. the name of the application to retrieve. + * Format: + * "projects/{project}/locations/{location}/applications/{application}" + * @param {number[]} request.applicationInstances + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} request.allowMissing + * If true, Update Request will create one resource if the target resource + * doesn't exist, this time, the field_mask will be ignored. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.update_application_instances.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateApplicationInstances_async + */ updateApplicationInstances( - request?: protos.google.cloud.visionai.v1.IUpdateApplicationInstancesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateApplicationInstancesRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateApplicationInstances( - request: protos.google.cloud.visionai.v1.IUpdateApplicationInstancesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateApplicationInstancesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateApplicationInstances( - request: protos.google.cloud.visionai.v1.IUpdateApplicationInstancesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateApplicationInstancesRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateApplicationInstances( - request?: protos.google.cloud.visionai.v1.IUpdateApplicationInstancesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUpdateApplicationInstancesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateApplicationInstances response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateApplicationInstances request %j', request); - return this.innerApiCalls.updateApplicationInstances(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateApplicationInstances response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateApplicationInstances(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateApplicationInstances response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateApplicationInstances()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.update_application_instances.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateApplicationInstances_async - */ - async checkUpdateApplicationInstancesProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateApplicationInstances()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.update_application_instances.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateApplicationInstances_async + */ + async checkUpdateApplicationInstancesProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.UpdateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('updateApplicationInstances long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateApplicationInstances, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateApplicationInstances, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.UpdateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Creates a new Draft in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.draftId - * Required. Id of the requesting object. - * @param {google.cloud.visionai.v1.Draft} request.draft - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.create_draft.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateDraft_async - */ + /** + * Creates a new Draft in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.draftId + * Required. Id of the requesting object. + * @param {google.cloud.visionai.v1.Draft} request.draft + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.create_draft.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateDraft_async + */ createDraft( - request?: protos.google.cloud.visionai.v1.ICreateDraftRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateDraftRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createDraft( - request: protos.google.cloud.visionai.v1.ICreateDraftRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateDraftRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createDraft( - request: protos.google.cloud.visionai.v1.ICreateDraftRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateDraftRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createDraft( - request?: protos.google.cloud.visionai.v1.ICreateDraftRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.ICreateDraftRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createDraft response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createDraft request %j', request); - return this.innerApiCalls.createDraft(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createDraft response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createDraft(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createDraft response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createDraft()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.create_draft.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateDraft_async - */ - async checkCreateDraftProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createDraft()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.create_draft.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateDraft_async + */ + async checkCreateDraftProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Draft, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('createDraft long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createDraft, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createDraft, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Draft, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single Draft. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * Draft resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.visionai.v1.Draft} request.draft - * Required. The resource being updated. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} request.allowMissing - * If true, UpdateDraftRequest will create one resource if the target resource - * doesn't exist, this time, the field_mask will be ignored. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.update_draft.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateDraft_async - */ + /** + * Updates the parameters of a single Draft. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * Draft resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.visionai.v1.Draft} request.draft + * Required. The resource being updated. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} request.allowMissing + * If true, UpdateDraftRequest will create one resource if the target resource + * doesn't exist, this time, the field_mask will be ignored. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.update_draft.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateDraft_async + */ updateDraft( - request?: protos.google.cloud.visionai.v1.IUpdateDraftRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateDraftRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateDraft( - request: protos.google.cloud.visionai.v1.IUpdateDraftRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateDraftRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateDraft( - request: protos.google.cloud.visionai.v1.IUpdateDraftRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateDraftRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateDraft( - request?: protos.google.cloud.visionai.v1.IUpdateDraftRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUpdateDraftRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'draft.name': request.draft!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'draft.name': request.draft!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateDraft response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateDraft request %j', request); - return this.innerApiCalls.updateDraft(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateDraft response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateDraft(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateDraft response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateDraft()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.update_draft.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateDraft_async - */ - async checkUpdateDraftProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateDraft()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.update_draft.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateDraft_async + */ + async checkUpdateDraftProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Draft, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('updateDraft long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDraft, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateDraft, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Draft, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Deletes a single Draft. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.delete_draft.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteDraft_async - */ + /** + * Deletes a single Draft. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.delete_draft.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteDraft_async + */ deleteDraft( - request?: protos.google.cloud.visionai.v1.IDeleteDraftRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteDraftRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteDraft( - request: protos.google.cloud.visionai.v1.IDeleteDraftRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteDraftRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteDraft( - request: protos.google.cloud.visionai.v1.IDeleteDraftRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteDraftRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteDraft( - request?: protos.google.cloud.visionai.v1.IDeleteDraftRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteDraftRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteDraft response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteDraft request %j', request); - return this.innerApiCalls.deleteDraft(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteDraft response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteDraft(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteDraft response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteDraft()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.delete_draft.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteDraft_async - */ - async checkDeleteDraftProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteDraft()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.delete_draft.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteDraft_async + */ + async checkDeleteDraftProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('deleteDraft long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteDraft, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteDraft, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Creates a new Processor in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.processorId - * Required. Id of the requesting object. - * @param {google.cloud.visionai.v1.Processor} request.processor - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.create_processor.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateProcessor_async - */ + /** + * Creates a new Processor in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.processorId + * Required. Id of the requesting object. + * @param {google.cloud.visionai.v1.Processor} request.processor + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.create_processor.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateProcessor_async + */ createProcessor( - request?: protos.google.cloud.visionai.v1.ICreateProcessorRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateProcessorRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createProcessor( - request: protos.google.cloud.visionai.v1.ICreateProcessorRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateProcessorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createProcessor( - request: protos.google.cloud.visionai.v1.ICreateProcessorRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateProcessorRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createProcessor( - request?: protos.google.cloud.visionai.v1.ICreateProcessorRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.ICreateProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createProcessor response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createProcessor request %j', request); - return this.innerApiCalls.createProcessor(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createProcessor response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createProcessor(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createProcessor response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createProcessor()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.create_processor.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateProcessor_async - */ - async checkCreateProcessorProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createProcessor()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.create_processor.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_CreateProcessor_async + */ + async checkCreateProcessorProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Processor, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('createProcessor long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createProcessor, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createProcessor, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Processor, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single Processor. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * Processor resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.visionai.v1.Processor} request.processor - * Required. The resource being updated. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.update_processor.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateProcessor_async - */ + /** + * Updates the parameters of a single Processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * Processor resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.visionai.v1.Processor} request.processor + * Required. The resource being updated. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.update_processor.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateProcessor_async + */ updateProcessor( - request?: protos.google.cloud.visionai.v1.IUpdateProcessorRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateProcessorRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateProcessor( - request: protos.google.cloud.visionai.v1.IUpdateProcessorRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateProcessorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateProcessor( - request: protos.google.cloud.visionai.v1.IUpdateProcessorRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateProcessorRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateProcessor( - request?: protos.google.cloud.visionai.v1.IUpdateProcessorRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUpdateProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'processor.name': request.processor!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'processor.name': request.processor!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateProcessor response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateProcessor request %j', request); - return this.innerApiCalls.updateProcessor(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateProcessor response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateProcessor(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateProcessor response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateProcessor()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.update_processor.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateProcessor_async - */ - async checkUpdateProcessorProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateProcessor()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.update_processor.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_UpdateProcessor_async + */ + async checkUpdateProcessorProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Processor, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('updateProcessor long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateProcessor, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateProcessor, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Processor, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Deletes a single Processor. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.delete_processor.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteProcessor_async - */ + /** + * Deletes a single Processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.delete_processor.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteProcessor_async + */ deleteProcessor( - request?: protos.google.cloud.visionai.v1.IDeleteProcessorRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteProcessorRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteProcessor( - request: protos.google.cloud.visionai.v1.IDeleteProcessorRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteProcessorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteProcessor( - request: protos.google.cloud.visionai.v1.IDeleteProcessorRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteProcessorRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteProcessor( - request?: protos.google.cloud.visionai.v1.IDeleteProcessorRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteProcessor response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteProcessor request %j', request); - return this.innerApiCalls.deleteProcessor(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteProcessor response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteProcessor(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteProcessor response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteProcessor()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.delete_processor.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteProcessor_async - */ - async checkDeleteProcessorProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteProcessor()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.delete_processor.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_DeleteProcessor_async + */ + async checkDeleteProcessorProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('deleteProcessor long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteProcessor, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Applications in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListApplicationsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @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 Array of {@link protos.google.cloud.visionai.v1.Application|Application}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listApplicationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteProcessor, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + >; + } + /** + * Lists Applications in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListApplicationsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @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 Array of {@link protos.google.cloud.visionai.v1.Application|Application}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listApplicationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listApplications( - request?: protos.google.cloud.visionai.v1.IListApplicationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IApplication[], - protos.google.cloud.visionai.v1.IListApplicationsRequest|null, - protos.google.cloud.visionai.v1.IListApplicationsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListApplicationsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IApplication[], + protos.google.cloud.visionai.v1.IListApplicationsRequest | null, + protos.google.cloud.visionai.v1.IListApplicationsResponse, + ] + >; listApplications( - request: protos.google.cloud.visionai.v1.IListApplicationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListApplicationsRequest, - protos.google.cloud.visionai.v1.IListApplicationsResponse|null|undefined, - protos.google.cloud.visionai.v1.IApplication>): void; + request: protos.google.cloud.visionai.v1.IListApplicationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListApplicationsRequest, + | protos.google.cloud.visionai.v1.IListApplicationsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IApplication + >, + ): void; listApplications( - request: protos.google.cloud.visionai.v1.IListApplicationsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListApplicationsRequest, - protos.google.cloud.visionai.v1.IListApplicationsResponse|null|undefined, - protos.google.cloud.visionai.v1.IApplication>): void; + request: protos.google.cloud.visionai.v1.IListApplicationsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListApplicationsRequest, + | protos.google.cloud.visionai.v1.IListApplicationsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IApplication + >, + ): void; listApplications( - request?: protos.google.cloud.visionai.v1.IListApplicationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListApplicationsRequest, - protos.google.cloud.visionai.v1.IListApplicationsResponse|null|undefined, - protos.google.cloud.visionai.v1.IApplication>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListApplicationsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListApplicationsRequest, - protos.google.cloud.visionai.v1.IListApplicationsResponse|null|undefined, - protos.google.cloud.visionai.v1.IApplication>): - Promise<[ - protos.google.cloud.visionai.v1.IApplication[], - protos.google.cloud.visionai.v1.IListApplicationsRequest|null, - protos.google.cloud.visionai.v1.IListApplicationsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListApplicationsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IApplication + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListApplicationsRequest, + | protos.google.cloud.visionai.v1.IListApplicationsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IApplication + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IApplication[], + protos.google.cloud.visionai.v1.IListApplicationsRequest | null, + protos.google.cloud.visionai.v1.IListApplicationsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListApplicationsRequest, - protos.google.cloud.visionai.v1.IListApplicationsResponse|null|undefined, - protos.google.cloud.visionai.v1.IApplication>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListApplicationsRequest, + | protos.google.cloud.visionai.v1.IListApplicationsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IApplication + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listApplications values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -3289,204 +4770,227 @@ export class AppPlatformClient { this._log.info('listApplications request %j', request); return this.innerApiCalls .listApplications(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IApplication[], - protos.google.cloud.visionai.v1.IListApplicationsRequest|null, - protos.google.cloud.visionai.v1.IListApplicationsResponse - ]) => { - this._log.info('listApplications values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IApplication[], + protos.google.cloud.visionai.v1.IListApplicationsRequest | null, + protos.google.cloud.visionai.v1.IListApplicationsResponse, + ]) => { + this._log.info('listApplications values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listApplications`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListApplicationsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Application|Application} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listApplicationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listApplications`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListApplicationsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Application|Application} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listApplicationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listApplicationsStream( - request?: protos.google.cloud.visionai.v1.IListApplicationsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListApplicationsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listApplications']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listApplications stream %j', request); return this.descriptors.page.listApplications.createStream( this.innerApiCalls.listApplications as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listApplications`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListApplicationsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Application|Application}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.list_applications.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_ListApplications_async - */ + /** + * Equivalent to `listApplications`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListApplicationsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Application|Application}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.list_applications.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_ListApplications_async + */ listApplicationsAsync( - request?: protos.google.cloud.visionai.v1.IListApplicationsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListApplicationsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listApplications']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listApplications iterate %j', request); return this.descriptors.page.listApplications.asyncIterate( this.innerApiCalls['listApplications'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Instances in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListInstancesRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @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 Array of {@link protos.google.cloud.visionai.v1.Instance|Instance}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listInstancesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Instances in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListInstancesRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @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 Array of {@link protos.google.cloud.visionai.v1.Instance|Instance}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listInstancesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listInstances( - request?: protos.google.cloud.visionai.v1.IListInstancesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IInstance[], - protos.google.cloud.visionai.v1.IListInstancesRequest|null, - protos.google.cloud.visionai.v1.IListInstancesResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListInstancesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IInstance[], + protos.google.cloud.visionai.v1.IListInstancesRequest | null, + protos.google.cloud.visionai.v1.IListInstancesResponse, + ] + >; listInstances( - request: protos.google.cloud.visionai.v1.IListInstancesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListInstancesRequest, - protos.google.cloud.visionai.v1.IListInstancesResponse|null|undefined, - protos.google.cloud.visionai.v1.IInstance>): void; + request: protos.google.cloud.visionai.v1.IListInstancesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListInstancesRequest, + protos.google.cloud.visionai.v1.IListInstancesResponse | null | undefined, + protos.google.cloud.visionai.v1.IInstance + >, + ): void; listInstances( - request: protos.google.cloud.visionai.v1.IListInstancesRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListInstancesRequest, - protos.google.cloud.visionai.v1.IListInstancesResponse|null|undefined, - protos.google.cloud.visionai.v1.IInstance>): void; + request: protos.google.cloud.visionai.v1.IListInstancesRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListInstancesRequest, + protos.google.cloud.visionai.v1.IListInstancesResponse | null | undefined, + protos.google.cloud.visionai.v1.IInstance + >, + ): void; listInstances( - request?: protos.google.cloud.visionai.v1.IListInstancesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListInstancesRequest, - protos.google.cloud.visionai.v1.IListInstancesResponse|null|undefined, - protos.google.cloud.visionai.v1.IInstance>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListInstancesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListInstancesRequest, - protos.google.cloud.visionai.v1.IListInstancesResponse|null|undefined, - protos.google.cloud.visionai.v1.IInstance>): - Promise<[ - protos.google.cloud.visionai.v1.IInstance[], - protos.google.cloud.visionai.v1.IListInstancesRequest|null, - protos.google.cloud.visionai.v1.IListInstancesResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListInstancesResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IInstance + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListInstancesRequest, + protos.google.cloud.visionai.v1.IListInstancesResponse | null | undefined, + protos.google.cloud.visionai.v1.IInstance + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IInstance[], + protos.google.cloud.visionai.v1.IListInstancesRequest | null, + protos.google.cloud.visionai.v1.IListInstancesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListInstancesRequest, - protos.google.cloud.visionai.v1.IListInstancesResponse|null|undefined, - protos.google.cloud.visionai.v1.IInstance>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListInstancesRequest, + | protos.google.cloud.visionai.v1.IListInstancesResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IInstance + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listInstances values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -3495,204 +4999,227 @@ export class AppPlatformClient { this._log.info('listInstances request %j', request); return this.innerApiCalls .listInstances(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IInstance[], - protos.google.cloud.visionai.v1.IListInstancesRequest|null, - protos.google.cloud.visionai.v1.IListInstancesResponse - ]) => { - this._log.info('listInstances values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IInstance[], + protos.google.cloud.visionai.v1.IListInstancesRequest | null, + protos.google.cloud.visionai.v1.IListInstancesResponse, + ]) => { + this._log.info('listInstances values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listInstances`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListInstancesRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Instance|Instance} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listInstancesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listInstances`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListInstancesRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Instance|Instance} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listInstancesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listInstancesStream( - request?: protos.google.cloud.visionai.v1.IListInstancesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListInstancesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listInstances']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInstances stream %j', request); return this.descriptors.page.listInstances.createStream( this.innerApiCalls.listInstances as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listInstances`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListInstancesRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Instance|Instance}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.list_instances.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_ListInstances_async - */ + /** + * Equivalent to `listInstances`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListInstancesRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Instance|Instance}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.list_instances.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_ListInstances_async + */ listInstancesAsync( - request?: protos.google.cloud.visionai.v1.IListInstancesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListInstancesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listInstances']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listInstances iterate %j', request); return this.descriptors.page.listInstances.asyncIterate( this.innerApiCalls['listInstances'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Drafts in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListDraftsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @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 Array of {@link protos.google.cloud.visionai.v1.Draft|Draft}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listDraftsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Drafts in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListDraftsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @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 Array of {@link protos.google.cloud.visionai.v1.Draft|Draft}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listDraftsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listDrafts( - request?: protos.google.cloud.visionai.v1.IListDraftsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IDraft[], - protos.google.cloud.visionai.v1.IListDraftsRequest|null, - protos.google.cloud.visionai.v1.IListDraftsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListDraftsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IDraft[], + protos.google.cloud.visionai.v1.IListDraftsRequest | null, + protos.google.cloud.visionai.v1.IListDraftsResponse, + ] + >; listDrafts( - request: protos.google.cloud.visionai.v1.IListDraftsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListDraftsRequest, - protos.google.cloud.visionai.v1.IListDraftsResponse|null|undefined, - protos.google.cloud.visionai.v1.IDraft>): void; + request: protos.google.cloud.visionai.v1.IListDraftsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListDraftsRequest, + protos.google.cloud.visionai.v1.IListDraftsResponse | null | undefined, + protos.google.cloud.visionai.v1.IDraft + >, + ): void; listDrafts( - request: protos.google.cloud.visionai.v1.IListDraftsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListDraftsRequest, - protos.google.cloud.visionai.v1.IListDraftsResponse|null|undefined, - protos.google.cloud.visionai.v1.IDraft>): void; + request: protos.google.cloud.visionai.v1.IListDraftsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListDraftsRequest, + protos.google.cloud.visionai.v1.IListDraftsResponse | null | undefined, + protos.google.cloud.visionai.v1.IDraft + >, + ): void; listDrafts( - request?: protos.google.cloud.visionai.v1.IListDraftsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListDraftsRequest, - protos.google.cloud.visionai.v1.IListDraftsResponse|null|undefined, - protos.google.cloud.visionai.v1.IDraft>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListDraftsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListDraftsRequest, - protos.google.cloud.visionai.v1.IListDraftsResponse|null|undefined, - protos.google.cloud.visionai.v1.IDraft>): - Promise<[ - protos.google.cloud.visionai.v1.IDraft[], - protos.google.cloud.visionai.v1.IListDraftsRequest|null, - protos.google.cloud.visionai.v1.IListDraftsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListDraftsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IDraft + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListDraftsRequest, + protos.google.cloud.visionai.v1.IListDraftsResponse | null | undefined, + protos.google.cloud.visionai.v1.IDraft + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IDraft[], + protos.google.cloud.visionai.v1.IListDraftsRequest | null, + protos.google.cloud.visionai.v1.IListDraftsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListDraftsRequest, - protos.google.cloud.visionai.v1.IListDraftsResponse|null|undefined, - protos.google.cloud.visionai.v1.IDraft>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListDraftsRequest, + | protos.google.cloud.visionai.v1.IListDraftsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IDraft + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listDrafts values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -3701,204 +5228,233 @@ export class AppPlatformClient { this._log.info('listDrafts request %j', request); return this.innerApiCalls .listDrafts(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IDraft[], - protos.google.cloud.visionai.v1.IListDraftsRequest|null, - protos.google.cloud.visionai.v1.IListDraftsResponse - ]) => { - this._log.info('listDrafts values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IDraft[], + protos.google.cloud.visionai.v1.IListDraftsRequest | null, + protos.google.cloud.visionai.v1.IListDraftsResponse, + ]) => { + this._log.info('listDrafts values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listDrafts`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListDraftsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Draft|Draft} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listDraftsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listDrafts`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListDraftsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Draft|Draft} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listDraftsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listDraftsStream( - request?: protos.google.cloud.visionai.v1.IListDraftsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListDraftsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDrafts']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDrafts stream %j', request); return this.descriptors.page.listDrafts.createStream( this.innerApiCalls.listDrafts as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listDrafts`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListDraftsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Draft|Draft}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.list_drafts.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_ListDrafts_async - */ + /** + * Equivalent to `listDrafts`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListDraftsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Draft|Draft}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.list_drafts.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_ListDrafts_async + */ listDraftsAsync( - request?: protos.google.cloud.visionai.v1.IListDraftsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListDraftsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDrafts']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDrafts iterate %j', request); return this.descriptors.page.listDrafts.asyncIterate( this.innerApiCalls['listDrafts'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Processors in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListProcessorsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @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 Array of {@link protos.google.cloud.visionai.v1.Processor|Processor}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listProcessorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Processors in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListProcessorsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @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 Array of {@link protos.google.cloud.visionai.v1.Processor|Processor}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listProcessorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listProcessors( - request?: protos.google.cloud.visionai.v1.IListProcessorsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IProcessor[], - protos.google.cloud.visionai.v1.IListProcessorsRequest|null, - protos.google.cloud.visionai.v1.IListProcessorsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListProcessorsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IProcessor[], + protos.google.cloud.visionai.v1.IListProcessorsRequest | null, + protos.google.cloud.visionai.v1.IListProcessorsResponse, + ] + >; listProcessors( - request: protos.google.cloud.visionai.v1.IListProcessorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListProcessorsRequest, - protos.google.cloud.visionai.v1.IListProcessorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IProcessor>): void; + request: protos.google.cloud.visionai.v1.IListProcessorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListProcessorsRequest, + | protos.google.cloud.visionai.v1.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IProcessor + >, + ): void; listProcessors( - request: protos.google.cloud.visionai.v1.IListProcessorsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListProcessorsRequest, - protos.google.cloud.visionai.v1.IListProcessorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IProcessor>): void; + request: protos.google.cloud.visionai.v1.IListProcessorsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListProcessorsRequest, + | protos.google.cloud.visionai.v1.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IProcessor + >, + ): void; listProcessors( - request?: protos.google.cloud.visionai.v1.IListProcessorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListProcessorsRequest, - protos.google.cloud.visionai.v1.IListProcessorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IProcessor>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListProcessorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListProcessorsRequest, - protos.google.cloud.visionai.v1.IListProcessorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IProcessor>): - Promise<[ - protos.google.cloud.visionai.v1.IProcessor[], - protos.google.cloud.visionai.v1.IListProcessorsRequest|null, - protos.google.cloud.visionai.v1.IListProcessorsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IProcessor + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListProcessorsRequest, + | protos.google.cloud.visionai.v1.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IProcessor + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IProcessor[], + protos.google.cloud.visionai.v1.IListProcessorsRequest | null, + protos.google.cloud.visionai.v1.IListProcessorsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListProcessorsRequest, - protos.google.cloud.visionai.v1.IListProcessorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IProcessor>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListProcessorsRequest, + | protos.google.cloud.visionai.v1.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IProcessor + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listProcessors values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -3907,143 +5463,147 @@ export class AppPlatformClient { this._log.info('listProcessors request %j', request); return this.innerApiCalls .listProcessors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IProcessor[], - protos.google.cloud.visionai.v1.IListProcessorsRequest|null, - protos.google.cloud.visionai.v1.IListProcessorsResponse - ]) => { - this._log.info('listProcessors values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IProcessor[], + protos.google.cloud.visionai.v1.IListProcessorsRequest | null, + protos.google.cloud.visionai.v1.IListProcessorsResponse, + ]) => { + this._log.info('listProcessors values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listProcessors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListProcessorsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Processor|Processor} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listProcessorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listProcessors`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListProcessorsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Processor|Processor} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listProcessorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listProcessorsStream( - request?: protos.google.cloud.visionai.v1.IListProcessorsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListProcessorsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listProcessors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listProcessors stream %j', request); return this.descriptors.page.listProcessors.createStream( this.innerApiCalls.listProcessors as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listProcessors`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListProcessorsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Processor|Processor}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/app_platform.list_processors.js - * region_tag:warehouse-visionai_v1_generated_AppPlatform_ListProcessors_async - */ + /** + * Equivalent to `listProcessors`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListProcessorsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Processor|Processor}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/app_platform.list_processors.js + * region_tag:warehouse-visionai_v1_generated_AppPlatform_ListProcessors_async + */ listProcessorsAsync( - request?: protos.google.cloud.visionai.v1.IListProcessorsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListProcessorsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listProcessors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listProcessors iterate %j', request); return this.descriptors.page.listProcessors.asyncIterate( this.innerApiCalls['listProcessors'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + /** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getIamPolicy( request: IamProtos.google.iam.v1.GetIamPolicyRequest, options?: @@ -4057,40 +5617,40 @@ export class AppPlatformClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.getIamPolicy(request, options, callback); } -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ setIamPolicy( request: IamProtos.google.iam.v1.SetIamPolicyRequest, options?: @@ -4104,41 +5664,41 @@ export class AppPlatformClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.setIamPolicy(request, options, callback); } -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ testIamPermissions( request: IamProtos.google.iam.v1.TestIamPermissionsRequest, options?: @@ -4152,12 +5712,12 @@ export class AppPlatformClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -4192,12 +5752,11 @@ export class AppPlatformClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -4230,12 +5789,12 @@ export class AppPlatformClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } -/** + /** * Gets the latest state of a long-running operation. Clients can use this * method to poll the operation result at intervals as recommended by the API * service. @@ -4278,22 +5837,22 @@ export class AppPlatformClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -4328,15 +5887,15 @@ export class AppPlatformClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -4370,7 +5929,7 @@ export class AppPlatformClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -4383,25 +5942,24 @@ export class AppPlatformClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.cancelOperation(request, options, callback); } - /** * Deletes a long-running operation. This method indicates that the client is * no longer interested in the operation result. It does not cancel the @@ -4440,22 +5998,22 @@ export class AppPlatformClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -4472,7 +6030,12 @@ export class AppPlatformClient { * @param {string} analysis * @returns {string} Resource name string. */ - analysisPath(project:string,location:string,cluster:string,analysis:string) { + analysisPath( + project: string, + location: string, + cluster: string, + analysis: string, + ) { return this.pathTemplates.analysisPathTemplate.render({ project: project, location: location, @@ -4535,7 +6098,13 @@ export class AppPlatformClient { * @param {string} annotation * @returns {string} Resource name string. */ - annotationPath(projectNumber:string,location:string,corpus:string,asset:string,annotation:string) { + annotationPath( + projectNumber: string, + location: string, + corpus: string, + asset: string, + annotation: string, + ) { return this.pathTemplates.annotationPathTemplate.render({ project_number: projectNumber, location: location, @@ -4553,7 +6122,8 @@ export class AppPlatformClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).project_number; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .project_number; } /** @@ -4564,7 +6134,8 @@ export class AppPlatformClient { * @returns {string} A string representing the location. */ matchLocationFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).location; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .location; } /** @@ -4575,7 +6146,8 @@ export class AppPlatformClient { * @returns {string} A string representing the corpus. */ matchCorpusFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).corpus; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .corpus; } /** @@ -4586,7 +6158,8 @@ export class AppPlatformClient { * @returns {string} A string representing the asset. */ matchAssetFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).asset; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .asset; } /** @@ -4597,7 +6170,8 @@ export class AppPlatformClient { * @returns {string} A string representing the annotation. */ matchAnnotationFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).annotation; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .annotation; } /** @@ -4608,7 +6182,7 @@ export class AppPlatformClient { * @param {string} application * @returns {string} Resource name string. */ - applicationPath(project:string,location:string,application:string) { + applicationPath(project: string, location: string, application: string) { return this.pathTemplates.applicationPathTemplate.render({ project: project, location: location, @@ -4624,7 +6198,8 @@ export class AppPlatformClient { * @returns {string} A string representing the project. */ matchProjectFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).project; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .project; } /** @@ -4635,7 +6210,8 @@ export class AppPlatformClient { * @returns {string} A string representing the location. */ matchLocationFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).location; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .location; } /** @@ -4646,7 +6222,8 @@ export class AppPlatformClient { * @returns {string} A string representing the application. */ matchApplicationFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).application; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .application; } /** @@ -4658,7 +6235,12 @@ export class AppPlatformClient { * @param {string} asset * @returns {string} Resource name string. */ - assetPath(projectNumber:string,location:string,corpus:string,asset:string) { + assetPath( + projectNumber: string, + location: string, + corpus: string, + asset: string, + ) { return this.pathTemplates.assetPathTemplate.render({ project_number: projectNumber, location: location, @@ -4720,7 +6302,12 @@ export class AppPlatformClient { * @param {string} channel * @returns {string} Resource name string. */ - channelPath(project:string,location:string,cluster:string,channel:string) { + channelPath( + project: string, + location: string, + cluster: string, + channel: string, + ) { return this.pathTemplates.channelPathTemplate.render({ project: project, location: location, @@ -4781,7 +6368,7 @@ export class AppPlatformClient { * @param {string} cluster * @returns {string} Resource name string. */ - clusterPath(project:string,location:string,cluster:string) { + clusterPath(project: string, location: string, cluster: string) { return this.pathTemplates.clusterPathTemplate.render({ project: project, location: location, @@ -4831,7 +6418,12 @@ export class AppPlatformClient { * @param {string} collection * @returns {string} Resource name string. */ - collectionPath(projectNumber:string,location:string,corpus:string,collection:string) { + collectionPath( + projectNumber: string, + location: string, + corpus: string, + collection: string, + ) { return this.pathTemplates.collectionPathTemplate.render({ project_number: projectNumber, location: location, @@ -4848,7 +6440,8 @@ export class AppPlatformClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).project_number; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .project_number; } /** @@ -4859,7 +6452,8 @@ export class AppPlatformClient { * @returns {string} A string representing the location. */ matchLocationFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).location; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .location; } /** @@ -4870,7 +6464,8 @@ export class AppPlatformClient { * @returns {string} A string representing the corpus. */ matchCorpusFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).corpus; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .corpus; } /** @@ -4881,7 +6476,8 @@ export class AppPlatformClient { * @returns {string} A string representing the collection. */ matchCollectionFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).collection; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .collection; } /** @@ -4892,7 +6488,7 @@ export class AppPlatformClient { * @param {string} corpus * @returns {string} Resource name string. */ - corpusPath(projectNumber:string,location:string,corpus:string) { + corpusPath(projectNumber: string, location: string, corpus: string) { return this.pathTemplates.corpusPathTemplate.render({ project_number: projectNumber, location: location, @@ -4908,7 +6504,8 @@ export class AppPlatformClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromCorpusName(corpusName: string) { - return this.pathTemplates.corpusPathTemplate.match(corpusName).project_number; + return this.pathTemplates.corpusPathTemplate.match(corpusName) + .project_number; } /** @@ -4942,7 +6539,12 @@ export class AppPlatformClient { * @param {string} data_schema * @returns {string} Resource name string. */ - dataSchemaPath(projectNumber:string,location:string,corpus:string,dataSchema:string) { + dataSchemaPath( + projectNumber: string, + location: string, + corpus: string, + dataSchema: string, + ) { return this.pathTemplates.dataSchemaPathTemplate.render({ project_number: projectNumber, location: location, @@ -4959,7 +6561,8 @@ export class AppPlatformClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).project_number; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .project_number; } /** @@ -4970,7 +6573,8 @@ export class AppPlatformClient { * @returns {string} A string representing the location. */ matchLocationFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).location; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .location; } /** @@ -4981,7 +6585,8 @@ export class AppPlatformClient { * @returns {string} A string representing the corpus. */ matchCorpusFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).corpus; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .corpus; } /** @@ -4992,7 +6597,8 @@ export class AppPlatformClient { * @returns {string} A string representing the data_schema. */ matchDataSchemaFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).data_schema; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .data_schema; } /** @@ -5004,7 +6610,12 @@ export class AppPlatformClient { * @param {string} draft * @returns {string} Resource name string. */ - draftPath(project:string,location:string,application:string,draft:string) { + draftPath( + project: string, + location: string, + application: string, + draft: string, + ) { return this.pathTemplates.draftPathTemplate.render({ project: project, location: location, @@ -5066,7 +6677,7 @@ export class AppPlatformClient { * @param {string} event * @returns {string} Resource name string. */ - eventPath(project:string,location:string,cluster:string,event:string) { + eventPath(project: string, location: string, cluster: string, event: string) { return this.pathTemplates.eventPathTemplate.render({ project: project, location: location, @@ -5128,7 +6739,12 @@ export class AppPlatformClient { * @param {string} index * @returns {string} Resource name string. */ - indexPath(projectNumber:string,location:string,corpus:string,index:string) { + indexPath( + projectNumber: string, + location: string, + corpus: string, + index: string, + ) { return this.pathTemplates.indexPathTemplate.render({ project_number: projectNumber, location: location, @@ -5189,7 +6805,7 @@ export class AppPlatformClient { * @param {string} index_endpoint * @returns {string} Resource name string. */ - indexEndpointPath(project:string,location:string,indexEndpoint:string) { + indexEndpointPath(project: string, location: string, indexEndpoint: string) { return this.pathTemplates.indexEndpointPathTemplate.render({ project: project, location: location, @@ -5205,7 +6821,8 @@ export class AppPlatformClient { * @returns {string} A string representing the project. */ matchProjectFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).project; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .project; } /** @@ -5216,7 +6833,8 @@ export class AppPlatformClient { * @returns {string} A string representing the location. */ matchLocationFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).location; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .location; } /** @@ -5227,7 +6845,8 @@ export class AppPlatformClient { * @returns {string} A string representing the index_endpoint. */ matchIndexEndpointFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).index_endpoint; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .index_endpoint; } /** @@ -5239,7 +6858,12 @@ export class AppPlatformClient { * @param {string} instance * @returns {string} Resource name string. */ - instancePath(project:string,location:string,application:string,instance:string) { + instancePath( + project: string, + location: string, + application: string, + instance: string, + ) { return this.pathTemplates.instancePathTemplate.render({ project: project, location: location, @@ -5278,7 +6902,8 @@ export class AppPlatformClient { * @returns {string} A string representing the application. */ matchApplicationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).application; + return this.pathTemplates.instancePathTemplate.match(instanceName) + .application; } /** @@ -5299,7 +6924,7 @@ export class AppPlatformClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -5336,7 +6961,7 @@ export class AppPlatformClient { * @param {string} operator * @returns {string} Resource name string. */ - operatorPath(project:string,location:string,operator:string) { + operatorPath(project: string, location: string, operator: string) { return this.pathTemplates.operatorPathTemplate.render({ project: project, location: location, @@ -5386,7 +7011,12 @@ export class AppPlatformClient { * @param {string} process * @returns {string} Resource name string. */ - processPath(project:string,location:string,cluster:string,process:string) { + processPath( + project: string, + location: string, + cluster: string, + process: string, + ) { return this.pathTemplates.processPathTemplate.render({ project: project, location: location, @@ -5447,7 +7077,7 @@ export class AppPlatformClient { * @param {string} processor * @returns {string} Resource name string. */ - processorPath(project:string,location:string,processor:string) { + processorPath(project: string, location: string, processor: string) { return this.pathTemplates.processorPathTemplate.render({ project: project, location: location, @@ -5463,7 +7093,8 @@ export class AppPlatformClient { * @returns {string} A string representing the project. */ matchProjectFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).project; + return this.pathTemplates.processorPathTemplate.match(processorName) + .project; } /** @@ -5474,7 +7105,8 @@ export class AppPlatformClient { * @returns {string} A string representing the location. */ matchLocationFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).location; + return this.pathTemplates.processorPathTemplate.match(processorName) + .location; } /** @@ -5485,7 +7117,8 @@ export class AppPlatformClient { * @returns {string} A string representing the processor. */ matchProcessorFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).processor; + return this.pathTemplates.processorPathTemplate.match(processorName) + .processor; } /** @@ -5494,7 +7127,7 @@ export class AppPlatformClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -5520,7 +7153,12 @@ export class AppPlatformClient { * @param {string} search_config * @returns {string} Resource name string. */ - searchConfigPath(projectNumber:string,location:string,corpus:string,searchConfig:string) { + searchConfigPath( + projectNumber: string, + location: string, + corpus: string, + searchConfig: string, + ) { return this.pathTemplates.searchConfigPathTemplate.render({ project_number: projectNumber, location: location, @@ -5537,7 +7175,8 @@ export class AppPlatformClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).project_number; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .project_number; } /** @@ -5548,7 +7187,8 @@ export class AppPlatformClient { * @returns {string} A string representing the location. */ matchLocationFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).location; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .location; } /** @@ -5559,7 +7199,8 @@ export class AppPlatformClient { * @returns {string} A string representing the corpus. */ matchCorpusFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).corpus; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .corpus; } /** @@ -5570,7 +7211,8 @@ export class AppPlatformClient { * @returns {string} A string representing the search_config. */ matchSearchConfigFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).search_config; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .search_config; } /** @@ -5582,7 +7224,12 @@ export class AppPlatformClient { * @param {string} search_hypernym * @returns {string} Resource name string. */ - searchHypernymPath(projectNumber:string,location:string,corpus:string,searchHypernym:string) { + searchHypernymPath( + projectNumber: string, + location: string, + corpus: string, + searchHypernym: string, + ) { return this.pathTemplates.searchHypernymPathTemplate.render({ project_number: projectNumber, location: location, @@ -5599,7 +7246,9 @@ export class AppPlatformClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).project_number; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).project_number; } /** @@ -5610,7 +7259,9 @@ export class AppPlatformClient { * @returns {string} A string representing the location. */ matchLocationFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).location; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).location; } /** @@ -5621,7 +7272,9 @@ export class AppPlatformClient { * @returns {string} A string representing the corpus. */ matchCorpusFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).corpus; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).corpus; } /** @@ -5632,7 +7285,9 @@ export class AppPlatformClient { * @returns {string} A string representing the search_hypernym. */ matchSearchHypernymFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).search_hypernym; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).search_hypernym; } /** @@ -5644,7 +7299,12 @@ export class AppPlatformClient { * @param {string} series * @returns {string} Resource name string. */ - seriesPath(project:string,location:string,cluster:string,series:string) { + seriesPath( + project: string, + location: string, + cluster: string, + series: string, + ) { return this.pathTemplates.seriesPathTemplate.render({ project: project, location: location, @@ -5706,7 +7366,12 @@ export class AppPlatformClient { * @param {string} stream * @returns {string} Resource name string. */ - streamPath(project:string,location:string,cluster:string,stream:string) { + streamPath( + project: string, + location: string, + cluster: string, + stream: string, + ) { return this.pathTemplates.streamPathTemplate.render({ project: project, location: location, @@ -5767,15 +7432,19 @@ export class AppPlatformClient { */ close(): Promise { if (this.appPlatformStub && !this._terminated) { - return this.appPlatformStub.then(stub => { + return this.appPlatformStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-visionai/src/v1/health_check_service_client.ts b/packages/google-cloud-visionai/src/v1/health_check_service_client.ts index aa89150f711a..67cf5446b233 100644 --- a/packages/google-cloud-visionai/src/v1/health_check_service_client.ts +++ b/packages/google-cloud-visionai/src/v1/health_check_service_client.ts @@ -18,11 +18,20 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -45,7 +54,7 @@ export class HealthCheckServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('visionai'); @@ -58,11 +67,11 @@ export class HealthCheckServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - healthCheckServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + healthCheckServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of HealthCheckServiceClient. @@ -103,21 +112,42 @@ export class HealthCheckServiceClient { * const client = new HealthCheckServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof HealthCheckServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'warehouse-visionai.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -142,7 +172,7 @@ export class HealthCheckServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,18 +185,14 @@ export class HealthCheckServiceClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -188,74 +214,77 @@ export class HealthCheckServiceClient { // Create useful helper objects for these. this.pathTemplates = { analysisPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/analyses/{analysis}' + 'projects/{project}/locations/{location}/clusters/{cluster}/analyses/{analysis}', ), annotationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}', ), applicationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}' + 'projects/{project}/locations/{location}/applications/{application}', ), assetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}', ), channelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/channels/{channel}' + 'projects/{project}/locations/{location}/clusters/{cluster}/channels/{channel}', ), clusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}' + 'projects/{project}/locations/{location}/clusters/{cluster}', ), collectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}', ), corpusPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}', ), dataSchemaPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}', ), draftPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}/drafts/{draft}' + 'projects/{project}/locations/{location}/applications/{application}/drafts/{draft}', ), eventPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/events/{event}' + 'projects/{project}/locations/{location}/clusters/{cluster}/events/{event}', ), indexPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}', ), indexEndpointPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}' + 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}', ), instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}/instances/{instance}' + 'projects/{project}/locations/{location}/applications/{application}/instances/{instance}', ), operatorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/operators/{operator}' + 'projects/{project}/locations/{location}/operators/{operator}', ), processPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/processes/{process}' + 'projects/{project}/locations/{location}/clusters/{cluster}/processes/{process}', ), processorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/processors/{processor}' + 'projects/{project}/locations/{location}/processors/{processor}', ), searchConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}', ), searchHypernymPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}', ), seriesPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/series/{series}' + 'projects/{project}/locations/{location}/clusters/{cluster}/series/{series}', ), streamPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/streams/{stream}' + 'projects/{project}/locations/{location}/clusters/{cluster}/streams/{stream}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.visionai.v1.HealthCheckService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.visionai.v1.HealthCheckService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -286,36 +315,40 @@ export class HealthCheckServiceClient { // Put together the "service stub" for // google.cloud.visionai.v1.HealthCheckService. this.healthCheckServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.visionai.v1.HealthCheckService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.visionai.v1.HealthCheckService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.visionai.v1.HealthCheckService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const healthCheckServiceStubMethods = - ['healthCheck']; + const healthCheckServiceStubMethods = ['healthCheck']; for (const methodName of healthCheckServiceStubMethods) { const callPromise = this.healthCheckServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -330,8 +363,14 @@ export class HealthCheckServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'warehouse-visionai.googleapis.com'; } @@ -342,8 +381,14 @@ export class HealthCheckServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'warehouse-visionai.googleapis.com'; } @@ -374,9 +419,7 @@ export class HealthCheckServiceClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -385,8 +428,9 @@ export class HealthCheckServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -397,126 +441,160 @@ export class HealthCheckServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * HealthCheck method checks the health status of the cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.cluster - * The parent of the resource. - * @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 protos.google.cloud.visionai.v1.HealthCheckResponse|HealthCheckResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/health_check_service.health_check.js - * region_tag:warehouse-visionai_v1_generated_HealthCheckService_HealthCheck_async - */ + /** + * HealthCheck method checks the health status of the cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.cluster + * The parent of the resource. + * @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 protos.google.cloud.visionai.v1.HealthCheckResponse|HealthCheckResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/health_check_service.health_check.js + * region_tag:warehouse-visionai_v1_generated_HealthCheckService_HealthCheck_async + */ healthCheck( - request?: protos.google.cloud.visionai.v1.IHealthCheckRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IHealthCheckResponse, - protos.google.cloud.visionai.v1.IHealthCheckRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IHealthCheckRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IHealthCheckResponse, + protos.google.cloud.visionai.v1.IHealthCheckRequest | undefined, + {} | undefined, + ] + >; healthCheck( - request: protos.google.cloud.visionai.v1.IHealthCheckRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IHealthCheckResponse, - protos.google.cloud.visionai.v1.IHealthCheckRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IHealthCheckRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IHealthCheckResponse, + protos.google.cloud.visionai.v1.IHealthCheckRequest | null | undefined, + {} | null | undefined + >, + ): void; healthCheck( - request: protos.google.cloud.visionai.v1.IHealthCheckRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IHealthCheckResponse, - protos.google.cloud.visionai.v1.IHealthCheckRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IHealthCheckRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IHealthCheckResponse, + protos.google.cloud.visionai.v1.IHealthCheckRequest | null | undefined, + {} | null | undefined + >, + ): void; healthCheck( - request?: protos.google.cloud.visionai.v1.IHealthCheckRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IHealthCheckResponse, - protos.google.cloud.visionai.v1.IHealthCheckRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IHealthCheckRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IHealthCheckResponse, - protos.google.cloud.visionai.v1.IHealthCheckRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IHealthCheckResponse, - protos.google.cloud.visionai.v1.IHealthCheckRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IHealthCheckRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IHealthCheckResponse, + protos.google.cloud.visionai.v1.IHealthCheckRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IHealthCheckResponse, + protos.google.cloud.visionai.v1.IHealthCheckRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'cluster': request.cluster ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + cluster: request.cluster ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('healthCheck request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IHealthCheckResponse, - protos.google.cloud.visionai.v1.IHealthCheckRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IHealthCheckResponse, + | protos.google.cloud.visionai.v1.IHealthCheckRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('healthCheck response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.healthCheck(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IHealthCheckResponse, - protos.google.cloud.visionai.v1.IHealthCheckRequest|undefined, - {}|undefined - ]) => { - this._log.info('healthCheck response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .healthCheck(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IHealthCheckResponse, + protos.google.cloud.visionai.v1.IHealthCheckRequest | undefined, + {} | undefined, + ]) => { + this._log.info('healthCheck response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + /** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getIamPolicy( request: IamProtos.google.iam.v1.GetIamPolicyRequest, options?: @@ -530,40 +608,40 @@ export class HealthCheckServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.getIamPolicy(request, options, callback); } -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ setIamPolicy( request: IamProtos.google.iam.v1.SetIamPolicyRequest, options?: @@ -577,41 +655,41 @@ export class HealthCheckServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.setIamPolicy(request, options, callback); } -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ testIamPermissions( request: IamProtos.google.iam.v1.TestIamPermissionsRequest, options?: @@ -625,12 +703,12 @@ export class HealthCheckServiceClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -665,12 +743,11 @@ export class HealthCheckServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -703,7 +780,7 @@ export class HealthCheckServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -721,7 +798,12 @@ export class HealthCheckServiceClient { * @param {string} analysis * @returns {string} Resource name string. */ - analysisPath(project:string,location:string,cluster:string,analysis:string) { + analysisPath( + project: string, + location: string, + cluster: string, + analysis: string, + ) { return this.pathTemplates.analysisPathTemplate.render({ project: project, location: location, @@ -784,7 +866,13 @@ export class HealthCheckServiceClient { * @param {string} annotation * @returns {string} Resource name string. */ - annotationPath(projectNumber:string,location:string,corpus:string,asset:string,annotation:string) { + annotationPath( + projectNumber: string, + location: string, + corpus: string, + asset: string, + annotation: string, + ) { return this.pathTemplates.annotationPathTemplate.render({ project_number: projectNumber, location: location, @@ -802,7 +890,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).project_number; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .project_number; } /** @@ -813,7 +902,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).location; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .location; } /** @@ -824,7 +914,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).corpus; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .corpus; } /** @@ -835,7 +926,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the asset. */ matchAssetFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).asset; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .asset; } /** @@ -846,7 +938,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the annotation. */ matchAnnotationFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).annotation; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .annotation; } /** @@ -857,7 +950,7 @@ export class HealthCheckServiceClient { * @param {string} application * @returns {string} Resource name string. */ - applicationPath(project:string,location:string,application:string) { + applicationPath(project: string, location: string, application: string) { return this.pathTemplates.applicationPathTemplate.render({ project: project, location: location, @@ -873,7 +966,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the project. */ matchProjectFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).project; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .project; } /** @@ -884,7 +978,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the location. */ matchLocationFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).location; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .location; } /** @@ -895,7 +990,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the application. */ matchApplicationFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).application; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .application; } /** @@ -907,7 +1003,12 @@ export class HealthCheckServiceClient { * @param {string} asset * @returns {string} Resource name string. */ - assetPath(projectNumber:string,location:string,corpus:string,asset:string) { + assetPath( + projectNumber: string, + location: string, + corpus: string, + asset: string, + ) { return this.pathTemplates.assetPathTemplate.render({ project_number: projectNumber, location: location, @@ -969,7 +1070,12 @@ export class HealthCheckServiceClient { * @param {string} channel * @returns {string} Resource name string. */ - channelPath(project:string,location:string,cluster:string,channel:string) { + channelPath( + project: string, + location: string, + cluster: string, + channel: string, + ) { return this.pathTemplates.channelPathTemplate.render({ project: project, location: location, @@ -1030,7 +1136,7 @@ export class HealthCheckServiceClient { * @param {string} cluster * @returns {string} Resource name string. */ - clusterPath(project:string,location:string,cluster:string) { + clusterPath(project: string, location: string, cluster: string) { return this.pathTemplates.clusterPathTemplate.render({ project: project, location: location, @@ -1080,7 +1186,12 @@ export class HealthCheckServiceClient { * @param {string} collection * @returns {string} Resource name string. */ - collectionPath(projectNumber:string,location:string,corpus:string,collection:string) { + collectionPath( + projectNumber: string, + location: string, + corpus: string, + collection: string, + ) { return this.pathTemplates.collectionPathTemplate.render({ project_number: projectNumber, location: location, @@ -1097,7 +1208,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).project_number; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .project_number; } /** @@ -1108,7 +1220,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the location. */ matchLocationFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).location; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .location; } /** @@ -1119,7 +1232,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).corpus; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .corpus; } /** @@ -1130,7 +1244,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the collection. */ matchCollectionFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).collection; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .collection; } /** @@ -1141,7 +1256,7 @@ export class HealthCheckServiceClient { * @param {string} corpus * @returns {string} Resource name string. */ - corpusPath(projectNumber:string,location:string,corpus:string) { + corpusPath(projectNumber: string, location: string, corpus: string) { return this.pathTemplates.corpusPathTemplate.render({ project_number: projectNumber, location: location, @@ -1157,7 +1272,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromCorpusName(corpusName: string) { - return this.pathTemplates.corpusPathTemplate.match(corpusName).project_number; + return this.pathTemplates.corpusPathTemplate.match(corpusName) + .project_number; } /** @@ -1191,7 +1307,12 @@ export class HealthCheckServiceClient { * @param {string} data_schema * @returns {string} Resource name string. */ - dataSchemaPath(projectNumber:string,location:string,corpus:string,dataSchema:string) { + dataSchemaPath( + projectNumber: string, + location: string, + corpus: string, + dataSchema: string, + ) { return this.pathTemplates.dataSchemaPathTemplate.render({ project_number: projectNumber, location: location, @@ -1208,7 +1329,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).project_number; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .project_number; } /** @@ -1219,7 +1341,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the location. */ matchLocationFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).location; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .location; } /** @@ -1230,7 +1353,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).corpus; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .corpus; } /** @@ -1241,7 +1365,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the data_schema. */ matchDataSchemaFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).data_schema; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .data_schema; } /** @@ -1253,7 +1378,12 @@ export class HealthCheckServiceClient { * @param {string} draft * @returns {string} Resource name string. */ - draftPath(project:string,location:string,application:string,draft:string) { + draftPath( + project: string, + location: string, + application: string, + draft: string, + ) { return this.pathTemplates.draftPathTemplate.render({ project: project, location: location, @@ -1315,7 +1445,7 @@ export class HealthCheckServiceClient { * @param {string} event * @returns {string} Resource name string. */ - eventPath(project:string,location:string,cluster:string,event:string) { + eventPath(project: string, location: string, cluster: string, event: string) { return this.pathTemplates.eventPathTemplate.render({ project: project, location: location, @@ -1377,7 +1507,12 @@ export class HealthCheckServiceClient { * @param {string} index * @returns {string} Resource name string. */ - indexPath(projectNumber:string,location:string,corpus:string,index:string) { + indexPath( + projectNumber: string, + location: string, + corpus: string, + index: string, + ) { return this.pathTemplates.indexPathTemplate.render({ project_number: projectNumber, location: location, @@ -1438,7 +1573,7 @@ export class HealthCheckServiceClient { * @param {string} index_endpoint * @returns {string} Resource name string. */ - indexEndpointPath(project:string,location:string,indexEndpoint:string) { + indexEndpointPath(project: string, location: string, indexEndpoint: string) { return this.pathTemplates.indexEndpointPathTemplate.render({ project: project, location: location, @@ -1454,7 +1589,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the project. */ matchProjectFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).project; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .project; } /** @@ -1465,7 +1601,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the location. */ matchLocationFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).location; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .location; } /** @@ -1476,7 +1613,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the index_endpoint. */ matchIndexEndpointFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).index_endpoint; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .index_endpoint; } /** @@ -1488,7 +1626,12 @@ export class HealthCheckServiceClient { * @param {string} instance * @returns {string} Resource name string. */ - instancePath(project:string,location:string,application:string,instance:string) { + instancePath( + project: string, + location: string, + application: string, + instance: string, + ) { return this.pathTemplates.instancePathTemplate.render({ project: project, location: location, @@ -1527,7 +1670,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the application. */ matchApplicationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).application; + return this.pathTemplates.instancePathTemplate.match(instanceName) + .application; } /** @@ -1549,7 +1693,7 @@ export class HealthCheckServiceClient { * @param {string} operator * @returns {string} Resource name string. */ - operatorPath(project:string,location:string,operator:string) { + operatorPath(project: string, location: string, operator: string) { return this.pathTemplates.operatorPathTemplate.render({ project: project, location: location, @@ -1599,7 +1743,12 @@ export class HealthCheckServiceClient { * @param {string} process * @returns {string} Resource name string. */ - processPath(project:string,location:string,cluster:string,process:string) { + processPath( + project: string, + location: string, + cluster: string, + process: string, + ) { return this.pathTemplates.processPathTemplate.render({ project: project, location: location, @@ -1660,7 +1809,7 @@ export class HealthCheckServiceClient { * @param {string} processor * @returns {string} Resource name string. */ - processorPath(project:string,location:string,processor:string) { + processorPath(project: string, location: string, processor: string) { return this.pathTemplates.processorPathTemplate.render({ project: project, location: location, @@ -1676,7 +1825,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).project; + return this.pathTemplates.processorPathTemplate.match(processorName) + .project; } /** @@ -1687,7 +1837,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the location. */ matchLocationFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).location; + return this.pathTemplates.processorPathTemplate.match(processorName) + .location; } /** @@ -1698,7 +1849,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the processor. */ matchProcessorFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).processor; + return this.pathTemplates.processorPathTemplate.match(processorName) + .processor; } /** @@ -1710,7 +1862,12 @@ export class HealthCheckServiceClient { * @param {string} search_config * @returns {string} Resource name string. */ - searchConfigPath(projectNumber:string,location:string,corpus:string,searchConfig:string) { + searchConfigPath( + projectNumber: string, + location: string, + corpus: string, + searchConfig: string, + ) { return this.pathTemplates.searchConfigPathTemplate.render({ project_number: projectNumber, location: location, @@ -1727,7 +1884,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).project_number; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .project_number; } /** @@ -1738,7 +1896,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the location. */ matchLocationFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).location; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .location; } /** @@ -1749,7 +1908,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).corpus; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .corpus; } /** @@ -1760,7 +1920,8 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the search_config. */ matchSearchConfigFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).search_config; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .search_config; } /** @@ -1772,7 +1933,12 @@ export class HealthCheckServiceClient { * @param {string} search_hypernym * @returns {string} Resource name string. */ - searchHypernymPath(projectNumber:string,location:string,corpus:string,searchHypernym:string) { + searchHypernymPath( + projectNumber: string, + location: string, + corpus: string, + searchHypernym: string, + ) { return this.pathTemplates.searchHypernymPathTemplate.render({ project_number: projectNumber, location: location, @@ -1789,7 +1955,9 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).project_number; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).project_number; } /** @@ -1800,7 +1968,9 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the location. */ matchLocationFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).location; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).location; } /** @@ -1811,7 +1981,9 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).corpus; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).corpus; } /** @@ -1822,7 +1994,9 @@ export class HealthCheckServiceClient { * @returns {string} A string representing the search_hypernym. */ matchSearchHypernymFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).search_hypernym; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).search_hypernym; } /** @@ -1834,7 +2008,12 @@ export class HealthCheckServiceClient { * @param {string} series * @returns {string} Resource name string. */ - seriesPath(project:string,location:string,cluster:string,series:string) { + seriesPath( + project: string, + location: string, + cluster: string, + series: string, + ) { return this.pathTemplates.seriesPathTemplate.render({ project: project, location: location, @@ -1896,7 +2075,12 @@ export class HealthCheckServiceClient { * @param {string} stream * @returns {string} Resource name string. */ - streamPath(project:string,location:string,cluster:string,stream:string) { + streamPath( + project: string, + location: string, + cluster: string, + stream: string, + ) { return this.pathTemplates.streamPathTemplate.render({ project: project, location: location, @@ -1957,14 +2141,18 @@ export class HealthCheckServiceClient { */ close(): Promise { if (this.healthCheckServiceStub && !this._terminated) { - return this.healthCheckServiceStub.then(stub => { + return this.healthCheckServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-visionai/src/v1/index.ts b/packages/google-cloud-visionai/src/v1/index.ts index 91c02ce6d801..85353fc1efb3 100644 --- a/packages/google-cloud-visionai/src/v1/index.ts +++ b/packages/google-cloud-visionai/src/v1/index.ts @@ -16,9 +16,9 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {AppPlatformClient} from './app_platform_client'; -export {HealthCheckServiceClient} from './health_check_service_client'; -export {LiveVideoAnalyticsClient} from './live_video_analytics_client'; -export {StreamingServiceClient} from './streaming_service_client'; -export {StreamsServiceClient} from './streams_service_client'; -export {WarehouseClient} from './warehouse_client'; +export { AppPlatformClient } from './app_platform_client'; +export { HealthCheckServiceClient } from './health_check_service_client'; +export { LiveVideoAnalyticsClient } from './live_video_analytics_client'; +export { StreamingServiceClient } from './streaming_service_client'; +export { StreamsServiceClient } from './streams_service_client'; +export { WarehouseClient } from './warehouse_client'; diff --git a/packages/google-cloud-visionai/src/v1/live_video_analytics_client.ts b/packages/google-cloud-visionai/src/v1/live_video_analytics_client.ts index 598a19fafc74..a3c1f7267bd3 100644 --- a/packages/google-cloud-visionai/src/v1/live_video_analytics_client.ts +++ b/packages/google-cloud-visionai/src/v1/live_video_analytics_client.ts @@ -18,11 +18,24 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -45,7 +58,7 @@ export class LiveVideoAnalyticsClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('visionai'); @@ -58,12 +71,12 @@ export class LiveVideoAnalyticsClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - liveVideoAnalyticsStub?: Promise<{[name: string]: Function}>; + liveVideoAnalyticsStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of LiveVideoAnalyticsClient. @@ -104,21 +117,42 @@ export class LiveVideoAnalyticsClient { * const client = new LiveVideoAnalyticsClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof LiveVideoAnalyticsClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'warehouse-visionai.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -143,7 +177,7 @@ export class LiveVideoAnalyticsClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -156,18 +190,14 @@ export class LiveVideoAnalyticsClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -189,70 +219,70 @@ export class LiveVideoAnalyticsClient { // Create useful helper objects for these. this.pathTemplates = { analysisPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/analyses/{analysis}' + 'projects/{project}/locations/{location}/clusters/{cluster}/analyses/{analysis}', ), annotationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}', ), applicationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}' + 'projects/{project}/locations/{location}/applications/{application}', ), assetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}', ), channelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/channels/{channel}' + 'projects/{project}/locations/{location}/clusters/{cluster}/channels/{channel}', ), clusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}' + 'projects/{project}/locations/{location}/clusters/{cluster}', ), collectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}', ), corpusPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}', ), dataSchemaPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}', ), draftPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}/drafts/{draft}' + 'projects/{project}/locations/{location}/applications/{application}/drafts/{draft}', ), eventPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/events/{event}' + 'projects/{project}/locations/{location}/clusters/{cluster}/events/{event}', ), indexPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}', ), indexEndpointPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}' + 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}', ), instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}/instances/{instance}' + 'projects/{project}/locations/{location}/applications/{application}/instances/{instance}', ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), operatorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/operators/{operator}' + 'projects/{project}/locations/{location}/operators/{operator}', ), processPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/processes/{process}' + 'projects/{project}/locations/{location}/clusters/{cluster}/processes/{process}', ), processorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/processors/{processor}' + 'projects/{project}/locations/{location}/processors/{processor}', ), searchConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}', ), searchHypernymPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}', ), seriesPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/series/{series}' + 'projects/{project}/locations/{location}/clusters/{cluster}/series/{series}', ), streamPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/streams/{stream}' + 'projects/{project}/locations/{location}/clusters/{cluster}/streams/{stream}', ), }; @@ -260,14 +290,26 @@ export class LiveVideoAnalyticsClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listPublicOperators: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'operators'), - listOperators: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'operators'), - listAnalyses: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'analyses'), - listProcesses: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'processes') + listPublicOperators: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'operators', + ), + listOperators: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'operators', + ), + listAnalyses: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'analyses', + ), + listProcesses: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'processes', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -276,102 +318,181 @@ export class LiveVideoAnalyticsClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/warehouseOperations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/assets/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/collections/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/imageIndexes/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/indexes/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { get: '/v1/{name=projects/*/locations/*/warehouseOperations/*}' }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/assets/*/operations/*}', + }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/collections/*/operations/*}', + }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/imageIndexes/*/operations/*}', + }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/indexes/*/operations/*}', + }, + { get: '/v1/{name=projects/*/locations/*/corpora/*/operations/*}' }, + { + get: '/v1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createOperatorResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Operator') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Operator', + ) as gax.protobuf.Type; const createOperatorMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateOperatorResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Operator') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Operator', + ) as gax.protobuf.Type; const updateOperatorMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteOperatorResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteOperatorMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const createAnalysisResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Analysis') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Analysis', + ) as gax.protobuf.Type; const createAnalysisMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateAnalysisResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Analysis') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Analysis', + ) as gax.protobuf.Type; const updateAnalysisMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteAnalysisResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteAnalysisMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const createProcessResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Process') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Process', + ) as gax.protobuf.Type; const createProcessMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateProcessResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Process') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Process', + ) as gax.protobuf.Type; const updateProcessMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteProcessResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteProcessMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const batchRunProcessResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.BatchRunProcessResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.BatchRunProcessResponse', + ) as gax.protobuf.Type; const batchRunProcessMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createOperator: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createOperatorResponse.decode.bind(createOperatorResponse), - createOperatorMetadata.decode.bind(createOperatorMetadata)), + createOperatorMetadata.decode.bind(createOperatorMetadata), + ), updateOperator: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateOperatorResponse.decode.bind(updateOperatorResponse), - updateOperatorMetadata.decode.bind(updateOperatorMetadata)), + updateOperatorMetadata.decode.bind(updateOperatorMetadata), + ), deleteOperator: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteOperatorResponse.decode.bind(deleteOperatorResponse), - deleteOperatorMetadata.decode.bind(deleteOperatorMetadata)), + deleteOperatorMetadata.decode.bind(deleteOperatorMetadata), + ), createAnalysis: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createAnalysisResponse.decode.bind(createAnalysisResponse), - createAnalysisMetadata.decode.bind(createAnalysisMetadata)), + createAnalysisMetadata.decode.bind(createAnalysisMetadata), + ), updateAnalysis: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateAnalysisResponse.decode.bind(updateAnalysisResponse), - updateAnalysisMetadata.decode.bind(updateAnalysisMetadata)), + updateAnalysisMetadata.decode.bind(updateAnalysisMetadata), + ), deleteAnalysis: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteAnalysisResponse.decode.bind(deleteAnalysisResponse), - deleteAnalysisMetadata.decode.bind(deleteAnalysisMetadata)), + deleteAnalysisMetadata.decode.bind(deleteAnalysisMetadata), + ), createProcess: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createProcessResponse.decode.bind(createProcessResponse), - createProcessMetadata.decode.bind(createProcessMetadata)), + createProcessMetadata.decode.bind(createProcessMetadata), + ), updateProcess: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateProcessResponse.decode.bind(updateProcessResponse), - updateProcessMetadata.decode.bind(updateProcessMetadata)), + updateProcessMetadata.decode.bind(updateProcessMetadata), + ), deleteProcess: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteProcessResponse.decode.bind(deleteProcessResponse), - deleteProcessMetadata.decode.bind(deleteProcessMetadata)), + deleteProcessMetadata.decode.bind(deleteProcessMetadata), + ), batchRunProcess: new this._gaxModule.LongrunningDescriptor( this.operationsClient, batchRunProcessResponse.decode.bind(batchRunProcessResponse), - batchRunProcessMetadata.decode.bind(batchRunProcessMetadata)) + batchRunProcessMetadata.decode.bind(batchRunProcessMetadata), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.visionai.v1.LiveVideoAnalytics', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.visionai.v1.LiveVideoAnalytics', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -402,28 +523,52 @@ export class LiveVideoAnalyticsClient { // Put together the "service stub" for // google.cloud.visionai.v1.LiveVideoAnalytics. this.liveVideoAnalyticsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.visionai.v1.LiveVideoAnalytics') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.visionai.v1.LiveVideoAnalytics', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.visionai.v1.LiveVideoAnalytics, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const liveVideoAnalyticsStubMethods = - ['listPublicOperators', 'resolveOperatorInfo', 'listOperators', 'getOperator', 'createOperator', 'updateOperator', 'deleteOperator', 'listAnalyses', 'getAnalysis', 'createAnalysis', 'updateAnalysis', 'deleteAnalysis', 'listProcesses', 'getProcess', 'createProcess', 'updateProcess', 'deleteProcess', 'batchRunProcess']; + const liveVideoAnalyticsStubMethods = [ + 'listPublicOperators', + 'resolveOperatorInfo', + 'listOperators', + 'getOperator', + 'createOperator', + 'updateOperator', + 'deleteOperator', + 'listAnalyses', + 'getAnalysis', + 'createAnalysis', + 'updateAnalysis', + 'deleteAnalysis', + 'listProcesses', + 'getProcess', + 'createProcess', + 'updateProcess', + 'deleteProcess', + 'batchRunProcess', + ]; for (const methodName of liveVideoAnalyticsStubMethods) { const callPromise = this.liveVideoAnalyticsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); const descriptor = this.descriptors.page[methodName] || @@ -433,7 +578,7 @@ export class LiveVideoAnalyticsClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -448,8 +593,14 @@ export class LiveVideoAnalyticsClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'warehouse-visionai.googleapis.com'; } @@ -460,8 +611,14 @@ export class LiveVideoAnalyticsClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'warehouse-visionai.googleapis.com'; } @@ -492,9 +649,7 @@ export class LiveVideoAnalyticsClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -503,8 +658,9 @@ export class LiveVideoAnalyticsClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -515,1704 +671,2490 @@ export class LiveVideoAnalyticsClient { // ------------------- // -- Service calls -- // ------------------- -/** - * ResolveOperatorInfo returns the operator information based on the request. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ResolveOperatorInfoRequest. - * @param {number[]} request.queries - * Required. The operator queries. - * @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 protos.google.cloud.visionai.v1.ResolveOperatorInfoResponse|ResolveOperatorInfoResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.resolve_operator_info.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_ResolveOperatorInfo_async - */ + /** + * ResolveOperatorInfo returns the operator information based on the request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ResolveOperatorInfoRequest. + * @param {number[]} request.queries + * Required. The operator queries. + * @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 protos.google.cloud.visionai.v1.ResolveOperatorInfoResponse|ResolveOperatorInfoResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.resolve_operator_info.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_ResolveOperatorInfo_async + */ resolveOperatorInfo( - request?: protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, - protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, + protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest | undefined, + {} | undefined, + ] + >; resolveOperatorInfo( - request: protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, - protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, + | protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest + | null + | undefined, + {} | null | undefined + >, + ): void; resolveOperatorInfo( - request: protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, - protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, + | protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest + | null + | undefined, + {} | null | undefined + >, + ): void; resolveOperatorInfo( - request?: protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, - protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, - protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, - protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, + | protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, + protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('resolveOperatorInfo request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, - protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, + | protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('resolveOperatorInfo response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.resolveOperatorInfo(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, - protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest|undefined, - {}|undefined - ]) => { - this._log.info('resolveOperatorInfo response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .resolveOperatorInfo(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse, + ( + | protos.google.cloud.visionai.v1.IResolveOperatorInfoRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('resolveOperatorInfo response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single Operator. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @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 protos.google.cloud.visionai.v1.Operator|Operator}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.get_operator.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_GetOperator_async - */ + /** + * Gets details of a single Operator. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @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 protos.google.cloud.visionai.v1.Operator|Operator}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.get_operator.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_GetOperator_async + */ getOperator( - request?: protos.google.cloud.visionai.v1.IGetOperatorRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IOperator, - protos.google.cloud.visionai.v1.IGetOperatorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetOperatorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IGetOperatorRequest | undefined, + {} | undefined, + ] + >; getOperator( - request: protos.google.cloud.visionai.v1.IGetOperatorRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IOperator, - protos.google.cloud.visionai.v1.IGetOperatorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetOperatorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IGetOperatorRequest | null | undefined, + {} | null | undefined + >, + ): void; getOperator( - request: protos.google.cloud.visionai.v1.IGetOperatorRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IOperator, - protos.google.cloud.visionai.v1.IGetOperatorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetOperatorRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IGetOperatorRequest | null | undefined, + {} | null | undefined + >, + ): void; getOperator( - request?: protos.google.cloud.visionai.v1.IGetOperatorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IOperator, - protos.google.cloud.visionai.v1.IGetOperatorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetOperatorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IOperator, - protos.google.cloud.visionai.v1.IGetOperatorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IOperator, - protos.google.cloud.visionai.v1.IGetOperatorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IGetOperatorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IGetOperatorRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IGetOperatorRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getOperator request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IOperator, - protos.google.cloud.visionai.v1.IGetOperatorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IOperator, + | protos.google.cloud.visionai.v1.IGetOperatorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getOperator response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getOperator(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IOperator, - protos.google.cloud.visionai.v1.IGetOperatorRequest|undefined, - {}|undefined - ]) => { - this._log.info('getOperator response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getOperator(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IGetOperatorRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getOperator response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single Analysis. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @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 protos.google.cloud.visionai.v1.Analysis|Analysis}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.get_analysis.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_GetAnalysis_async - */ + /** + * Gets details of a single Analysis. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @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 protos.google.cloud.visionai.v1.Analysis|Analysis}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.get_analysis.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_GetAnalysis_async + */ getAnalysis( - request?: protos.google.cloud.visionai.v1.IGetAnalysisRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IAnalysis, - protos.google.cloud.visionai.v1.IGetAnalysisRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetAnalysisRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IGetAnalysisRequest | undefined, + {} | undefined, + ] + >; getAnalysis( - request: protos.google.cloud.visionai.v1.IGetAnalysisRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IAnalysis, - protos.google.cloud.visionai.v1.IGetAnalysisRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetAnalysisRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IGetAnalysisRequest | null | undefined, + {} | null | undefined + >, + ): void; getAnalysis( - request: protos.google.cloud.visionai.v1.IGetAnalysisRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IAnalysis, - protos.google.cloud.visionai.v1.IGetAnalysisRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetAnalysisRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IGetAnalysisRequest | null | undefined, + {} | null | undefined + >, + ): void; getAnalysis( - request?: protos.google.cloud.visionai.v1.IGetAnalysisRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IAnalysis, - protos.google.cloud.visionai.v1.IGetAnalysisRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetAnalysisRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IAnalysis, - protos.google.cloud.visionai.v1.IGetAnalysisRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IAnalysis, - protos.google.cloud.visionai.v1.IGetAnalysisRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IGetAnalysisRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IGetAnalysisRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IGetAnalysisRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getAnalysis request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IAnalysis, - protos.google.cloud.visionai.v1.IGetAnalysisRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IAnalysis, + | protos.google.cloud.visionai.v1.IGetAnalysisRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getAnalysis response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getAnalysis(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IAnalysis, - protos.google.cloud.visionai.v1.IGetAnalysisRequest|undefined, - {}|undefined - ]) => { - this._log.info('getAnalysis response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getAnalysis(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IGetAnalysisRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getAnalysis response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single Process. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @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 protos.google.cloud.visionai.v1.Process|Process}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.get_process.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_GetProcess_async - */ + /** + * Gets details of a single Process. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @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 protos.google.cloud.visionai.v1.Process|Process}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.get_process.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_GetProcess_async + */ getProcess( - request?: protos.google.cloud.visionai.v1.IGetProcessRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IProcess, - protos.google.cloud.visionai.v1.IGetProcessRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetProcessRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IGetProcessRequest | undefined, + {} | undefined, + ] + >; getProcess( - request: protos.google.cloud.visionai.v1.IGetProcessRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IProcess, - protos.google.cloud.visionai.v1.IGetProcessRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetProcessRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IGetProcessRequest | null | undefined, + {} | null | undefined + >, + ): void; getProcess( - request: protos.google.cloud.visionai.v1.IGetProcessRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IProcess, - protos.google.cloud.visionai.v1.IGetProcessRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetProcessRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IGetProcessRequest | null | undefined, + {} | null | undefined + >, + ): void; getProcess( - request?: protos.google.cloud.visionai.v1.IGetProcessRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IProcess, - protos.google.cloud.visionai.v1.IGetProcessRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetProcessRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IProcess, - protos.google.cloud.visionai.v1.IGetProcessRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IProcess, - protos.google.cloud.visionai.v1.IGetProcessRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.visionai.v1.IGetProcessRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IGetProcessRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IGetProcessRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getProcess request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IProcess, - protos.google.cloud.visionai.v1.IGetProcessRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IGetProcessRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getProcess response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getProcess(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IProcess, - protos.google.cloud.visionai.v1.IGetProcessRequest|undefined, - {}|undefined - ]) => { - this._log.info('getProcess response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getProcess(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IGetProcessRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getProcess response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new Operator in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.operatorId - * Required. Id of the requesting object. - * @param {google.cloud.visionai.v1.Operator} request.operator - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.create_operator.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_CreateOperator_async - */ + /** + * Creates a new Operator in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.operatorId + * Required. Id of the requesting object. + * @param {google.cloud.visionai.v1.Operator} request.operator + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.create_operator.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_CreateOperator_async + */ createOperator( - request?: protos.google.cloud.visionai.v1.ICreateOperatorRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateOperatorRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createOperator( - request: protos.google.cloud.visionai.v1.ICreateOperatorRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateOperatorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createOperator( - request: protos.google.cloud.visionai.v1.ICreateOperatorRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateOperatorRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createOperator( - request?: protos.google.cloud.visionai.v1.ICreateOperatorRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.ICreateOperatorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createOperator response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createOperator request %j', request); - return this.innerApiCalls.createOperator(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createOperator response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createOperator(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createOperator response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createOperator()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.create_operator.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_CreateOperator_async - */ - async checkCreateOperatorProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createOperator()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.create_operator.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_CreateOperator_async + */ + async checkCreateOperatorProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Operator, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('createOperator long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createOperator, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createOperator, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Operator, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single Operator. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * Operator resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.visionai.v1.Operator} request.operator - * Required. The resource being updated - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.update_operator.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_UpdateOperator_async - */ - updateOperator( - request?: protos.google.cloud.visionai.v1.IUpdateOperatorRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateOperator( - request: protos.google.cloud.visionai.v1.IUpdateOperatorRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateOperator( - request: protos.google.cloud.visionai.v1.IUpdateOperatorRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateOperator( - request?: protos.google.cloud.visionai.v1.IUpdateOperatorRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; + /** + * Updates the parameters of a single Operator. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * Operator resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.visionai.v1.Operator} request.operator + * Required. The resource being updated + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.update_operator.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_UpdateOperator_async + */ + updateOperator( + request?: protos.google.cloud.visionai.v1.IUpdateOperatorRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + updateOperator( + request: protos.google.cloud.visionai.v1.IUpdateOperatorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateOperator( + request: protos.google.cloud.visionai.v1.IUpdateOperatorRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateOperator( + request?: protos.google.cloud.visionai.v1.IUpdateOperatorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'operator.name': request.operator!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'operator.name': request.operator!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateOperator response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateOperator request %j', request); - return this.innerApiCalls.updateOperator(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateOperator response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateOperator(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateOperator response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateOperator()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.update_operator.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_UpdateOperator_async - */ - async checkUpdateOperatorProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateOperator()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.update_operator.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_UpdateOperator_async + */ + async checkUpdateOperatorProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Operator, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('updateOperator long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateOperator, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateOperator, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Operator, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Deletes a single Operator. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.delete_operator.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_DeleteOperator_async - */ + /** + * Deletes a single Operator. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.delete_operator.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_DeleteOperator_async + */ deleteOperator( - request?: protos.google.cloud.visionai.v1.IDeleteOperatorRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteOperatorRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteOperator( - request: protos.google.cloud.visionai.v1.IDeleteOperatorRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteOperatorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteOperator( - request: protos.google.cloud.visionai.v1.IDeleteOperatorRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteOperatorRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteOperator( - request?: protos.google.cloud.visionai.v1.IDeleteOperatorRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteOperatorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteOperator response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteOperator request %j', request); - return this.innerApiCalls.deleteOperator(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteOperator response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteOperator(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteOperator response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteOperator()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.delete_operator.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_DeleteOperator_async - */ - async checkDeleteOperatorProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteOperator()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.delete_operator.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_DeleteOperator_async + */ + async checkDeleteOperatorProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('deleteOperator long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteOperator, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteOperator, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Creates a new Analysis in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.analysisId - * Required. Id of the requesting object. - * @param {google.cloud.visionai.v1.Analysis} request.analysis - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.create_analysis.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_CreateAnalysis_async - */ + /** + * Creates a new Analysis in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.analysisId + * Required. Id of the requesting object. + * @param {google.cloud.visionai.v1.Analysis} request.analysis + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.create_analysis.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_CreateAnalysis_async + */ createAnalysis( - request?: protos.google.cloud.visionai.v1.ICreateAnalysisRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateAnalysisRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createAnalysis( - request: protos.google.cloud.visionai.v1.ICreateAnalysisRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateAnalysisRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAnalysis( - request: protos.google.cloud.visionai.v1.ICreateAnalysisRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateAnalysisRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createAnalysis( - request?: protos.google.cloud.visionai.v1.ICreateAnalysisRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.ICreateAnalysisRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createAnalysis response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createAnalysis request %j', request); - return this.innerApiCalls.createAnalysis(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createAnalysis response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createAnalysis(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createAnalysis response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createAnalysis()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.create_analysis.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_CreateAnalysis_async - */ - async checkCreateAnalysisProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createAnalysis()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.create_analysis.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_CreateAnalysis_async + */ + async checkCreateAnalysisProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Analysis, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('createAnalysis long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAnalysis, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createAnalysis, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Analysis, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single Analysis. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * Analysis resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.visionai.v1.Analysis} request.analysis - * Required. The resource being updated. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.update_analysis.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_UpdateAnalysis_async - */ + /** + * Updates the parameters of a single Analysis. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * Analysis resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.visionai.v1.Analysis} request.analysis + * Required. The resource being updated. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.update_analysis.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_UpdateAnalysis_async + */ updateAnalysis( - request?: protos.google.cloud.visionai.v1.IUpdateAnalysisRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateAnalysisRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateAnalysis( - request: protos.google.cloud.visionai.v1.IUpdateAnalysisRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateAnalysisRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAnalysis( - request: protos.google.cloud.visionai.v1.IUpdateAnalysisRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateAnalysisRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateAnalysis( - request?: protos.google.cloud.visionai.v1.IUpdateAnalysisRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUpdateAnalysisRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'analysis.name': request.analysis!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'analysis.name': request.analysis!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateAnalysis response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateAnalysis request %j', request); - return this.innerApiCalls.updateAnalysis(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateAnalysis response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateAnalysis(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateAnalysis response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateAnalysis()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.update_analysis.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_UpdateAnalysis_async - */ - async checkUpdateAnalysisProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateAnalysis()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.update_analysis.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_UpdateAnalysis_async + */ + async checkUpdateAnalysisProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Analysis, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('updateAnalysis long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAnalysis, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateAnalysis, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Analysis, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Deletes a single Analysis. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.delete_analysis.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_DeleteAnalysis_async - */ + /** + * Deletes a single Analysis. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.delete_analysis.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_DeleteAnalysis_async + */ deleteAnalysis( - request?: protos.google.cloud.visionai.v1.IDeleteAnalysisRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteAnalysisRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteAnalysis( - request: protos.google.cloud.visionai.v1.IDeleteAnalysisRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteAnalysisRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAnalysis( - request: protos.google.cloud.visionai.v1.IDeleteAnalysisRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteAnalysisRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAnalysis( - request?: protos.google.cloud.visionai.v1.IDeleteAnalysisRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteAnalysisRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteAnalysis response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteAnalysis request %j', request); - return this.innerApiCalls.deleteAnalysis(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteAnalysis response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteAnalysis(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteAnalysis response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteAnalysis()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.delete_analysis.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_DeleteAnalysis_async - */ - async checkDeleteAnalysisProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteAnalysis()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.delete_analysis.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_DeleteAnalysis_async + */ + async checkDeleteAnalysisProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('deleteAnalysis long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAnalysis, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteAnalysis, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Creates a new Process in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.processId - * Required. Id of the requesting object. - * @param {google.cloud.visionai.v1.Process} request.process - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.create_process.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_CreateProcess_async - */ + /** + * Creates a new Process in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.processId + * Required. Id of the requesting object. + * @param {google.cloud.visionai.v1.Process} request.process + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.create_process.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_CreateProcess_async + */ createProcess( - request?: protos.google.cloud.visionai.v1.ICreateProcessRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateProcessRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createProcess( - request: protos.google.cloud.visionai.v1.ICreateProcessRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateProcessRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createProcess( - request: protos.google.cloud.visionai.v1.ICreateProcessRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateProcessRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createProcess( - request?: protos.google.cloud.visionai.v1.ICreateProcessRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.ICreateProcessRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createProcess response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createProcess request %j', request); - return this.innerApiCalls.createProcess(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createProcess response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `createProcess()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.create_process.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_CreateProcess_async - */ - async checkCreateProcessProgress(name: string): Promise>{ + return this.innerApiCalls + .createProcess(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createProcess response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `createProcess()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.create_process.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_CreateProcess_async + */ + async checkCreateProcessProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Process, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('createProcess long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createProcess, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createProcess, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Process, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single Process. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * Process resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.visionai.v1.Process} request.process - * Required. The resource being updated. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.update_process.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_UpdateProcess_async - */ + /** + * Updates the parameters of a single Process. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * Process resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.visionai.v1.Process} request.process + * Required. The resource being updated. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.update_process.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_UpdateProcess_async + */ updateProcess( - request?: protos.google.cloud.visionai.v1.IUpdateProcessRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateProcessRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateProcess( - request: protos.google.cloud.visionai.v1.IUpdateProcessRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateProcessRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateProcess( - request: protos.google.cloud.visionai.v1.IUpdateProcessRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateProcessRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateProcess( - request?: protos.google.cloud.visionai.v1.IUpdateProcessRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUpdateProcessRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'process.name': request.process!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'process.name': request.process!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateProcess response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateProcess request %j', request); - return this.innerApiCalls.updateProcess(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateProcess response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateProcess(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateProcess response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateProcess()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.update_process.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_UpdateProcess_async - */ - async checkUpdateProcessProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateProcess()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.update_process.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_UpdateProcess_async + */ + async checkUpdateProcessProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Process, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('updateProcess long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateProcess, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateProcess, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Process, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Deletes a single Process. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.delete_process.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_DeleteProcess_async - */ + /** + * Deletes a single Process. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.delete_process.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_DeleteProcess_async + */ deleteProcess( - request?: protos.google.cloud.visionai.v1.IDeleteProcessRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteProcessRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteProcess( - request: protos.google.cloud.visionai.v1.IDeleteProcessRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteProcessRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteProcess( - request: protos.google.cloud.visionai.v1.IDeleteProcessRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteProcessRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteProcess( - request?: protos.google.cloud.visionai.v1.IDeleteProcessRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteProcessRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteProcess response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteProcess request %j', request); - return this.innerApiCalls.deleteProcess(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteProcess response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteProcess(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteProcess response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteProcess()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.delete_process.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_DeleteProcess_async - */ - async checkDeleteProcessProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteProcess()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.delete_process.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_DeleteProcess_async + */ + async checkDeleteProcessProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('deleteProcess long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteProcess, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteProcess, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Run all of the processes to "completion". Max time for each process is - * the LRO time limit. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource shared by all processes being created. - * @param {number[]} request.requests - * Required. The create process requests. - * @param {google.cloud.visionai.v1.BatchRunProcessRequest.BatchRunProcessOptions} [request.options] - * Optional. Options for batch processes. - * @param {string} request.batchId - * Output only. The batch ID. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.batch_run_process.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_BatchRunProcess_async - */ + /** + * Run all of the processes to "completion". Max time for each process is + * the LRO time limit. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource shared by all processes being created. + * @param {number[]} request.requests + * Required. The create process requests. + * @param {google.cloud.visionai.v1.BatchRunProcessRequest.BatchRunProcessOptions} [request.options] + * Optional. Options for batch processes. + * @param {string} request.batchId + * Output only. The batch ID. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.batch_run_process.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_BatchRunProcess_async + */ batchRunProcess( - request?: protos.google.cloud.visionai.v1.IBatchRunProcessRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IBatchRunProcessRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IBatchRunProcessResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; batchRunProcess( - request: protos.google.cloud.visionai.v1.IBatchRunProcessRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IBatchRunProcessRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IBatchRunProcessResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; batchRunProcess( - request: protos.google.cloud.visionai.v1.IBatchRunProcessRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IBatchRunProcessRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IBatchRunProcessResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; batchRunProcess( - request?: protos.google.cloud.visionai.v1.IBatchRunProcessRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IBatchRunProcessRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IBatchRunProcessResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IBatchRunProcessResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IBatchRunProcessResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IBatchRunProcessResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('batchRunProcess response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('batchRunProcess request %j', request); - return this.innerApiCalls.batchRunProcess(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('batchRunProcess response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .batchRunProcess(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IBatchRunProcessResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('batchRunProcess response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `batchRunProcess()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.batch_run_process.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_BatchRunProcess_async - */ - async checkBatchRunProcessProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `batchRunProcess()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.batch_run_process.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_BatchRunProcess_async + */ + async checkBatchRunProcessProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.BatchRunProcessResponse, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('batchRunProcess long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchRunProcess, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * ListPublicOperators returns all the operators in public registry. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListPublicOperatorsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @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 Array of {@link protos.google.cloud.visionai.v1.Operator|Operator}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listPublicOperatorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.batchRunProcess, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.BatchRunProcessResponse, + protos.google.cloud.visionai.v1.OperationMetadata + >; + } + /** + * ListPublicOperators returns all the operators in public registry. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListPublicOperatorsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @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 Array of {@link protos.google.cloud.visionai.v1.Operator|Operator}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listPublicOperatorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listPublicOperators( - request?: protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IOperator[], - protos.google.cloud.visionai.v1.IListPublicOperatorsRequest|null, - protos.google.cloud.visionai.v1.IListPublicOperatorsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IOperator[], + protos.google.cloud.visionai.v1.IListPublicOperatorsRequest | null, + protos.google.cloud.visionai.v1.IListPublicOperatorsResponse, + ] + >; listPublicOperators( - request: protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, - protos.google.cloud.visionai.v1.IListPublicOperatorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IOperator>): void; + request: protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, + | protos.google.cloud.visionai.v1.IListPublicOperatorsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IOperator + >, + ): void; listPublicOperators( - request: protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, - protos.google.cloud.visionai.v1.IListPublicOperatorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IOperator>): void; + request: protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, + | protos.google.cloud.visionai.v1.IListPublicOperatorsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IOperator + >, + ): void; listPublicOperators( - request?: protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, - protos.google.cloud.visionai.v1.IListPublicOperatorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IOperator>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, - protos.google.cloud.visionai.v1.IListPublicOperatorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IOperator>): - Promise<[ - protos.google.cloud.visionai.v1.IOperator[], - protos.google.cloud.visionai.v1.IListPublicOperatorsRequest|null, - protos.google.cloud.visionai.v1.IListPublicOperatorsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListPublicOperatorsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IOperator + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, + | protos.google.cloud.visionai.v1.IListPublicOperatorsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IOperator + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IOperator[], + protos.google.cloud.visionai.v1.IListPublicOperatorsRequest | null, + protos.google.cloud.visionai.v1.IListPublicOperatorsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, - protos.google.cloud.visionai.v1.IListPublicOperatorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IOperator>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, + | protos.google.cloud.visionai.v1.IListPublicOperatorsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IOperator + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listPublicOperators values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2221,204 +3163,227 @@ export class LiveVideoAnalyticsClient { this._log.info('listPublicOperators request %j', request); return this.innerApiCalls .listPublicOperators(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IOperator[], - protos.google.cloud.visionai.v1.IListPublicOperatorsRequest|null, - protos.google.cloud.visionai.v1.IListPublicOperatorsResponse - ]) => { - this._log.info('listPublicOperators values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IOperator[], + protos.google.cloud.visionai.v1.IListPublicOperatorsRequest | null, + protos.google.cloud.visionai.v1.IListPublicOperatorsResponse, + ]) => { + this._log.info('listPublicOperators values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listPublicOperators`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListPublicOperatorsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Operator|Operator} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listPublicOperatorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listPublicOperators`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListPublicOperatorsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Operator|Operator} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listPublicOperatorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listPublicOperatorsStream( - request?: protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listPublicOperators']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listPublicOperators stream %j', request); return this.descriptors.page.listPublicOperators.createStream( this.innerApiCalls.listPublicOperators as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listPublicOperators`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListPublicOperatorsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Operator|Operator}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.list_public_operators.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_ListPublicOperators_async - */ + /** + * Equivalent to `listPublicOperators`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListPublicOperatorsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Operator|Operator}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.list_public_operators.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_ListPublicOperators_async + */ listPublicOperatorsAsync( - request?: protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListPublicOperatorsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listPublicOperators']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listPublicOperators iterate %j', request); return this.descriptors.page.listPublicOperators.asyncIterate( this.innerApiCalls['listPublicOperators'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Operators in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListOperatorsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @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 Array of {@link protos.google.cloud.visionai.v1.Operator|Operator}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listOperatorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Operators in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListOperatorsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @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 Array of {@link protos.google.cloud.visionai.v1.Operator|Operator}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listOperatorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listOperators( - request?: protos.google.cloud.visionai.v1.IListOperatorsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IOperator[], - protos.google.cloud.visionai.v1.IListOperatorsRequest|null, - protos.google.cloud.visionai.v1.IListOperatorsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListOperatorsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IOperator[], + protos.google.cloud.visionai.v1.IListOperatorsRequest | null, + protos.google.cloud.visionai.v1.IListOperatorsResponse, + ] + >; listOperators( - request: protos.google.cloud.visionai.v1.IListOperatorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListOperatorsRequest, - protos.google.cloud.visionai.v1.IListOperatorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IOperator>): void; + request: protos.google.cloud.visionai.v1.IListOperatorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListOperatorsRequest, + protos.google.cloud.visionai.v1.IListOperatorsResponse | null | undefined, + protos.google.cloud.visionai.v1.IOperator + >, + ): void; listOperators( - request: protos.google.cloud.visionai.v1.IListOperatorsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListOperatorsRequest, - protos.google.cloud.visionai.v1.IListOperatorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IOperator>): void; + request: protos.google.cloud.visionai.v1.IListOperatorsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListOperatorsRequest, + protos.google.cloud.visionai.v1.IListOperatorsResponse | null | undefined, + protos.google.cloud.visionai.v1.IOperator + >, + ): void; listOperators( - request?: protos.google.cloud.visionai.v1.IListOperatorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListOperatorsRequest, - protos.google.cloud.visionai.v1.IListOperatorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IOperator>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListOperatorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListOperatorsRequest, - protos.google.cloud.visionai.v1.IListOperatorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IOperator>): - Promise<[ - protos.google.cloud.visionai.v1.IOperator[], - protos.google.cloud.visionai.v1.IListOperatorsRequest|null, - protos.google.cloud.visionai.v1.IListOperatorsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListOperatorsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IOperator + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListOperatorsRequest, + protos.google.cloud.visionai.v1.IListOperatorsResponse | null | undefined, + protos.google.cloud.visionai.v1.IOperator + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IOperator[], + protos.google.cloud.visionai.v1.IListOperatorsRequest | null, + protos.google.cloud.visionai.v1.IListOperatorsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListOperatorsRequest, - protos.google.cloud.visionai.v1.IListOperatorsResponse|null|undefined, - protos.google.cloud.visionai.v1.IOperator>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListOperatorsRequest, + | protos.google.cloud.visionai.v1.IListOperatorsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IOperator + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listOperators values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2427,204 +3392,227 @@ export class LiveVideoAnalyticsClient { this._log.info('listOperators request %j', request); return this.innerApiCalls .listOperators(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IOperator[], - protos.google.cloud.visionai.v1.IListOperatorsRequest|null, - protos.google.cloud.visionai.v1.IListOperatorsResponse - ]) => { - this._log.info('listOperators values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IOperator[], + protos.google.cloud.visionai.v1.IListOperatorsRequest | null, + protos.google.cloud.visionai.v1.IListOperatorsResponse, + ]) => { + this._log.info('listOperators values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listOperators`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListOperatorsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Operator|Operator} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listOperatorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listOperators`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListOperatorsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Operator|Operator} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listOperatorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listOperatorsStream( - request?: protos.google.cloud.visionai.v1.IListOperatorsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListOperatorsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listOperators']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listOperators stream %j', request); return this.descriptors.page.listOperators.createStream( this.innerApiCalls.listOperators as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listOperators`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListOperatorsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Operator|Operator}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.list_operators.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_ListOperators_async - */ + /** + * Equivalent to `listOperators`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListOperatorsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Operator|Operator}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.list_operators.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_ListOperators_async + */ listOperatorsAsync( - request?: protos.google.cloud.visionai.v1.IListOperatorsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListOperatorsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listOperators']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listOperators iterate %j', request); return this.descriptors.page.listOperators.asyncIterate( this.innerApiCalls['listOperators'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Analyses in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListAnalysesRequest - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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 Array of {@link protos.google.cloud.visionai.v1.Analysis|Analysis}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAnalysesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Analyses in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListAnalysesRequest + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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 Array of {@link protos.google.cloud.visionai.v1.Analysis|Analysis}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAnalysesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listAnalyses( - request?: protos.google.cloud.visionai.v1.IListAnalysesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IAnalysis[], - protos.google.cloud.visionai.v1.IListAnalysesRequest|null, - protos.google.cloud.visionai.v1.IListAnalysesResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListAnalysesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAnalysis[], + protos.google.cloud.visionai.v1.IListAnalysesRequest | null, + protos.google.cloud.visionai.v1.IListAnalysesResponse, + ] + >; listAnalyses( - request: protos.google.cloud.visionai.v1.IListAnalysesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListAnalysesRequest, - protos.google.cloud.visionai.v1.IListAnalysesResponse|null|undefined, - protos.google.cloud.visionai.v1.IAnalysis>): void; + request: protos.google.cloud.visionai.v1.IListAnalysesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListAnalysesRequest, + protos.google.cloud.visionai.v1.IListAnalysesResponse | null | undefined, + protos.google.cloud.visionai.v1.IAnalysis + >, + ): void; listAnalyses( - request: protos.google.cloud.visionai.v1.IListAnalysesRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListAnalysesRequest, - protos.google.cloud.visionai.v1.IListAnalysesResponse|null|undefined, - protos.google.cloud.visionai.v1.IAnalysis>): void; + request: protos.google.cloud.visionai.v1.IListAnalysesRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListAnalysesRequest, + protos.google.cloud.visionai.v1.IListAnalysesResponse | null | undefined, + protos.google.cloud.visionai.v1.IAnalysis + >, + ): void; listAnalyses( - request?: protos.google.cloud.visionai.v1.IListAnalysesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListAnalysesRequest, - protos.google.cloud.visionai.v1.IListAnalysesResponse|null|undefined, - protos.google.cloud.visionai.v1.IAnalysis>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListAnalysesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListAnalysesRequest, - protos.google.cloud.visionai.v1.IListAnalysesResponse|null|undefined, - protos.google.cloud.visionai.v1.IAnalysis>): - Promise<[ - protos.google.cloud.visionai.v1.IAnalysis[], - protos.google.cloud.visionai.v1.IListAnalysesRequest|null, - protos.google.cloud.visionai.v1.IListAnalysesResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListAnalysesResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IAnalysis + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListAnalysesRequest, + protos.google.cloud.visionai.v1.IListAnalysesResponse | null | undefined, + protos.google.cloud.visionai.v1.IAnalysis + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAnalysis[], + protos.google.cloud.visionai.v1.IListAnalysesRequest | null, + protos.google.cloud.visionai.v1.IListAnalysesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListAnalysesRequest, - protos.google.cloud.visionai.v1.IListAnalysesResponse|null|undefined, - protos.google.cloud.visionai.v1.IAnalysis>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListAnalysesRequest, + | protos.google.cloud.visionai.v1.IListAnalysesResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IAnalysis + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listAnalyses values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2633,204 +3621,227 @@ export class LiveVideoAnalyticsClient { this._log.info('listAnalyses request %j', request); return this.innerApiCalls .listAnalyses(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IAnalysis[], - protos.google.cloud.visionai.v1.IListAnalysesRequest|null, - protos.google.cloud.visionai.v1.IListAnalysesResponse - ]) => { - this._log.info('listAnalyses values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IAnalysis[], + protos.google.cloud.visionai.v1.IListAnalysesRequest | null, + protos.google.cloud.visionai.v1.IListAnalysesResponse, + ]) => { + this._log.info('listAnalyses values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listAnalyses`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListAnalysesRequest - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Analysis|Analysis} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAnalysesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listAnalyses`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListAnalysesRequest + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Analysis|Analysis} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAnalysesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listAnalysesStream( - request?: protos.google.cloud.visionai.v1.IListAnalysesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListAnalysesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAnalyses']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAnalyses stream %j', request); return this.descriptors.page.listAnalyses.createStream( this.innerApiCalls.listAnalyses as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listAnalyses`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListAnalysesRequest - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Analysis|Analysis}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.list_analyses.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_ListAnalyses_async - */ + /** + * Equivalent to `listAnalyses`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListAnalysesRequest + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Analysis|Analysis}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.list_analyses.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_ListAnalyses_async + */ listAnalysesAsync( - request?: protos.google.cloud.visionai.v1.IListAnalysesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListAnalysesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAnalyses']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAnalyses iterate %j', request); return this.descriptors.page.listAnalyses.asyncIterate( this.innerApiCalls['listAnalyses'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Processes in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListProcessesRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @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 Array of {@link protos.google.cloud.visionai.v1.Process|Process}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listProcessesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Processes in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListProcessesRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @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 Array of {@link protos.google.cloud.visionai.v1.Process|Process}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listProcessesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listProcesses( - request?: protos.google.cloud.visionai.v1.IListProcessesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IProcess[], - protos.google.cloud.visionai.v1.IListProcessesRequest|null, - protos.google.cloud.visionai.v1.IListProcessesResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListProcessesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IProcess[], + protos.google.cloud.visionai.v1.IListProcessesRequest | null, + protos.google.cloud.visionai.v1.IListProcessesResponse, + ] + >; listProcesses( - request: protos.google.cloud.visionai.v1.IListProcessesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListProcessesRequest, - protos.google.cloud.visionai.v1.IListProcessesResponse|null|undefined, - protos.google.cloud.visionai.v1.IProcess>): void; + request: protos.google.cloud.visionai.v1.IListProcessesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListProcessesRequest, + protos.google.cloud.visionai.v1.IListProcessesResponse | null | undefined, + protos.google.cloud.visionai.v1.IProcess + >, + ): void; listProcesses( - request: protos.google.cloud.visionai.v1.IListProcessesRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListProcessesRequest, - protos.google.cloud.visionai.v1.IListProcessesResponse|null|undefined, - protos.google.cloud.visionai.v1.IProcess>): void; + request: protos.google.cloud.visionai.v1.IListProcessesRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListProcessesRequest, + protos.google.cloud.visionai.v1.IListProcessesResponse | null | undefined, + protos.google.cloud.visionai.v1.IProcess + >, + ): void; listProcesses( - request?: protos.google.cloud.visionai.v1.IListProcessesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListProcessesRequest, - protos.google.cloud.visionai.v1.IListProcessesResponse|null|undefined, - protos.google.cloud.visionai.v1.IProcess>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListProcessesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListProcessesRequest, - protos.google.cloud.visionai.v1.IListProcessesResponse|null|undefined, - protos.google.cloud.visionai.v1.IProcess>): - Promise<[ - protos.google.cloud.visionai.v1.IProcess[], - protos.google.cloud.visionai.v1.IListProcessesRequest|null, - protos.google.cloud.visionai.v1.IListProcessesResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListProcessesResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IProcess + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListProcessesRequest, + protos.google.cloud.visionai.v1.IListProcessesResponse | null | undefined, + protos.google.cloud.visionai.v1.IProcess + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IProcess[], + protos.google.cloud.visionai.v1.IListProcessesRequest | null, + protos.google.cloud.visionai.v1.IListProcessesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListProcessesRequest, - protos.google.cloud.visionai.v1.IListProcessesResponse|null|undefined, - protos.google.cloud.visionai.v1.IProcess>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListProcessesRequest, + | protos.google.cloud.visionai.v1.IListProcessesResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IProcess + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listProcesses values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2839,143 +3850,147 @@ export class LiveVideoAnalyticsClient { this._log.info('listProcesses request %j', request); return this.innerApiCalls .listProcesses(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IProcess[], - protos.google.cloud.visionai.v1.IListProcessesRequest|null, - protos.google.cloud.visionai.v1.IListProcessesResponse - ]) => { - this._log.info('listProcesses values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IProcess[], + protos.google.cloud.visionai.v1.IListProcessesRequest | null, + protos.google.cloud.visionai.v1.IListProcessesResponse, + ]) => { + this._log.info('listProcesses values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listProcesses`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListProcessesRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Process|Process} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listProcessesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listProcesses`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListProcessesRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Process|Process} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listProcessesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listProcessesStream( - request?: protos.google.cloud.visionai.v1.IListProcessesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListProcessesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listProcesses']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listProcesses stream %j', request); return this.descriptors.page.listProcesses.createStream( this.innerApiCalls.listProcesses as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listProcesses`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListProcessesRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results - * @param {string} request.orderBy - * Hint for how to order the results - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Process|Process}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/live_video_analytics.list_processes.js - * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_ListProcesses_async - */ + /** + * Equivalent to `listProcesses`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListProcessesRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results + * @param {string} request.orderBy + * Hint for how to order the results + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Process|Process}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/live_video_analytics.list_processes.js + * region_tag:warehouse-visionai_v1_generated_LiveVideoAnalytics_ListProcesses_async + */ listProcessesAsync( - request?: protos.google.cloud.visionai.v1.IListProcessesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListProcessesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listProcesses']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listProcesses iterate %j', request); return this.descriptors.page.listProcesses.asyncIterate( this.innerApiCalls['listProcesses'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + /** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getIamPolicy( request: IamProtos.google.iam.v1.GetIamPolicyRequest, options?: @@ -2989,40 +4004,40 @@ export class LiveVideoAnalyticsClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.getIamPolicy(request, options, callback); } -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ setIamPolicy( request: IamProtos.google.iam.v1.SetIamPolicyRequest, options?: @@ -3036,41 +4051,41 @@ export class LiveVideoAnalyticsClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.setIamPolicy(request, options, callback); } -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ testIamPermissions( request: IamProtos.google.iam.v1.TestIamPermissionsRequest, options?: @@ -3084,12 +4099,12 @@ export class LiveVideoAnalyticsClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -3124,12 +4139,11 @@ export class LiveVideoAnalyticsClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -3162,12 +4176,12 @@ export class LiveVideoAnalyticsClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } -/** + /** * Gets the latest state of a long-running operation. Clients can use this * method to poll the operation result at intervals as recommended by the API * service. @@ -3210,22 +4224,22 @@ export class LiveVideoAnalyticsClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -3260,15 +4274,15 @@ export class LiveVideoAnalyticsClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -3302,7 +4316,7 @@ export class LiveVideoAnalyticsClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -3315,25 +4329,24 @@ export class LiveVideoAnalyticsClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.cancelOperation(request, options, callback); } - /** * Deletes a long-running operation. This method indicates that the client is * no longer interested in the operation result. It does not cancel the @@ -3372,22 +4385,22 @@ export class LiveVideoAnalyticsClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -3404,7 +4417,12 @@ export class LiveVideoAnalyticsClient { * @param {string} analysis * @returns {string} Resource name string. */ - analysisPath(project:string,location:string,cluster:string,analysis:string) { + analysisPath( + project: string, + location: string, + cluster: string, + analysis: string, + ) { return this.pathTemplates.analysisPathTemplate.render({ project: project, location: location, @@ -3467,7 +4485,13 @@ export class LiveVideoAnalyticsClient { * @param {string} annotation * @returns {string} Resource name string. */ - annotationPath(projectNumber:string,location:string,corpus:string,asset:string,annotation:string) { + annotationPath( + projectNumber: string, + location: string, + corpus: string, + asset: string, + annotation: string, + ) { return this.pathTemplates.annotationPathTemplate.render({ project_number: projectNumber, location: location, @@ -3485,7 +4509,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).project_number; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .project_number; } /** @@ -3496,7 +4521,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the location. */ matchLocationFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).location; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .location; } /** @@ -3507,7 +4533,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the corpus. */ matchCorpusFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).corpus; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .corpus; } /** @@ -3518,7 +4545,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the asset. */ matchAssetFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).asset; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .asset; } /** @@ -3529,7 +4557,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the annotation. */ matchAnnotationFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).annotation; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .annotation; } /** @@ -3540,7 +4569,7 @@ export class LiveVideoAnalyticsClient { * @param {string} application * @returns {string} Resource name string. */ - applicationPath(project:string,location:string,application:string) { + applicationPath(project: string, location: string, application: string) { return this.pathTemplates.applicationPathTemplate.render({ project: project, location: location, @@ -3556,7 +4585,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the project. */ matchProjectFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).project; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .project; } /** @@ -3567,7 +4597,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the location. */ matchLocationFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).location; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .location; } /** @@ -3578,7 +4609,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the application. */ matchApplicationFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).application; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .application; } /** @@ -3590,7 +4622,12 @@ export class LiveVideoAnalyticsClient { * @param {string} asset * @returns {string} Resource name string. */ - assetPath(projectNumber:string,location:string,corpus:string,asset:string) { + assetPath( + projectNumber: string, + location: string, + corpus: string, + asset: string, + ) { return this.pathTemplates.assetPathTemplate.render({ project_number: projectNumber, location: location, @@ -3652,7 +4689,12 @@ export class LiveVideoAnalyticsClient { * @param {string} channel * @returns {string} Resource name string. */ - channelPath(project:string,location:string,cluster:string,channel:string) { + channelPath( + project: string, + location: string, + cluster: string, + channel: string, + ) { return this.pathTemplates.channelPathTemplate.render({ project: project, location: location, @@ -3713,7 +4755,7 @@ export class LiveVideoAnalyticsClient { * @param {string} cluster * @returns {string} Resource name string. */ - clusterPath(project:string,location:string,cluster:string) { + clusterPath(project: string, location: string, cluster: string) { return this.pathTemplates.clusterPathTemplate.render({ project: project, location: location, @@ -3763,7 +4805,12 @@ export class LiveVideoAnalyticsClient { * @param {string} collection * @returns {string} Resource name string. */ - collectionPath(projectNumber:string,location:string,corpus:string,collection:string) { + collectionPath( + projectNumber: string, + location: string, + corpus: string, + collection: string, + ) { return this.pathTemplates.collectionPathTemplate.render({ project_number: projectNumber, location: location, @@ -3780,7 +4827,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).project_number; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .project_number; } /** @@ -3791,7 +4839,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the location. */ matchLocationFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).location; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .location; } /** @@ -3802,7 +4851,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the corpus. */ matchCorpusFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).corpus; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .corpus; } /** @@ -3813,7 +4863,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the collection. */ matchCollectionFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).collection; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .collection; } /** @@ -3824,7 +4875,7 @@ export class LiveVideoAnalyticsClient { * @param {string} corpus * @returns {string} Resource name string. */ - corpusPath(projectNumber:string,location:string,corpus:string) { + corpusPath(projectNumber: string, location: string, corpus: string) { return this.pathTemplates.corpusPathTemplate.render({ project_number: projectNumber, location: location, @@ -3840,7 +4891,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromCorpusName(corpusName: string) { - return this.pathTemplates.corpusPathTemplate.match(corpusName).project_number; + return this.pathTemplates.corpusPathTemplate.match(corpusName) + .project_number; } /** @@ -3874,7 +4926,12 @@ export class LiveVideoAnalyticsClient { * @param {string} data_schema * @returns {string} Resource name string. */ - dataSchemaPath(projectNumber:string,location:string,corpus:string,dataSchema:string) { + dataSchemaPath( + projectNumber: string, + location: string, + corpus: string, + dataSchema: string, + ) { return this.pathTemplates.dataSchemaPathTemplate.render({ project_number: projectNumber, location: location, @@ -3891,7 +4948,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).project_number; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .project_number; } /** @@ -3902,7 +4960,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the location. */ matchLocationFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).location; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .location; } /** @@ -3913,7 +4972,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the corpus. */ matchCorpusFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).corpus; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .corpus; } /** @@ -3924,7 +4984,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the data_schema. */ matchDataSchemaFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).data_schema; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .data_schema; } /** @@ -3936,7 +4997,12 @@ export class LiveVideoAnalyticsClient { * @param {string} draft * @returns {string} Resource name string. */ - draftPath(project:string,location:string,application:string,draft:string) { + draftPath( + project: string, + location: string, + application: string, + draft: string, + ) { return this.pathTemplates.draftPathTemplate.render({ project: project, location: location, @@ -3998,7 +5064,7 @@ export class LiveVideoAnalyticsClient { * @param {string} event * @returns {string} Resource name string. */ - eventPath(project:string,location:string,cluster:string,event:string) { + eventPath(project: string, location: string, cluster: string, event: string) { return this.pathTemplates.eventPathTemplate.render({ project: project, location: location, @@ -4060,7 +5126,12 @@ export class LiveVideoAnalyticsClient { * @param {string} index * @returns {string} Resource name string. */ - indexPath(projectNumber:string,location:string,corpus:string,index:string) { + indexPath( + projectNumber: string, + location: string, + corpus: string, + index: string, + ) { return this.pathTemplates.indexPathTemplate.render({ project_number: projectNumber, location: location, @@ -4121,7 +5192,7 @@ export class LiveVideoAnalyticsClient { * @param {string} index_endpoint * @returns {string} Resource name string. */ - indexEndpointPath(project:string,location:string,indexEndpoint:string) { + indexEndpointPath(project: string, location: string, indexEndpoint: string) { return this.pathTemplates.indexEndpointPathTemplate.render({ project: project, location: location, @@ -4137,7 +5208,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the project. */ matchProjectFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).project; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .project; } /** @@ -4148,7 +5220,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the location. */ matchLocationFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).location; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .location; } /** @@ -4159,7 +5232,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the index_endpoint. */ matchIndexEndpointFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).index_endpoint; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .index_endpoint; } /** @@ -4171,7 +5245,12 @@ export class LiveVideoAnalyticsClient { * @param {string} instance * @returns {string} Resource name string. */ - instancePath(project:string,location:string,application:string,instance:string) { + instancePath( + project: string, + location: string, + application: string, + instance: string, + ) { return this.pathTemplates.instancePathTemplate.render({ project: project, location: location, @@ -4210,7 +5289,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the application. */ matchApplicationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).application; + return this.pathTemplates.instancePathTemplate.match(instanceName) + .application; } /** @@ -4231,7 +5311,7 @@ export class LiveVideoAnalyticsClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -4268,7 +5348,7 @@ export class LiveVideoAnalyticsClient { * @param {string} operator * @returns {string} Resource name string. */ - operatorPath(project:string,location:string,operator:string) { + operatorPath(project: string, location: string, operator: string) { return this.pathTemplates.operatorPathTemplate.render({ project: project, location: location, @@ -4318,7 +5398,12 @@ export class LiveVideoAnalyticsClient { * @param {string} process * @returns {string} Resource name string. */ - processPath(project:string,location:string,cluster:string,process:string) { + processPath( + project: string, + location: string, + cluster: string, + process: string, + ) { return this.pathTemplates.processPathTemplate.render({ project: project, location: location, @@ -4379,7 +5464,7 @@ export class LiveVideoAnalyticsClient { * @param {string} processor * @returns {string} Resource name string. */ - processorPath(project:string,location:string,processor:string) { + processorPath(project: string, location: string, processor: string) { return this.pathTemplates.processorPathTemplate.render({ project: project, location: location, @@ -4395,7 +5480,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the project. */ matchProjectFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).project; + return this.pathTemplates.processorPathTemplate.match(processorName) + .project; } /** @@ -4406,7 +5492,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the location. */ matchLocationFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).location; + return this.pathTemplates.processorPathTemplate.match(processorName) + .location; } /** @@ -4417,7 +5504,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the processor. */ matchProcessorFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).processor; + return this.pathTemplates.processorPathTemplate.match(processorName) + .processor; } /** @@ -4429,7 +5517,12 @@ export class LiveVideoAnalyticsClient { * @param {string} search_config * @returns {string} Resource name string. */ - searchConfigPath(projectNumber:string,location:string,corpus:string,searchConfig:string) { + searchConfigPath( + projectNumber: string, + location: string, + corpus: string, + searchConfig: string, + ) { return this.pathTemplates.searchConfigPathTemplate.render({ project_number: projectNumber, location: location, @@ -4446,7 +5539,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).project_number; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .project_number; } /** @@ -4457,7 +5551,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the location. */ matchLocationFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).location; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .location; } /** @@ -4468,7 +5563,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the corpus. */ matchCorpusFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).corpus; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .corpus; } /** @@ -4479,7 +5575,8 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the search_config. */ matchSearchConfigFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).search_config; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .search_config; } /** @@ -4491,7 +5588,12 @@ export class LiveVideoAnalyticsClient { * @param {string} search_hypernym * @returns {string} Resource name string. */ - searchHypernymPath(projectNumber:string,location:string,corpus:string,searchHypernym:string) { + searchHypernymPath( + projectNumber: string, + location: string, + corpus: string, + searchHypernym: string, + ) { return this.pathTemplates.searchHypernymPathTemplate.render({ project_number: projectNumber, location: location, @@ -4508,7 +5610,9 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).project_number; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).project_number; } /** @@ -4519,7 +5623,9 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the location. */ matchLocationFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).location; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).location; } /** @@ -4530,7 +5636,9 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the corpus. */ matchCorpusFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).corpus; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).corpus; } /** @@ -4541,7 +5649,9 @@ export class LiveVideoAnalyticsClient { * @returns {string} A string representing the search_hypernym. */ matchSearchHypernymFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).search_hypernym; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).search_hypernym; } /** @@ -4553,7 +5663,12 @@ export class LiveVideoAnalyticsClient { * @param {string} series * @returns {string} Resource name string. */ - seriesPath(project:string,location:string,cluster:string,series:string) { + seriesPath( + project: string, + location: string, + cluster: string, + series: string, + ) { return this.pathTemplates.seriesPathTemplate.render({ project: project, location: location, @@ -4615,7 +5730,12 @@ export class LiveVideoAnalyticsClient { * @param {string} stream * @returns {string} Resource name string. */ - streamPath(project:string,location:string,cluster:string,stream:string) { + streamPath( + project: string, + location: string, + cluster: string, + stream: string, + ) { return this.pathTemplates.streamPathTemplate.render({ project: project, location: location, @@ -4676,15 +5796,19 @@ export class LiveVideoAnalyticsClient { */ close(): Promise { if (this.liveVideoAnalyticsStub && !this._terminated) { - return this.liveVideoAnalyticsStub.then(stub => { + return this.liveVideoAnalyticsStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-visionai/src/v1/streaming_service_client.ts b/packages/google-cloud-visionai/src/v1/streaming_service_client.ts index 22266b828778..7de6d35b0f5a 100644 --- a/packages/google-cloud-visionai/src/v1/streaming_service_client.ts +++ b/packages/google-cloud-visionai/src/v1/streaming_service_client.ts @@ -18,11 +18,20 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {PassThrough} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { PassThrough } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +53,7 @@ export class StreamingServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('visionai'); @@ -57,11 +66,11 @@ export class StreamingServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - streamingServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + streamingServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of StreamingServiceClient. @@ -102,21 +111,42 @@ export class StreamingServiceClient { * const client = new StreamingServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof StreamingServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'warehouse-visionai.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -141,7 +171,7 @@ export class StreamingServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,18 +184,14 @@ export class StreamingServiceClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -187,82 +213,97 @@ export class StreamingServiceClient { // Create useful helper objects for these. this.pathTemplates = { analysisPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/analyses/{analysis}' + 'projects/{project}/locations/{location}/clusters/{cluster}/analyses/{analysis}', ), annotationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}', ), applicationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}' + 'projects/{project}/locations/{location}/applications/{application}', ), assetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}', ), channelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/channels/{channel}' + 'projects/{project}/locations/{location}/clusters/{cluster}/channels/{channel}', ), clusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}' + 'projects/{project}/locations/{location}/clusters/{cluster}', ), collectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}', ), corpusPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}', ), dataSchemaPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}', ), draftPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}/drafts/{draft}' + 'projects/{project}/locations/{location}/applications/{application}/drafts/{draft}', ), eventPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/events/{event}' + 'projects/{project}/locations/{location}/clusters/{cluster}/events/{event}', ), indexPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}', ), indexEndpointPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}' + 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}', ), instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}/instances/{instance}' + 'projects/{project}/locations/{location}/applications/{application}/instances/{instance}', ), operatorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/operators/{operator}' + 'projects/{project}/locations/{location}/operators/{operator}', ), processPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/processes/{process}' + 'projects/{project}/locations/{location}/clusters/{cluster}/processes/{process}', ), processorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/processors/{processor}' + 'projects/{project}/locations/{location}/processors/{processor}', ), searchConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}', ), searchHypernymPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}', ), seriesPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/series/{series}' + 'projects/{project}/locations/{location}/clusters/{cluster}/series/{series}', ), streamPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/streams/{stream}' + 'projects/{project}/locations/{location}/clusters/{cluster}/streams/{stream}', ), }; // Some of the methods on this service provide streaming responses. // Provide descriptors for these. this.descriptors.stream = { - sendPackets: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries), - receivePackets: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries), - receiveEvents: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) + sendPackets: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + !!opts.fallback, + !!opts.gaxServerStreamingRetries, + ), + receivePackets: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + !!opts.fallback, + !!opts.gaxServerStreamingRetries, + ), + receiveEvents: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + !!opts.fallback, + !!opts.gaxServerStreamingRetries, + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.visionai.v1.StreamingService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.visionai.v1.StreamingService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -293,44 +334,59 @@ export class StreamingServiceClient { // Put together the "service stub" for // google.cloud.visionai.v1.StreamingService. this.streamingServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.visionai.v1.StreamingService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.visionai.v1.StreamingService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.visionai.v1.StreamingService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const streamingServiceStubMethods = - ['sendPackets', 'receivePackets', 'receiveEvents', 'acquireLease', 'renewLease', 'releaseLease']; + const streamingServiceStubMethods = [ + 'sendPackets', + 'receivePackets', + 'receiveEvents', + 'acquireLease', + 'renewLease', + 'releaseLease', + ]; for (const methodName of streamingServiceStubMethods) { const callPromise = this.streamingServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough({ objectMode: true }); + setImmediate(() => { + stream.emit( + 'error', + new this._gaxModule.GoogleError( + 'The client has already been closed.', + ), + ); + }); + return stream; + } + return Promise.reject('The client has already been closed.'); } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.stream[methodName] || - undefined; + const descriptor = this.descriptors.stream[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -345,8 +401,14 @@ export class StreamingServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'warehouse-visionai.googleapis.com'; } @@ -357,8 +419,14 @@ export class StreamingServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'warehouse-visionai.googleapis.com'; } @@ -389,9 +457,7 @@ export class StreamingServiceClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -400,8 +466,9 @@ export class StreamingServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -412,396 +479,494 @@ export class StreamingServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * AcquireLease acquires a lease. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.series - * The series name. - * @param {string} request.owner - * The owner name. - * @param {google.protobuf.Duration} request.term - * The lease term. - * @param {google.cloud.visionai.v1.LeaseType} request.leaseType - * The lease type. - * @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 protos.google.cloud.visionai.v1.Lease|Lease}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streaming_service.acquire_lease.js - * region_tag:warehouse-visionai_v1_generated_StreamingService_AcquireLease_async - */ + /** + * AcquireLease acquires a lease. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.series + * The series name. + * @param {string} request.owner + * The owner name. + * @param {google.protobuf.Duration} request.term + * The lease term. + * @param {google.cloud.visionai.v1.LeaseType} request.leaseType + * The lease type. + * @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 protos.google.cloud.visionai.v1.Lease|Lease}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streaming_service.acquire_lease.js + * region_tag:warehouse-visionai_v1_generated_StreamingService_AcquireLease_async + */ acquireLease( - request?: protos.google.cloud.visionai.v1.IAcquireLeaseRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IAcquireLeaseRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IAcquireLeaseRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ILease, + protos.google.cloud.visionai.v1.IAcquireLeaseRequest | undefined, + {} | undefined, + ] + >; acquireLease( - request: protos.google.cloud.visionai.v1.IAcquireLeaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IAcquireLeaseRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IAcquireLeaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.ILease, + protos.google.cloud.visionai.v1.IAcquireLeaseRequest | null | undefined, + {} | null | undefined + >, + ): void; acquireLease( - request: protos.google.cloud.visionai.v1.IAcquireLeaseRequest, - callback: Callback< - protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IAcquireLeaseRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IAcquireLeaseRequest, + callback: Callback< + protos.google.cloud.visionai.v1.ILease, + protos.google.cloud.visionai.v1.IAcquireLeaseRequest | null | undefined, + {} | null | undefined + >, + ): void; acquireLease( - request?: protos.google.cloud.visionai.v1.IAcquireLeaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IAcquireLeaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IAcquireLeaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IAcquireLeaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IAcquireLeaseRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IAcquireLeaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.ILease, + protos.google.cloud.visionai.v1.IAcquireLeaseRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ILease, + protos.google.cloud.visionai.v1.IAcquireLeaseRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'series': request.series ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + series: request.series ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('acquireLease request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IAcquireLeaseRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.ILease, + | protos.google.cloud.visionai.v1.IAcquireLeaseRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('acquireLease response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.acquireLease(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IAcquireLeaseRequest|undefined, - {}|undefined - ]) => { - this._log.info('acquireLease response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .acquireLease(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.ILease, + protos.google.cloud.visionai.v1.IAcquireLeaseRequest | undefined, + {} | undefined, + ]) => { + this._log.info('acquireLease response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * RenewLease renews a lease. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.id - * Lease id. - * @param {string} request.series - * Series name. - * @param {string} request.owner - * Lease owner. - * @param {google.protobuf.Duration} request.term - * Lease term. - * @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 protos.google.cloud.visionai.v1.Lease|Lease}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streaming_service.renew_lease.js - * region_tag:warehouse-visionai_v1_generated_StreamingService_RenewLease_async - */ + /** + * RenewLease renews a lease. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.id + * Lease id. + * @param {string} request.series + * Series name. + * @param {string} request.owner + * Lease owner. + * @param {google.protobuf.Duration} request.term + * Lease term. + * @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 protos.google.cloud.visionai.v1.Lease|Lease}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streaming_service.renew_lease.js + * region_tag:warehouse-visionai_v1_generated_StreamingService_RenewLease_async + */ renewLease( - request?: protos.google.cloud.visionai.v1.IRenewLeaseRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IRenewLeaseRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IRenewLeaseRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ILease, + protos.google.cloud.visionai.v1.IRenewLeaseRequest | undefined, + {} | undefined, + ] + >; renewLease( - request: protos.google.cloud.visionai.v1.IRenewLeaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IRenewLeaseRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IRenewLeaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.ILease, + protos.google.cloud.visionai.v1.IRenewLeaseRequest | null | undefined, + {} | null | undefined + >, + ): void; renewLease( - request: protos.google.cloud.visionai.v1.IRenewLeaseRequest, - callback: Callback< - protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IRenewLeaseRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IRenewLeaseRequest, + callback: Callback< + protos.google.cloud.visionai.v1.ILease, + protos.google.cloud.visionai.v1.IRenewLeaseRequest | null | undefined, + {} | null | undefined + >, + ): void; renewLease( - request?: protos.google.cloud.visionai.v1.IRenewLeaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IRenewLeaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IRenewLeaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IRenewLeaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IRenewLeaseRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.visionai.v1.IRenewLeaseRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.ILease, + protos.google.cloud.visionai.v1.IRenewLeaseRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ILease, + protos.google.cloud.visionai.v1.IRenewLeaseRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'series': request.series ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + series: request.series ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('renewLease request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IRenewLeaseRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.ILease, + protos.google.cloud.visionai.v1.IRenewLeaseRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('renewLease response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.renewLease(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.ILease, - protos.google.cloud.visionai.v1.IRenewLeaseRequest|undefined, - {}|undefined - ]) => { - this._log.info('renewLease response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .renewLease(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.ILease, + protos.google.cloud.visionai.v1.IRenewLeaseRequest | undefined, + {} | undefined, + ]) => { + this._log.info('renewLease response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * RleaseLease releases a lease. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.id - * Lease id. - * @param {string} request.series - * Series name. - * @param {string} request.owner - * Lease owner. - * @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 protos.google.cloud.visionai.v1.ReleaseLeaseResponse|ReleaseLeaseResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streaming_service.release_lease.js - * region_tag:warehouse-visionai_v1_generated_StreamingService_ReleaseLease_async - */ + /** + * RleaseLease releases a lease. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.id + * Lease id. + * @param {string} request.series + * Series name. + * @param {string} request.owner + * Lease owner. + * @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 protos.google.cloud.visionai.v1.ReleaseLeaseResponse|ReleaseLeaseResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streaming_service.release_lease.js + * region_tag:warehouse-visionai_v1_generated_StreamingService_ReleaseLease_async + */ releaseLease( - request?: protos.google.cloud.visionai.v1.IReleaseLeaseRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IReleaseLeaseResponse, - protos.google.cloud.visionai.v1.IReleaseLeaseRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IReleaseLeaseRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IReleaseLeaseResponse, + protos.google.cloud.visionai.v1.IReleaseLeaseRequest | undefined, + {} | undefined, + ] + >; releaseLease( - request: protos.google.cloud.visionai.v1.IReleaseLeaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IReleaseLeaseResponse, - protos.google.cloud.visionai.v1.IReleaseLeaseRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IReleaseLeaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IReleaseLeaseResponse, + protos.google.cloud.visionai.v1.IReleaseLeaseRequest | null | undefined, + {} | null | undefined + >, + ): void; releaseLease( - request: protos.google.cloud.visionai.v1.IReleaseLeaseRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IReleaseLeaseResponse, - protos.google.cloud.visionai.v1.IReleaseLeaseRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IReleaseLeaseRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IReleaseLeaseResponse, + protos.google.cloud.visionai.v1.IReleaseLeaseRequest | null | undefined, + {} | null | undefined + >, + ): void; releaseLease( - request?: protos.google.cloud.visionai.v1.IReleaseLeaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IReleaseLeaseResponse, - protos.google.cloud.visionai.v1.IReleaseLeaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IReleaseLeaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IReleaseLeaseResponse, - protos.google.cloud.visionai.v1.IReleaseLeaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IReleaseLeaseResponse, - protos.google.cloud.visionai.v1.IReleaseLeaseRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IReleaseLeaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IReleaseLeaseResponse, + protos.google.cloud.visionai.v1.IReleaseLeaseRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IReleaseLeaseResponse, + protos.google.cloud.visionai.v1.IReleaseLeaseRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'series': request.series ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + series: request.series ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('releaseLease request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IReleaseLeaseResponse, - protos.google.cloud.visionai.v1.IReleaseLeaseRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IReleaseLeaseResponse, + | protos.google.cloud.visionai.v1.IReleaseLeaseRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('releaseLease response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.releaseLease(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IReleaseLeaseResponse, - protos.google.cloud.visionai.v1.IReleaseLeaseRequest|undefined, - {}|undefined - ]) => { - this._log.info('releaseLease response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .releaseLease(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IReleaseLeaseResponse, + protos.google.cloud.visionai.v1.IReleaseLeaseRequest | undefined, + {} | undefined, + ]) => { + this._log.info('releaseLease response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Send packets to the series. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which is both readable and writable. It accepts objects - * representing {@link protos.google.cloud.visionai.v1.SendPacketsRequest|SendPacketsRequest} for write() method, and - * will emit objects representing {@link protos.google.cloud.visionai.v1.SendPacketsResponse|SendPacketsResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streaming_service.send_packets.js - * region_tag:warehouse-visionai_v1_generated_StreamingService_SendPackets_async - */ - sendPackets( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); + /** + * Send packets to the series. + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.cloud.visionai.v1.SendPacketsRequest|SendPacketsRequest} for write() method, and + * will emit objects representing {@link protos.google.cloud.visionai.v1.SendPacketsResponse|SendPacketsResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streaming_service.send_packets.js + * region_tag:warehouse-visionai_v1_generated_StreamingService_SendPackets_async + */ + sendPackets(options?: CallOptions): gax.CancellableStream { + this.initialize().catch((err) => { + throw err; + }); this._log.info('sendPackets stream %j', options); return this.innerApiCalls.sendPackets(null, options); } -/** - * Receive packets from the series. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which is both readable and writable. It accepts objects - * representing {@link protos.google.cloud.visionai.v1.ReceivePacketsRequest|ReceivePacketsRequest} for write() method, and - * will emit objects representing {@link protos.google.cloud.visionai.v1.ReceivePacketsResponse|ReceivePacketsResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streaming_service.receive_packets.js - * region_tag:warehouse-visionai_v1_generated_StreamingService_ReceivePackets_async - */ - receivePackets( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); + /** + * Receive packets from the series. + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.cloud.visionai.v1.ReceivePacketsRequest|ReceivePacketsRequest} for write() method, and + * will emit objects representing {@link protos.google.cloud.visionai.v1.ReceivePacketsResponse|ReceivePacketsResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streaming_service.receive_packets.js + * region_tag:warehouse-visionai_v1_generated_StreamingService_ReceivePackets_async + */ + receivePackets(options?: CallOptions): gax.CancellableStream { + this.initialize().catch((err) => { + throw err; + }); this._log.info('receivePackets stream %j', options); return this.innerApiCalls.receivePackets(null, options); } -/** - * Receive events given the stream name. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which is both readable and writable. It accepts objects - * representing {@link protos.google.cloud.visionai.v1.ReceiveEventsRequest|ReceiveEventsRequest} for write() method, and - * will emit objects representing {@link protos.google.cloud.visionai.v1.ReceiveEventsResponse|ReceiveEventsResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streaming_service.receive_events.js - * region_tag:warehouse-visionai_v1_generated_StreamingService_ReceiveEvents_async - */ - receiveEvents( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); + /** + * Receive events given the stream name. + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.cloud.visionai.v1.ReceiveEventsRequest|ReceiveEventsRequest} for write() method, and + * will emit objects representing {@link protos.google.cloud.visionai.v1.ReceiveEventsResponse|ReceiveEventsResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streaming_service.receive_events.js + * region_tag:warehouse-visionai_v1_generated_StreamingService_ReceiveEvents_async + */ + receiveEvents(options?: CallOptions): gax.CancellableStream { + this.initialize().catch((err) => { + throw err; + }); this._log.info('receiveEvents stream %j', options); return this.innerApiCalls.receiveEvents(null, options); } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + /** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getIamPolicy( request: IamProtos.google.iam.v1.GetIamPolicyRequest, options?: @@ -815,40 +980,40 @@ export class StreamingServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.getIamPolicy(request, options, callback); } -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ setIamPolicy( request: IamProtos.google.iam.v1.SetIamPolicyRequest, options?: @@ -862,41 +1027,41 @@ export class StreamingServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.setIamPolicy(request, options, callback); } -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ testIamPermissions( request: IamProtos.google.iam.v1.TestIamPermissionsRequest, options?: @@ -910,12 +1075,12 @@ export class StreamingServiceClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -950,12 +1115,11 @@ export class StreamingServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -988,7 +1152,7 @@ export class StreamingServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -1006,7 +1170,12 @@ export class StreamingServiceClient { * @param {string} analysis * @returns {string} Resource name string. */ - analysisPath(project:string,location:string,cluster:string,analysis:string) { + analysisPath( + project: string, + location: string, + cluster: string, + analysis: string, + ) { return this.pathTemplates.analysisPathTemplate.render({ project: project, location: location, @@ -1069,7 +1238,13 @@ export class StreamingServiceClient { * @param {string} annotation * @returns {string} Resource name string. */ - annotationPath(projectNumber:string,location:string,corpus:string,asset:string,annotation:string) { + annotationPath( + projectNumber: string, + location: string, + corpus: string, + asset: string, + annotation: string, + ) { return this.pathTemplates.annotationPathTemplate.render({ project_number: projectNumber, location: location, @@ -1087,7 +1262,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).project_number; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .project_number; } /** @@ -1098,7 +1274,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).location; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .location; } /** @@ -1109,7 +1286,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).corpus; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .corpus; } /** @@ -1120,7 +1298,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the asset. */ matchAssetFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).asset; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .asset; } /** @@ -1131,7 +1310,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the annotation. */ matchAnnotationFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).annotation; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .annotation; } /** @@ -1142,7 +1322,7 @@ export class StreamingServiceClient { * @param {string} application * @returns {string} Resource name string. */ - applicationPath(project:string,location:string,application:string) { + applicationPath(project: string, location: string, application: string) { return this.pathTemplates.applicationPathTemplate.render({ project: project, location: location, @@ -1158,7 +1338,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the project. */ matchProjectFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).project; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .project; } /** @@ -1169,7 +1350,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the location. */ matchLocationFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).location; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .location; } /** @@ -1180,7 +1362,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the application. */ matchApplicationFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).application; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .application; } /** @@ -1192,7 +1375,12 @@ export class StreamingServiceClient { * @param {string} asset * @returns {string} Resource name string. */ - assetPath(projectNumber:string,location:string,corpus:string,asset:string) { + assetPath( + projectNumber: string, + location: string, + corpus: string, + asset: string, + ) { return this.pathTemplates.assetPathTemplate.render({ project_number: projectNumber, location: location, @@ -1254,7 +1442,12 @@ export class StreamingServiceClient { * @param {string} channel * @returns {string} Resource name string. */ - channelPath(project:string,location:string,cluster:string,channel:string) { + channelPath( + project: string, + location: string, + cluster: string, + channel: string, + ) { return this.pathTemplates.channelPathTemplate.render({ project: project, location: location, @@ -1315,7 +1508,7 @@ export class StreamingServiceClient { * @param {string} cluster * @returns {string} Resource name string. */ - clusterPath(project:string,location:string,cluster:string) { + clusterPath(project: string, location: string, cluster: string) { return this.pathTemplates.clusterPathTemplate.render({ project: project, location: location, @@ -1365,7 +1558,12 @@ export class StreamingServiceClient { * @param {string} collection * @returns {string} Resource name string. */ - collectionPath(projectNumber:string,location:string,corpus:string,collection:string) { + collectionPath( + projectNumber: string, + location: string, + corpus: string, + collection: string, + ) { return this.pathTemplates.collectionPathTemplate.render({ project_number: projectNumber, location: location, @@ -1382,7 +1580,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).project_number; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .project_number; } /** @@ -1393,7 +1592,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the location. */ matchLocationFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).location; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .location; } /** @@ -1404,7 +1604,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).corpus; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .corpus; } /** @@ -1415,7 +1616,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the collection. */ matchCollectionFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).collection; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .collection; } /** @@ -1426,7 +1628,7 @@ export class StreamingServiceClient { * @param {string} corpus * @returns {string} Resource name string. */ - corpusPath(projectNumber:string,location:string,corpus:string) { + corpusPath(projectNumber: string, location: string, corpus: string) { return this.pathTemplates.corpusPathTemplate.render({ project_number: projectNumber, location: location, @@ -1442,7 +1644,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromCorpusName(corpusName: string) { - return this.pathTemplates.corpusPathTemplate.match(corpusName).project_number; + return this.pathTemplates.corpusPathTemplate.match(corpusName) + .project_number; } /** @@ -1476,7 +1679,12 @@ export class StreamingServiceClient { * @param {string} data_schema * @returns {string} Resource name string. */ - dataSchemaPath(projectNumber:string,location:string,corpus:string,dataSchema:string) { + dataSchemaPath( + projectNumber: string, + location: string, + corpus: string, + dataSchema: string, + ) { return this.pathTemplates.dataSchemaPathTemplate.render({ project_number: projectNumber, location: location, @@ -1493,7 +1701,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).project_number; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .project_number; } /** @@ -1504,7 +1713,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the location. */ matchLocationFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).location; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .location; } /** @@ -1515,7 +1725,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).corpus; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .corpus; } /** @@ -1526,7 +1737,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the data_schema. */ matchDataSchemaFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).data_schema; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .data_schema; } /** @@ -1538,7 +1750,12 @@ export class StreamingServiceClient { * @param {string} draft * @returns {string} Resource name string. */ - draftPath(project:string,location:string,application:string,draft:string) { + draftPath( + project: string, + location: string, + application: string, + draft: string, + ) { return this.pathTemplates.draftPathTemplate.render({ project: project, location: location, @@ -1600,7 +1817,7 @@ export class StreamingServiceClient { * @param {string} event * @returns {string} Resource name string. */ - eventPath(project:string,location:string,cluster:string,event:string) { + eventPath(project: string, location: string, cluster: string, event: string) { return this.pathTemplates.eventPathTemplate.render({ project: project, location: location, @@ -1662,7 +1879,12 @@ export class StreamingServiceClient { * @param {string} index * @returns {string} Resource name string. */ - indexPath(projectNumber:string,location:string,corpus:string,index:string) { + indexPath( + projectNumber: string, + location: string, + corpus: string, + index: string, + ) { return this.pathTemplates.indexPathTemplate.render({ project_number: projectNumber, location: location, @@ -1723,7 +1945,7 @@ export class StreamingServiceClient { * @param {string} index_endpoint * @returns {string} Resource name string. */ - indexEndpointPath(project:string,location:string,indexEndpoint:string) { + indexEndpointPath(project: string, location: string, indexEndpoint: string) { return this.pathTemplates.indexEndpointPathTemplate.render({ project: project, location: location, @@ -1739,7 +1961,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the project. */ matchProjectFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).project; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .project; } /** @@ -1750,7 +1973,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the location. */ matchLocationFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).location; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .location; } /** @@ -1761,7 +1985,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the index_endpoint. */ matchIndexEndpointFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).index_endpoint; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .index_endpoint; } /** @@ -1773,7 +1998,12 @@ export class StreamingServiceClient { * @param {string} instance * @returns {string} Resource name string. */ - instancePath(project:string,location:string,application:string,instance:string) { + instancePath( + project: string, + location: string, + application: string, + instance: string, + ) { return this.pathTemplates.instancePathTemplate.render({ project: project, location: location, @@ -1812,7 +2042,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the application. */ matchApplicationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).application; + return this.pathTemplates.instancePathTemplate.match(instanceName) + .application; } /** @@ -1834,7 +2065,7 @@ export class StreamingServiceClient { * @param {string} operator * @returns {string} Resource name string. */ - operatorPath(project:string,location:string,operator:string) { + operatorPath(project: string, location: string, operator: string) { return this.pathTemplates.operatorPathTemplate.render({ project: project, location: location, @@ -1884,7 +2115,12 @@ export class StreamingServiceClient { * @param {string} process * @returns {string} Resource name string. */ - processPath(project:string,location:string,cluster:string,process:string) { + processPath( + project: string, + location: string, + cluster: string, + process: string, + ) { return this.pathTemplates.processPathTemplate.render({ project: project, location: location, @@ -1945,7 +2181,7 @@ export class StreamingServiceClient { * @param {string} processor * @returns {string} Resource name string. */ - processorPath(project:string,location:string,processor:string) { + processorPath(project: string, location: string, processor: string) { return this.pathTemplates.processorPathTemplate.render({ project: project, location: location, @@ -1961,7 +2197,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).project; + return this.pathTemplates.processorPathTemplate.match(processorName) + .project; } /** @@ -1972,7 +2209,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the location. */ matchLocationFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).location; + return this.pathTemplates.processorPathTemplate.match(processorName) + .location; } /** @@ -1983,7 +2221,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the processor. */ matchProcessorFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).processor; + return this.pathTemplates.processorPathTemplate.match(processorName) + .processor; } /** @@ -1995,7 +2234,12 @@ export class StreamingServiceClient { * @param {string} search_config * @returns {string} Resource name string. */ - searchConfigPath(projectNumber:string,location:string,corpus:string,searchConfig:string) { + searchConfigPath( + projectNumber: string, + location: string, + corpus: string, + searchConfig: string, + ) { return this.pathTemplates.searchConfigPathTemplate.render({ project_number: projectNumber, location: location, @@ -2012,7 +2256,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).project_number; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .project_number; } /** @@ -2023,7 +2268,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the location. */ matchLocationFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).location; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .location; } /** @@ -2034,7 +2280,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).corpus; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .corpus; } /** @@ -2045,7 +2292,8 @@ export class StreamingServiceClient { * @returns {string} A string representing the search_config. */ matchSearchConfigFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).search_config; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .search_config; } /** @@ -2057,7 +2305,12 @@ export class StreamingServiceClient { * @param {string} search_hypernym * @returns {string} Resource name string. */ - searchHypernymPath(projectNumber:string,location:string,corpus:string,searchHypernym:string) { + searchHypernymPath( + projectNumber: string, + location: string, + corpus: string, + searchHypernym: string, + ) { return this.pathTemplates.searchHypernymPathTemplate.render({ project_number: projectNumber, location: location, @@ -2074,7 +2327,9 @@ export class StreamingServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).project_number; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).project_number; } /** @@ -2085,7 +2340,9 @@ export class StreamingServiceClient { * @returns {string} A string representing the location. */ matchLocationFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).location; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).location; } /** @@ -2096,7 +2353,9 @@ export class StreamingServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).corpus; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).corpus; } /** @@ -2107,7 +2366,9 @@ export class StreamingServiceClient { * @returns {string} A string representing the search_hypernym. */ matchSearchHypernymFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).search_hypernym; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).search_hypernym; } /** @@ -2119,7 +2380,12 @@ export class StreamingServiceClient { * @param {string} series * @returns {string} Resource name string. */ - seriesPath(project:string,location:string,cluster:string,series:string) { + seriesPath( + project: string, + location: string, + cluster: string, + series: string, + ) { return this.pathTemplates.seriesPathTemplate.render({ project: project, location: location, @@ -2181,7 +2447,12 @@ export class StreamingServiceClient { * @param {string} stream * @returns {string} Resource name string. */ - streamPath(project:string,location:string,cluster:string,stream:string) { + streamPath( + project: string, + location: string, + cluster: string, + stream: string, + ) { return this.pathTemplates.streamPathTemplate.render({ project: project, location: location, @@ -2242,14 +2513,18 @@ export class StreamingServiceClient { */ close(): Promise { if (this.streamingServiceStub && !this._terminated) { - return this.streamingServiceStub.then(stub => { + return this.streamingServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-visionai/src/v1/streams_service_client.ts b/packages/google-cloud-visionai/src/v1/streams_service_client.ts index 7516d9e8974b..819e164ca932 100644 --- a/packages/google-cloud-visionai/src/v1/streams_service_client.ts +++ b/packages/google-cloud-visionai/src/v1/streams_service_client.ts @@ -18,11 +18,24 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -47,7 +60,7 @@ export class StreamsServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('visionai'); @@ -60,12 +73,12 @@ export class StreamsServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - streamsServiceStub?: Promise<{[name: string]: Function}>; + streamsServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of StreamsServiceClient. @@ -106,21 +119,42 @@ export class StreamsServiceClient { * const client = new StreamsServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof StreamsServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'warehouse-visionai.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -145,7 +179,7 @@ export class StreamsServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -158,18 +192,14 @@ export class StreamsServiceClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -191,73 +221,73 @@ export class StreamsServiceClient { // Create useful helper objects for these. this.pathTemplates = { analysisPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/analyses/{analysis}' + 'projects/{project}/locations/{location}/clusters/{cluster}/analyses/{analysis}', ), annotationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}', ), applicationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}' + 'projects/{project}/locations/{location}/applications/{application}', ), assetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}', ), channelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/channels/{channel}' + 'projects/{project}/locations/{location}/clusters/{cluster}/channels/{channel}', ), clusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}' + 'projects/{project}/locations/{location}/clusters/{cluster}', ), collectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}', ), corpusPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}', ), dataSchemaPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}', ), draftPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}/drafts/{draft}' + 'projects/{project}/locations/{location}/applications/{application}/drafts/{draft}', ), eventPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/events/{event}' + 'projects/{project}/locations/{location}/clusters/{cluster}/events/{event}', ), indexPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}', ), indexEndpointPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}' + 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}', ), instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}/instances/{instance}' + 'projects/{project}/locations/{location}/applications/{application}/instances/{instance}', ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), operatorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/operators/{operator}' + 'projects/{project}/locations/{location}/operators/{operator}', ), processPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/processes/{process}' + 'projects/{project}/locations/{location}/clusters/{cluster}/processes/{process}', ), processorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/processors/{processor}' + 'projects/{project}/locations/{location}/processors/{processor}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), searchConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}', ), searchHypernymPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}', ), seriesPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/series/{series}' + 'projects/{project}/locations/{location}/clusters/{cluster}/series/{series}', ), streamPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/streams/{stream}' + 'projects/{project}/locations/{location}/clusters/{cluster}/streams/{stream}', ), }; @@ -265,14 +295,26 @@ export class StreamsServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listClusters: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'clusters'), - listStreams: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'streams'), - listEvents: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'events'), - listSeries: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'series') + listClusters: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'clusters', + ), + listStreams: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'streams', + ), + listEvents: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'events', + ), + listSeries: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'series', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -281,134 +323,225 @@ export class StreamsServiceClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/warehouseOperations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/assets/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/collections/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/imageIndexes/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/indexes/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { get: '/v1/{name=projects/*/locations/*/warehouseOperations/*}' }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/assets/*/operations/*}', + }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/collections/*/operations/*}', + }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/imageIndexes/*/operations/*}', + }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/indexes/*/operations/*}', + }, + { get: '/v1/{name=projects/*/locations/*/corpora/*/operations/*}' }, + { + get: '/v1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createClusterResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Cluster') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Cluster', + ) as gax.protobuf.Type; const createClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateClusterResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Cluster') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Cluster', + ) as gax.protobuf.Type; const updateClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteClusterResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const createStreamResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Stream') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Stream', + ) as gax.protobuf.Type; const createStreamMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateStreamResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Stream') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Stream', + ) as gax.protobuf.Type; const updateStreamMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteStreamResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteStreamMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const getStreamThumbnailResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.GetStreamThumbnailResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.GetStreamThumbnailResponse', + ) as gax.protobuf.Type; const getStreamThumbnailMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const createEventResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Event') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Event', + ) as gax.protobuf.Type; const createEventMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateEventResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Event') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Event', + ) as gax.protobuf.Type; const updateEventMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteEventResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteEventMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const createSeriesResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Series') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Series', + ) as gax.protobuf.Type; const createSeriesMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateSeriesResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Series') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Series', + ) as gax.protobuf.Type; const updateSeriesMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteSeriesResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteSeriesMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; const materializeChannelResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Channel') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Channel', + ) as gax.protobuf.Type; const materializeChannelMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createCluster: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createClusterResponse.decode.bind(createClusterResponse), - createClusterMetadata.decode.bind(createClusterMetadata)), + createClusterMetadata.decode.bind(createClusterMetadata), + ), updateCluster: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateClusterResponse.decode.bind(updateClusterResponse), - updateClusterMetadata.decode.bind(updateClusterMetadata)), + updateClusterMetadata.decode.bind(updateClusterMetadata), + ), deleteCluster: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteClusterResponse.decode.bind(deleteClusterResponse), - deleteClusterMetadata.decode.bind(deleteClusterMetadata)), + deleteClusterMetadata.decode.bind(deleteClusterMetadata), + ), createStream: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createStreamResponse.decode.bind(createStreamResponse), - createStreamMetadata.decode.bind(createStreamMetadata)), + createStreamMetadata.decode.bind(createStreamMetadata), + ), updateStream: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateStreamResponse.decode.bind(updateStreamResponse), - updateStreamMetadata.decode.bind(updateStreamMetadata)), + updateStreamMetadata.decode.bind(updateStreamMetadata), + ), deleteStream: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteStreamResponse.decode.bind(deleteStreamResponse), - deleteStreamMetadata.decode.bind(deleteStreamMetadata)), + deleteStreamMetadata.decode.bind(deleteStreamMetadata), + ), getStreamThumbnail: new this._gaxModule.LongrunningDescriptor( this.operationsClient, getStreamThumbnailResponse.decode.bind(getStreamThumbnailResponse), - getStreamThumbnailMetadata.decode.bind(getStreamThumbnailMetadata)), + getStreamThumbnailMetadata.decode.bind(getStreamThumbnailMetadata), + ), createEvent: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createEventResponse.decode.bind(createEventResponse), - createEventMetadata.decode.bind(createEventMetadata)), + createEventMetadata.decode.bind(createEventMetadata), + ), updateEvent: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateEventResponse.decode.bind(updateEventResponse), - updateEventMetadata.decode.bind(updateEventMetadata)), + updateEventMetadata.decode.bind(updateEventMetadata), + ), deleteEvent: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteEventResponse.decode.bind(deleteEventResponse), - deleteEventMetadata.decode.bind(deleteEventMetadata)), + deleteEventMetadata.decode.bind(deleteEventMetadata), + ), createSeries: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createSeriesResponse.decode.bind(createSeriesResponse), - createSeriesMetadata.decode.bind(createSeriesMetadata)), + createSeriesMetadata.decode.bind(createSeriesMetadata), + ), updateSeries: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateSeriesResponse.decode.bind(updateSeriesResponse), - updateSeriesMetadata.decode.bind(updateSeriesMetadata)), + updateSeriesMetadata.decode.bind(updateSeriesMetadata), + ), deleteSeries: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteSeriesResponse.decode.bind(deleteSeriesResponse), - deleteSeriesMetadata.decode.bind(deleteSeriesMetadata)), + deleteSeriesMetadata.decode.bind(deleteSeriesMetadata), + ), materializeChannel: new this._gaxModule.LongrunningDescriptor( this.operationsClient, materializeChannelResponse.decode.bind(materializeChannelResponse), - materializeChannelMetadata.decode.bind(materializeChannelMetadata)) + materializeChannelMetadata.decode.bind(materializeChannelMetadata), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.visionai.v1.StreamsService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.visionai.v1.StreamsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -439,28 +572,57 @@ export class StreamsServiceClient { // Put together the "service stub" for // google.cloud.visionai.v1.StreamsService. this.streamsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.visionai.v1.StreamsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.visionai.v1.StreamsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.visionai.v1.StreamsService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const streamsServiceStubMethods = - ['listClusters', 'getCluster', 'createCluster', 'updateCluster', 'deleteCluster', 'listStreams', 'getStream', 'createStream', 'updateStream', 'deleteStream', 'getStreamThumbnail', 'generateStreamHlsToken', 'listEvents', 'getEvent', 'createEvent', 'updateEvent', 'deleteEvent', 'listSeries', 'getSeries', 'createSeries', 'updateSeries', 'deleteSeries', 'materializeChannel']; + const streamsServiceStubMethods = [ + 'listClusters', + 'getCluster', + 'createCluster', + 'updateCluster', + 'deleteCluster', + 'listStreams', + 'getStream', + 'createStream', + 'updateStream', + 'deleteStream', + 'getStreamThumbnail', + 'generateStreamHlsToken', + 'listEvents', + 'getEvent', + 'createEvent', + 'updateEvent', + 'deleteEvent', + 'listSeries', + 'getSeries', + 'createSeries', + 'updateSeries', + 'deleteSeries', + 'materializeChannel', + ]; for (const methodName of streamsServiceStubMethods) { const callPromise = this.streamsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); const descriptor = this.descriptors.page[methodName] || @@ -470,7 +632,7 @@ export class StreamsServiceClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -485,8 +647,14 @@ export class StreamsServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'warehouse-visionai.googleapis.com'; } @@ -497,8 +665,14 @@ export class StreamsServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'warehouse-visionai.googleapis.com'; } @@ -529,9 +703,7 @@ export class StreamsServiceClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -540,8 +712,9 @@ export class StreamsServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -552,2306 +725,3362 @@ export class StreamsServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single Cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @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 protos.google.cloud.visionai.v1.Cluster|Cluster}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.get_cluster.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_GetCluster_async - */ + /** + * Gets details of a single Cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @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 protos.google.cloud.visionai.v1.Cluster|Cluster}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.get_cluster.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_GetCluster_async + */ getCluster( - request?: protos.google.cloud.visionai.v1.IGetClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ICluster, - protos.google.cloud.visionai.v1.IGetClusterRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetClusterRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IGetClusterRequest | undefined, + {} | undefined, + ] + >; getCluster( - request: protos.google.cloud.visionai.v1.IGetClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.ICluster, - protos.google.cloud.visionai.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IGetClusterRequest | null | undefined, + {} | null | undefined + >, + ): void; getCluster( - request: protos.google.cloud.visionai.v1.IGetClusterRequest, - callback: Callback< - protos.google.cloud.visionai.v1.ICluster, - protos.google.cloud.visionai.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetClusterRequest, + callback: Callback< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IGetClusterRequest | null | undefined, + {} | null | undefined + >, + ): void; getCluster( - request?: protos.google.cloud.visionai.v1.IGetClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.ICluster, - protos.google.cloud.visionai.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetClusterRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.ICluster, - protos.google.cloud.visionai.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.ICluster, - protos.google.cloud.visionai.v1.IGetClusterRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.visionai.v1.IGetClusterRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IGetClusterRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IGetClusterRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getCluster request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.ICluster, - protos.google.cloud.visionai.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IGetClusterRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getCluster response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getCluster(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.ICluster, - protos.google.cloud.visionai.v1.IGetClusterRequest|undefined, - {}|undefined - ]) => { - this._log.info('getCluster response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getCluster(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IGetClusterRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getCluster response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single Stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @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 protos.google.cloud.visionai.v1.Stream|Stream}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.get_stream.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_GetStream_async - */ + /** + * Gets details of a single Stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @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 protos.google.cloud.visionai.v1.Stream|Stream}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.get_stream.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_GetStream_async + */ getStream( - request?: protos.google.cloud.visionai.v1.IGetStreamRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IStream, - protos.google.cloud.visionai.v1.IGetStreamRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetStreamRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IGetStreamRequest | undefined, + {} | undefined, + ] + >; getStream( - request: protos.google.cloud.visionai.v1.IGetStreamRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IStream, - protos.google.cloud.visionai.v1.IGetStreamRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetStreamRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IGetStreamRequest | null | undefined, + {} | null | undefined + >, + ): void; getStream( - request: protos.google.cloud.visionai.v1.IGetStreamRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IStream, - protos.google.cloud.visionai.v1.IGetStreamRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetStreamRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IGetStreamRequest | null | undefined, + {} | null | undefined + >, + ): void; getStream( - request?: protos.google.cloud.visionai.v1.IGetStreamRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IStream, - protos.google.cloud.visionai.v1.IGetStreamRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetStreamRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IStream, - protos.google.cloud.visionai.v1.IGetStreamRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IStream, - protos.google.cloud.visionai.v1.IGetStreamRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.visionai.v1.IGetStreamRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IGetStreamRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IGetStreamRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getStream request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IStream, - protos.google.cloud.visionai.v1.IGetStreamRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IGetStreamRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getStream response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getStream(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IStream, - protos.google.cloud.visionai.v1.IGetStreamRequest|undefined, - {}|undefined - ]) => { - this._log.info('getStream response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getStream(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IGetStreamRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getStream response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Generate the JWT auth token required to get the stream HLS contents. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.stream - * Required. The name of the stream. - * @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 protos.google.cloud.visionai.v1.GenerateStreamHlsTokenResponse|GenerateStreamHlsTokenResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.generate_stream_hls_token.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_GenerateStreamHlsToken_async - */ + /** + * Generate the JWT auth token required to get the stream HLS contents. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.stream + * Required. The name of the stream. + * @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 protos.google.cloud.visionai.v1.GenerateStreamHlsTokenResponse|GenerateStreamHlsTokenResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.generate_stream_hls_token.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_GenerateStreamHlsToken_async + */ generateStreamHlsToken( - request?: protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, + ( + | protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest + | undefined + ), + {} | undefined, + ] + >; generateStreamHlsToken( - request: protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, + | protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest + | null + | undefined, + {} | null | undefined + >, + ): void; generateStreamHlsToken( - request: protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, + | protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest + | null + | undefined, + {} | null | undefined + >, + ): void; generateStreamHlsToken( - request?: protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, + | protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, + ( + | protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'stream': request.stream ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + stream: request.stream ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('generateStreamHlsToken request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, + | protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('generateStreamHlsToken response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.generateStreamHlsToken(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, - protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest|undefined, - {}|undefined - ]) => { - this._log.info('generateStreamHlsToken response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .generateStreamHlsToken(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse, + ( + | protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('generateStreamHlsToken response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single Event. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @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 protos.google.cloud.visionai.v1.Event|Event}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.get_event.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_GetEvent_async - */ + /** + * Gets details of a single Event. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @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 protos.google.cloud.visionai.v1.Event|Event}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.get_event.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_GetEvent_async + */ getEvent( - request?: protos.google.cloud.visionai.v1.IGetEventRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IEvent, - protos.google.cloud.visionai.v1.IGetEventRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetEventRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IGetEventRequest | undefined, + {} | undefined, + ] + >; getEvent( - request: protos.google.cloud.visionai.v1.IGetEventRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IEvent, - protos.google.cloud.visionai.v1.IGetEventRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetEventRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IGetEventRequest | null | undefined, + {} | null | undefined + >, + ): void; getEvent( - request: protos.google.cloud.visionai.v1.IGetEventRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IEvent, - protos.google.cloud.visionai.v1.IGetEventRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetEventRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IGetEventRequest | null | undefined, + {} | null | undefined + >, + ): void; getEvent( - request?: protos.google.cloud.visionai.v1.IGetEventRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IEvent, - protos.google.cloud.visionai.v1.IGetEventRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetEventRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IEvent, - protos.google.cloud.visionai.v1.IGetEventRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IEvent, - protos.google.cloud.visionai.v1.IGetEventRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.visionai.v1.IGetEventRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IGetEventRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IGetEventRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getEvent request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IEvent, - protos.google.cloud.visionai.v1.IGetEventRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IGetEventRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getEvent response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getEvent(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IEvent, - protos.google.cloud.visionai.v1.IGetEventRequest|undefined, - {}|undefined - ]) => { - this._log.info('getEvent response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getEvent(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IGetEventRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getEvent response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single Series. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @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 protos.google.cloud.visionai.v1.Series|Series}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.get_series.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_GetSeries_async - */ + /** + * Gets details of a single Series. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @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 protos.google.cloud.visionai.v1.Series|Series}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.get_series.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_GetSeries_async + */ getSeries( - request?: protos.google.cloud.visionai.v1.IGetSeriesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ISeries, - protos.google.cloud.visionai.v1.IGetSeriesRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetSeriesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IGetSeriesRequest | undefined, + {} | undefined, + ] + >; getSeries( - request: protos.google.cloud.visionai.v1.IGetSeriesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.ISeries, - protos.google.cloud.visionai.v1.IGetSeriesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetSeriesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IGetSeriesRequest | null | undefined, + {} | null | undefined + >, + ): void; getSeries( - request: protos.google.cloud.visionai.v1.IGetSeriesRequest, - callback: Callback< - protos.google.cloud.visionai.v1.ISeries, - protos.google.cloud.visionai.v1.IGetSeriesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetSeriesRequest, + callback: Callback< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IGetSeriesRequest | null | undefined, + {} | null | undefined + >, + ): void; getSeries( - request?: protos.google.cloud.visionai.v1.IGetSeriesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.ISeries, - protos.google.cloud.visionai.v1.IGetSeriesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetSeriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.ISeries, - protos.google.cloud.visionai.v1.IGetSeriesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.ISeries, - protos.google.cloud.visionai.v1.IGetSeriesRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.visionai.v1.IGetSeriesRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IGetSeriesRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IGetSeriesRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getSeries request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.ISeries, - protos.google.cloud.visionai.v1.IGetSeriesRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IGetSeriesRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getSeries response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getSeries(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.ISeries, - protos.google.cloud.visionai.v1.IGetSeriesRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSeries response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getSeries(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IGetSeriesRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getSeries response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new Cluster in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.clusterId - * Required. Id of the requesting object. - * @param {google.cloud.visionai.v1.Cluster} request.cluster - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.create_cluster.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateCluster_async - */ + /** + * Creates a new Cluster in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.clusterId + * Required. Id of the requesting object. + * @param {google.cloud.visionai.v1.Cluster} request.cluster + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.create_cluster.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateCluster_async + */ createCluster( - request?: protos.google.cloud.visionai.v1.ICreateClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateClusterRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createCluster( - request: protos.google.cloud.visionai.v1.ICreateClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateClusterRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createCluster( - request: protos.google.cloud.visionai.v1.ICreateClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateClusterRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createCluster( - request?: protos.google.cloud.visionai.v1.ICreateClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { + request?: protos.google.cloud.visionai.v1.ICreateClusterRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createCluster response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createCluster request %j', request); - return this.innerApiCalls.createCluster(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createCluster response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createCluster(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createCluster response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.create_cluster.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateCluster_async - */ - async checkCreateClusterProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.create_cluster.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateCluster_async + */ + async checkCreateClusterProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Cluster, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('createCluster long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createCluster, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Cluster, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single Cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * Cluster resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.visionai.v1.Cluster} request.cluster - * Required. The resource being updated - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.update_cluster.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateCluster_async - */ + /** + * Updates the parameters of a single Cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.visionai.v1.Cluster} request.cluster + * Required. The resource being updated + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.update_cluster.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateCluster_async + */ updateCluster( - request?: protos.google.cloud.visionai.v1.IUpdateClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateClusterRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateCluster( - request: protos.google.cloud.visionai.v1.IUpdateClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateClusterRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateCluster( - request: protos.google.cloud.visionai.v1.IUpdateClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateClusterRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateCluster( - request?: protos.google.cloud.visionai.v1.IUpdateClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUpdateClusterRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'cluster.name': request.cluster!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'cluster.name': request.cluster!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateCluster response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateCluster request %j', request); - return this.innerApiCalls.updateCluster(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateCluster response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateCluster(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateCluster response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.update_cluster.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateCluster_async - */ - async checkUpdateClusterProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.update_cluster.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateCluster_async + */ + async checkUpdateClusterProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Cluster, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('updateCluster long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateCluster, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Cluster, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Deletes a single Cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.delete_cluster.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteCluster_async - */ + /** + * Deletes a single Cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.delete_cluster.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteCluster_async + */ deleteCluster( - request?: protos.google.cloud.visionai.v1.IDeleteClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteClusterRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteCluster( - request: protos.google.cloud.visionai.v1.IDeleteClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteClusterRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteCluster( - request: protos.google.cloud.visionai.v1.IDeleteClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteClusterRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteCluster( - request?: protos.google.cloud.visionai.v1.IDeleteClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteClusterRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteCluster response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteCluster request %j', request); - return this.innerApiCalls.deleteCluster(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteCluster response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteCluster(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteCluster response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.delete_cluster.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteCluster_async - */ - async checkDeleteClusterProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.delete_cluster.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteCluster_async + */ + async checkDeleteClusterProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('deleteCluster long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteCluster, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Creates a new Stream in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.streamId - * Required. Id of the requesting object. - * @param {google.cloud.visionai.v1.Stream} request.stream - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.create_stream.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateStream_async - */ + /** + * Creates a new Stream in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.streamId + * Required. Id of the requesting object. + * @param {google.cloud.visionai.v1.Stream} request.stream + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.create_stream.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateStream_async + */ createStream( - request?: protos.google.cloud.visionai.v1.ICreateStreamRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateStreamRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createStream( - request: protos.google.cloud.visionai.v1.ICreateStreamRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateStreamRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createStream( - request: protos.google.cloud.visionai.v1.ICreateStreamRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateStreamRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createStream( - request?: protos.google.cloud.visionai.v1.ICreateStreamRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.ICreateStreamRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createStream response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createStream request %j', request); - return this.innerApiCalls.createStream(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createStream response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createStream(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createStream response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createStream()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.create_stream.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateStream_async - */ - async checkCreateStreamProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createStream()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.create_stream.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateStream_async + */ + async checkCreateStreamProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Stream, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('createStream long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createStream, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createStream, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Stream, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single Stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * Stream resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.visionai.v1.Stream} request.stream - * Required. The resource being updated. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.update_stream.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateStream_async - */ + /** + * Updates the parameters of a single Stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * Stream resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.visionai.v1.Stream} request.stream + * Required. The resource being updated. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.update_stream.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateStream_async + */ updateStream( - request?: protos.google.cloud.visionai.v1.IUpdateStreamRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateStreamRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateStream( - request: protos.google.cloud.visionai.v1.IUpdateStreamRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateStreamRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateStream( - request: protos.google.cloud.visionai.v1.IUpdateStreamRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateStreamRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateStream( - request?: protos.google.cloud.visionai.v1.IUpdateStreamRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUpdateStreamRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'stream.name': request.stream!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'stream.name': request.stream!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateStream response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateStream request %j', request); - return this.innerApiCalls.updateStream(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateStream response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateStream(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateStream response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateStream()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.update_stream.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateStream_async - */ - async checkUpdateStreamProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateStream()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.update_stream.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateStream_async + */ + async checkUpdateStreamProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Stream, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('updateStream long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateStream, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateStream, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Stream, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Deletes a single Stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.delete_stream.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteStream_async - */ + /** + * Deletes a single Stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.delete_stream.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteStream_async + */ deleteStream( - request?: protos.google.cloud.visionai.v1.IDeleteStreamRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteStreamRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteStream( - request: protos.google.cloud.visionai.v1.IDeleteStreamRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteStreamRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteStream( - request: protos.google.cloud.visionai.v1.IDeleteStreamRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteStreamRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteStream( - request?: protos.google.cloud.visionai.v1.IDeleteStreamRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteStreamRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteStream response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteStream request %j', request); - return this.innerApiCalls.deleteStream(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteStream response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteStream(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteStream response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteStream()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.delete_stream.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteStream_async - */ - async checkDeleteStreamProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteStream()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.delete_stream.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteStream_async + */ + async checkDeleteStreamProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('deleteStream long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteStream, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteStream, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Gets the thumbnail (image snapshot) of a single Stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.stream - * Required. The name of the stream for to get the thumbnail from. - * @param {string} request.gcsObjectName - * Required. The name of the GCS object to store the thumbnail image. - * @param {string} [request.event] - * Optional. The name of the event. If unspecified, the thumbnail will be - * retrieved from the latest event. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify the requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.get_stream_thumbnail.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_GetStreamThumbnail_async - */ + /** + * Gets the thumbnail (image snapshot) of a single Stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.stream + * Required. The name of the stream for to get the thumbnail from. + * @param {string} request.gcsObjectName + * Required. The name of the GCS object to store the thumbnail image. + * @param {string} [request.event] + * Optional. The name of the event. If unspecified, the thumbnail will be + * retrieved from the latest event. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify the requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.get_stream_thumbnail.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_GetStreamThumbnail_async + */ getStreamThumbnail( - request?: protos.google.cloud.visionai.v1.IGetStreamThumbnailRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetStreamThumbnailRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IGetStreamThumbnailResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; getStreamThumbnail( - request: protos.google.cloud.visionai.v1.IGetStreamThumbnailRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetStreamThumbnailRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IGetStreamThumbnailResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; getStreamThumbnail( - request: protos.google.cloud.visionai.v1.IGetStreamThumbnailRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetStreamThumbnailRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IGetStreamThumbnailResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; getStreamThumbnail( - request?: protos.google.cloud.visionai.v1.IGetStreamThumbnailRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IGetStreamThumbnailRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IGetStreamThumbnailResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IGetStreamThumbnailResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IGetStreamThumbnailResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'stream': request.stream ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + stream: request.stream ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IGetStreamThumbnailResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('getStreamThumbnail response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('getStreamThumbnail request %j', request); - return this.innerApiCalls.getStreamThumbnail(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('getStreamThumbnail response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .getStreamThumbnail(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IGetStreamThumbnailResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('getStreamThumbnail response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `getStreamThumbnail()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.get_stream_thumbnail.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_GetStreamThumbnail_async - */ - async checkGetStreamThumbnailProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `getStreamThumbnail()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.get_stream_thumbnail.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_GetStreamThumbnail_async + */ + async checkGetStreamThumbnailProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.GetStreamThumbnailResponse, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('getStreamThumbnail long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.getStreamThumbnail, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.getStreamThumbnail, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.GetStreamThumbnailResponse, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Creates a new Event in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.eventId - * Required. Id of the requesting object. - * @param {google.cloud.visionai.v1.Event} request.event - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.create_event.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateEvent_async - */ + /** + * Creates a new Event in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.eventId + * Required. Id of the requesting object. + * @param {google.cloud.visionai.v1.Event} request.event + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.create_event.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateEvent_async + */ createEvent( - request?: protos.google.cloud.visionai.v1.ICreateEventRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateEventRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createEvent( - request: protos.google.cloud.visionai.v1.ICreateEventRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateEventRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createEvent( - request: protos.google.cloud.visionai.v1.ICreateEventRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateEventRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createEvent( - request?: protos.google.cloud.visionai.v1.ICreateEventRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.ICreateEventRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createEvent response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createEvent request %j', request); - return this.innerApiCalls.createEvent(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createEvent response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createEvent(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createEvent response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createEvent()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.create_event.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateEvent_async - */ - async checkCreateEventProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createEvent()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.create_event.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateEvent_async + */ + async checkCreateEventProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Event, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('createEvent long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createEvent, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createEvent, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Event, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single Event. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * Event resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.visionai.v1.Event} request.event - * Required. The resource being updated. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.update_event.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateEvent_async - */ + /** + * Updates the parameters of a single Event. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * Event resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.visionai.v1.Event} request.event + * Required. The resource being updated. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.update_event.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateEvent_async + */ updateEvent( - request?: protos.google.cloud.visionai.v1.IUpdateEventRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateEventRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateEvent( - request: protos.google.cloud.visionai.v1.IUpdateEventRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateEventRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateEvent( - request: protos.google.cloud.visionai.v1.IUpdateEventRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateEventRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateEvent( - request?: protos.google.cloud.visionai.v1.IUpdateEventRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUpdateEventRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'event.name': request.event!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'event.name': request.event!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateEvent response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateEvent request %j', request); - return this.innerApiCalls.updateEvent(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateEvent response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateEvent(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateEvent response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateEvent()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.update_event.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateEvent_async - */ - async checkUpdateEventProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateEvent()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.update_event.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateEvent_async + */ + async checkUpdateEventProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Event, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('updateEvent long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateEvent, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateEvent, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Event, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Deletes a single Event. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.delete_event.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteEvent_async - */ + /** + * Deletes a single Event. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.delete_event.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteEvent_async + */ deleteEvent( - request?: protos.google.cloud.visionai.v1.IDeleteEventRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteEventRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteEvent( - request: protos.google.cloud.visionai.v1.IDeleteEventRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteEventRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteEvent( - request: protos.google.cloud.visionai.v1.IDeleteEventRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteEventRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteEvent( - request?: protos.google.cloud.visionai.v1.IDeleteEventRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteEventRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteEvent response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteEvent request %j', request); - return this.innerApiCalls.deleteEvent(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteEvent response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteEvent(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteEvent response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteEvent()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.delete_event.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteEvent_async - */ - async checkDeleteEventProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteEvent()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.delete_event.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteEvent_async + */ + async checkDeleteEventProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('deleteEvent long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteEvent, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteEvent, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Creates a new Series in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.seriesId - * Required. Id of the requesting object. - * @param {google.cloud.visionai.v1.Series} request.series - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.create_series.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateSeries_async - */ + /** + * Creates a new Series in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.seriesId + * Required. Id of the requesting object. + * @param {google.cloud.visionai.v1.Series} request.series + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.create_series.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateSeries_async + */ createSeries( - request?: protos.google.cloud.visionai.v1.ICreateSeriesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateSeriesRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createSeries( - request: protos.google.cloud.visionai.v1.ICreateSeriesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateSeriesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSeries( - request: protos.google.cloud.visionai.v1.ICreateSeriesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateSeriesRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSeries( - request?: protos.google.cloud.visionai.v1.ICreateSeriesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.ICreateSeriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createSeries response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createSeries request %j', request); - return this.innerApiCalls.createSeries(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createSeries response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createSeries(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createSeries response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createSeries()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.create_series.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateSeries_async - */ - async checkCreateSeriesProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createSeries()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.create_series.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_CreateSeries_async + */ + async checkCreateSeriesProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Series, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('createSeries long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createSeries, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createSeries, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Series, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single Event. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * Series resource by the update. The fields specified in the update_mask are - * relative to the resource, not the full request. A field will be overwritten - * if it is in the mask. If the user does not provide a mask then all fields - * will be overwritten. - * @param {google.cloud.visionai.v1.Series} request.series - * Required. The resource being updated - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.update_series.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateSeries_async - */ + /** + * Updates the parameters of a single Event. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * Series resource by the update. The fields specified in the update_mask are + * relative to the resource, not the full request. A field will be overwritten + * if it is in the mask. If the user does not provide a mask then all fields + * will be overwritten. + * @param {google.cloud.visionai.v1.Series} request.series + * Required. The resource being updated + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.update_series.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateSeries_async + */ updateSeries( - request?: protos.google.cloud.visionai.v1.IUpdateSeriesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateSeriesRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateSeries( - request: protos.google.cloud.visionai.v1.IUpdateSeriesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateSeriesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateSeries( - request: protos.google.cloud.visionai.v1.IUpdateSeriesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateSeriesRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateSeries( - request?: protos.google.cloud.visionai.v1.IUpdateSeriesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUpdateSeriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'series.name': request.series!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'series.name': request.series!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateSeries response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateSeries request %j', request); - return this.innerApiCalls.updateSeries(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateSeries response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateSeries(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateSeries response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateSeries()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.update_series.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateSeries_async - */ - async checkUpdateSeriesProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateSeries()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.update_series.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_UpdateSeries_async + */ + async checkUpdateSeriesProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Series, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('updateSeries long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateSeries, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateSeries, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Series, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Deletes a single Series. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.delete_series.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteSeries_async - */ + /** + * Deletes a single Series. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.delete_series.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteSeries_async + */ deleteSeries( - request?: protos.google.cloud.visionai.v1.IDeleteSeriesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteSeriesRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteSeries( - request: protos.google.cloud.visionai.v1.IDeleteSeriesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteSeriesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSeries( - request: protos.google.cloud.visionai.v1.IDeleteSeriesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteSeriesRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSeries( - request?: protos.google.cloud.visionai.v1.IDeleteSeriesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteSeriesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteSeries response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteSeries request %j', request); - return this.innerApiCalls.deleteSeries(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteSeries response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteSeries(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteSeries response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteSeries()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.delete_series.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteSeries_async - */ - async checkDeleteSeriesProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteSeries()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.delete_series.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_DeleteSeries_async + */ + async checkDeleteSeriesProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('deleteSeries long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteSeries, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteSeries, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.OperationMetadata + >; } -/** - * Materialize a channel. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for parent. - * @param {string} request.channelId - * Required. Id of the channel. - * @param {google.cloud.visionai.v1.Channel} request.channel - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.materialize_channel.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_MaterializeChannel_async - */ + /** + * Materialize a channel. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for parent. + * @param {string} request.channelId + * Required. Id of the channel. + * @param {google.cloud.visionai.v1.Channel} request.channel + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.materialize_channel.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_MaterializeChannel_async + */ materializeChannel( - request?: protos.google.cloud.visionai.v1.IMaterializeChannelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IMaterializeChannelRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IChannel, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; materializeChannel( - request: protos.google.cloud.visionai.v1.IMaterializeChannelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IMaterializeChannelRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IChannel, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; materializeChannel( - request: protos.google.cloud.visionai.v1.IMaterializeChannelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IMaterializeChannelRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IChannel, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; materializeChannel( - request?: protos.google.cloud.visionai.v1.IMaterializeChannelRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IMaterializeChannelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IChannel, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IChannel, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IChannel, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IChannel, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('materializeChannel response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('materializeChannel request %j', request); - return this.innerApiCalls.materializeChannel(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('materializeChannel response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .materializeChannel(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IChannel, + protos.google.cloud.visionai.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('materializeChannel response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `materializeChannel()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.materialize_channel.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_MaterializeChannel_async - */ - async checkMaterializeChannelProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `materializeChannel()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.materialize_channel.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_MaterializeChannel_async + */ + async checkMaterializeChannelProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Channel, + protos.google.cloud.visionai.v1.OperationMetadata + > + > { this._log.info('materializeChannel long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.materializeChannel, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Clusters in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListClustersRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @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 Array of {@link protos.google.cloud.visionai.v1.Cluster|Cluster}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.materializeChannel, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Channel, + protos.google.cloud.visionai.v1.OperationMetadata + >; + } + /** + * Lists Clusters in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListClustersRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @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 Array of {@link protos.google.cloud.visionai.v1.Cluster|Cluster}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listClusters( - request?: protos.google.cloud.visionai.v1.IListClustersRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ICluster[], - protos.google.cloud.visionai.v1.IListClustersRequest|null, - protos.google.cloud.visionai.v1.IListClustersResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListClustersRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICluster[], + protos.google.cloud.visionai.v1.IListClustersRequest | null, + protos.google.cloud.visionai.v1.IListClustersResponse, + ] + >; listClusters( - request: protos.google.cloud.visionai.v1.IListClustersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListClustersRequest, - protos.google.cloud.visionai.v1.IListClustersResponse|null|undefined, - protos.google.cloud.visionai.v1.ICluster>): void; + request: protos.google.cloud.visionai.v1.IListClustersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListClustersRequest, + protos.google.cloud.visionai.v1.IListClustersResponse | null | undefined, + protos.google.cloud.visionai.v1.ICluster + >, + ): void; listClusters( - request: protos.google.cloud.visionai.v1.IListClustersRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListClustersRequest, - protos.google.cloud.visionai.v1.IListClustersResponse|null|undefined, - protos.google.cloud.visionai.v1.ICluster>): void; + request: protos.google.cloud.visionai.v1.IListClustersRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListClustersRequest, + protos.google.cloud.visionai.v1.IListClustersResponse | null | undefined, + protos.google.cloud.visionai.v1.ICluster + >, + ): void; listClusters( - request?: protos.google.cloud.visionai.v1.IListClustersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListClustersRequest, - protos.google.cloud.visionai.v1.IListClustersResponse|null|undefined, - protos.google.cloud.visionai.v1.ICluster>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListClustersRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListClustersRequest, - protos.google.cloud.visionai.v1.IListClustersResponse|null|undefined, - protos.google.cloud.visionai.v1.ICluster>): - Promise<[ - protos.google.cloud.visionai.v1.ICluster[], - protos.google.cloud.visionai.v1.IListClustersRequest|null, - protos.google.cloud.visionai.v1.IListClustersResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListClustersResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ICluster + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListClustersRequest, + protos.google.cloud.visionai.v1.IListClustersResponse | null | undefined, + protos.google.cloud.visionai.v1.ICluster + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICluster[], + protos.google.cloud.visionai.v1.IListClustersRequest | null, + protos.google.cloud.visionai.v1.IListClustersResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListClustersRequest, - protos.google.cloud.visionai.v1.IListClustersResponse|null|undefined, - protos.google.cloud.visionai.v1.ICluster>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListClustersRequest, + | protos.google.cloud.visionai.v1.IListClustersResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ICluster + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listClusters values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2860,204 +4089,227 @@ export class StreamsServiceClient { this._log.info('listClusters request %j', request); return this.innerApiCalls .listClusters(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.ICluster[], - protos.google.cloud.visionai.v1.IListClustersRequest|null, - protos.google.cloud.visionai.v1.IListClustersResponse - ]) => { - this._log.info('listClusters values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.ICluster[], + protos.google.cloud.visionai.v1.IListClustersRequest | null, + protos.google.cloud.visionai.v1.IListClustersResponse, + ]) => { + this._log.info('listClusters values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listClusters`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListClustersRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Cluster|Cluster} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listClusters`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListClustersRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Cluster|Cluster} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listClustersStream( - request?: protos.google.cloud.visionai.v1.IListClustersRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListClustersRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listClusters']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listClusters stream %j', request); return this.descriptors.page.listClusters.createStream( this.innerApiCalls.listClusters as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listClusters`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListClustersRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Cluster|Cluster}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.list_clusters.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_ListClusters_async - */ + /** + * Equivalent to `listClusters`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListClustersRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Cluster|Cluster}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.list_clusters.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_ListClusters_async + */ listClustersAsync( - request?: protos.google.cloud.visionai.v1.IListClustersRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListClustersRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listClusters']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listClusters iterate %j', request); return this.descriptors.page.listClusters.asyncIterate( this.innerApiCalls['listClusters'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Streams in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListStreamsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @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 Array of {@link protos.google.cloud.visionai.v1.Stream|Stream}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listStreamsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Streams in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListStreamsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @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 Array of {@link protos.google.cloud.visionai.v1.Stream|Stream}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listStreamsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listStreams( - request?: protos.google.cloud.visionai.v1.IListStreamsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IStream[], - protos.google.cloud.visionai.v1.IListStreamsRequest|null, - protos.google.cloud.visionai.v1.IListStreamsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListStreamsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IStream[], + protos.google.cloud.visionai.v1.IListStreamsRequest | null, + protos.google.cloud.visionai.v1.IListStreamsResponse, + ] + >; listStreams( - request: protos.google.cloud.visionai.v1.IListStreamsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListStreamsRequest, - protos.google.cloud.visionai.v1.IListStreamsResponse|null|undefined, - protos.google.cloud.visionai.v1.IStream>): void; + request: protos.google.cloud.visionai.v1.IListStreamsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListStreamsRequest, + protos.google.cloud.visionai.v1.IListStreamsResponse | null | undefined, + protos.google.cloud.visionai.v1.IStream + >, + ): void; listStreams( - request: protos.google.cloud.visionai.v1.IListStreamsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListStreamsRequest, - protos.google.cloud.visionai.v1.IListStreamsResponse|null|undefined, - protos.google.cloud.visionai.v1.IStream>): void; + request: protos.google.cloud.visionai.v1.IListStreamsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListStreamsRequest, + protos.google.cloud.visionai.v1.IListStreamsResponse | null | undefined, + protos.google.cloud.visionai.v1.IStream + >, + ): void; listStreams( - request?: protos.google.cloud.visionai.v1.IListStreamsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListStreamsRequest, - protos.google.cloud.visionai.v1.IListStreamsResponse|null|undefined, - protos.google.cloud.visionai.v1.IStream>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListStreamsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListStreamsRequest, - protos.google.cloud.visionai.v1.IListStreamsResponse|null|undefined, - protos.google.cloud.visionai.v1.IStream>): - Promise<[ - protos.google.cloud.visionai.v1.IStream[], - protos.google.cloud.visionai.v1.IListStreamsRequest|null, - protos.google.cloud.visionai.v1.IListStreamsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListStreamsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IStream + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListStreamsRequest, + protos.google.cloud.visionai.v1.IListStreamsResponse | null | undefined, + protos.google.cloud.visionai.v1.IStream + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IStream[], + protos.google.cloud.visionai.v1.IListStreamsRequest | null, + protos.google.cloud.visionai.v1.IListStreamsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListStreamsRequest, - protos.google.cloud.visionai.v1.IListStreamsResponse|null|undefined, - protos.google.cloud.visionai.v1.IStream>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListStreamsRequest, + | protos.google.cloud.visionai.v1.IListStreamsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IStream + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listStreams values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -3066,204 +4318,227 @@ export class StreamsServiceClient { this._log.info('listStreams request %j', request); return this.innerApiCalls .listStreams(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IStream[], - protos.google.cloud.visionai.v1.IListStreamsRequest|null, - protos.google.cloud.visionai.v1.IListStreamsResponse - ]) => { - this._log.info('listStreams values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IStream[], + protos.google.cloud.visionai.v1.IListStreamsRequest | null, + protos.google.cloud.visionai.v1.IListStreamsResponse, + ]) => { + this._log.info('listStreams values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listStreams`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListStreamsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Stream|Stream} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listStreamsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listStreams`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListStreamsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Stream|Stream} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listStreamsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listStreamsStream( - request?: protos.google.cloud.visionai.v1.IListStreamsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListStreamsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listStreams']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listStreams stream %j', request); return this.descriptors.page.listStreams.createStream( this.innerApiCalls.listStreams as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listStreams`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListStreamsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Stream|Stream}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.list_streams.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_ListStreams_async - */ + /** + * Equivalent to `listStreams`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListStreamsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Stream|Stream}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.list_streams.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_ListStreams_async + */ listStreamsAsync( - request?: protos.google.cloud.visionai.v1.IListStreamsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListStreamsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listStreams']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listStreams iterate %j', request); return this.descriptors.page.listStreams.asyncIterate( this.innerApiCalls['listStreams'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Events in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListEventsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @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 Array of {@link protos.google.cloud.visionai.v1.Event|Event}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listEventsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Events in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListEventsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @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 Array of {@link protos.google.cloud.visionai.v1.Event|Event}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listEventsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listEvents( - request?: protos.google.cloud.visionai.v1.IListEventsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IEvent[], - protos.google.cloud.visionai.v1.IListEventsRequest|null, - protos.google.cloud.visionai.v1.IListEventsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListEventsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IEvent[], + protos.google.cloud.visionai.v1.IListEventsRequest | null, + protos.google.cloud.visionai.v1.IListEventsResponse, + ] + >; listEvents( - request: protos.google.cloud.visionai.v1.IListEventsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListEventsRequest, - protos.google.cloud.visionai.v1.IListEventsResponse|null|undefined, - protos.google.cloud.visionai.v1.IEvent>): void; + request: protos.google.cloud.visionai.v1.IListEventsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListEventsRequest, + protos.google.cloud.visionai.v1.IListEventsResponse | null | undefined, + protos.google.cloud.visionai.v1.IEvent + >, + ): void; listEvents( - request: protos.google.cloud.visionai.v1.IListEventsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListEventsRequest, - protos.google.cloud.visionai.v1.IListEventsResponse|null|undefined, - protos.google.cloud.visionai.v1.IEvent>): void; + request: protos.google.cloud.visionai.v1.IListEventsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListEventsRequest, + protos.google.cloud.visionai.v1.IListEventsResponse | null | undefined, + protos.google.cloud.visionai.v1.IEvent + >, + ): void; listEvents( - request?: protos.google.cloud.visionai.v1.IListEventsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListEventsRequest, - protos.google.cloud.visionai.v1.IListEventsResponse|null|undefined, - protos.google.cloud.visionai.v1.IEvent>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListEventsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListEventsRequest, - protos.google.cloud.visionai.v1.IListEventsResponse|null|undefined, - protos.google.cloud.visionai.v1.IEvent>): - Promise<[ - protos.google.cloud.visionai.v1.IEvent[], - protos.google.cloud.visionai.v1.IListEventsRequest|null, - protos.google.cloud.visionai.v1.IListEventsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListEventsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IEvent + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListEventsRequest, + protos.google.cloud.visionai.v1.IListEventsResponse | null | undefined, + protos.google.cloud.visionai.v1.IEvent + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IEvent[], + protos.google.cloud.visionai.v1.IListEventsRequest | null, + protos.google.cloud.visionai.v1.IListEventsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListEventsRequest, - protos.google.cloud.visionai.v1.IListEventsResponse|null|undefined, - protos.google.cloud.visionai.v1.IEvent>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListEventsRequest, + | protos.google.cloud.visionai.v1.IListEventsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IEvent + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listEvents values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -3272,204 +4547,227 @@ export class StreamsServiceClient { this._log.info('listEvents request %j', request); return this.innerApiCalls .listEvents(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IEvent[], - protos.google.cloud.visionai.v1.IListEventsRequest|null, - protos.google.cloud.visionai.v1.IListEventsResponse - ]) => { - this._log.info('listEvents values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IEvent[], + protos.google.cloud.visionai.v1.IListEventsRequest | null, + protos.google.cloud.visionai.v1.IListEventsResponse, + ]) => { + this._log.info('listEvents values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listEvents`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListEventsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Event|Event} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listEventsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listEvents`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListEventsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Event|Event} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listEventsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listEventsStream( - request?: protos.google.cloud.visionai.v1.IListEventsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListEventsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listEvents']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listEvents stream %j', request); return this.descriptors.page.listEvents.createStream( this.innerApiCalls.listEvents as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listEvents`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListEventsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Event|Event}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.list_events.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_ListEvents_async - */ + /** + * Equivalent to `listEvents`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListEventsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Event|Event}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.list_events.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_ListEvents_async + */ listEventsAsync( - request?: protos.google.cloud.visionai.v1.IListEventsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListEventsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listEvents']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listEvents iterate %j', request); return this.descriptors.page.listEvents.asyncIterate( this.innerApiCalls['listEvents'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Series in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListSeriesRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @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 Array of {@link protos.google.cloud.visionai.v1.Series|Series}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSeriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Series in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListSeriesRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @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 Array of {@link protos.google.cloud.visionai.v1.Series|Series}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSeriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listSeries( - request?: protos.google.cloud.visionai.v1.IListSeriesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ISeries[], - protos.google.cloud.visionai.v1.IListSeriesRequest|null, - protos.google.cloud.visionai.v1.IListSeriesResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListSeriesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISeries[], + protos.google.cloud.visionai.v1.IListSeriesRequest | null, + protos.google.cloud.visionai.v1.IListSeriesResponse, + ] + >; listSeries( - request: protos.google.cloud.visionai.v1.IListSeriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListSeriesRequest, - protos.google.cloud.visionai.v1.IListSeriesResponse|null|undefined, - protos.google.cloud.visionai.v1.ISeries>): void; + request: protos.google.cloud.visionai.v1.IListSeriesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListSeriesRequest, + protos.google.cloud.visionai.v1.IListSeriesResponse | null | undefined, + protos.google.cloud.visionai.v1.ISeries + >, + ): void; listSeries( - request: protos.google.cloud.visionai.v1.IListSeriesRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListSeriesRequest, - protos.google.cloud.visionai.v1.IListSeriesResponse|null|undefined, - protos.google.cloud.visionai.v1.ISeries>): void; + request: protos.google.cloud.visionai.v1.IListSeriesRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListSeriesRequest, + protos.google.cloud.visionai.v1.IListSeriesResponse | null | undefined, + protos.google.cloud.visionai.v1.ISeries + >, + ): void; listSeries( - request?: protos.google.cloud.visionai.v1.IListSeriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListSeriesRequest, - protos.google.cloud.visionai.v1.IListSeriesResponse|null|undefined, - protos.google.cloud.visionai.v1.ISeries>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListSeriesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListSeriesRequest, - protos.google.cloud.visionai.v1.IListSeriesResponse|null|undefined, - protos.google.cloud.visionai.v1.ISeries>): - Promise<[ - protos.google.cloud.visionai.v1.ISeries[], - protos.google.cloud.visionai.v1.IListSeriesRequest|null, - protos.google.cloud.visionai.v1.IListSeriesResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListSeriesResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISeries + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListSeriesRequest, + protos.google.cloud.visionai.v1.IListSeriesResponse | null | undefined, + protos.google.cloud.visionai.v1.ISeries + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISeries[], + protos.google.cloud.visionai.v1.IListSeriesRequest | null, + protos.google.cloud.visionai.v1.IListSeriesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListSeriesRequest, - protos.google.cloud.visionai.v1.IListSeriesResponse|null|undefined, - protos.google.cloud.visionai.v1.ISeries>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListSeriesRequest, + | protos.google.cloud.visionai.v1.IListSeriesResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISeries + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listSeries values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -3478,143 +4776,147 @@ export class StreamsServiceClient { this._log.info('listSeries request %j', request); return this.innerApiCalls .listSeries(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.ISeries[], - protos.google.cloud.visionai.v1.IListSeriesRequest|null, - protos.google.cloud.visionai.v1.IListSeriesResponse - ]) => { - this._log.info('listSeries values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.ISeries[], + protos.google.cloud.visionai.v1.IListSeriesRequest | null, + protos.google.cloud.visionai.v1.IListSeriesResponse, + ]) => { + this._log.info('listSeries values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listSeries`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListSeriesRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Series|Series} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSeriesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listSeries`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListSeriesRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Series|Series} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSeriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listSeriesStream( - request?: protos.google.cloud.visionai.v1.IListSeriesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListSeriesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSeries']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSeries stream %j', request); return this.descriptors.page.listSeries.createStream( this.innerApiCalls.listSeries as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listSeries`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListSeriesRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Series|Series}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/streams_service.list_series.js - * region_tag:warehouse-visionai_v1_generated_StreamsService_ListSeries_async - */ + /** + * Equivalent to `listSeries`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListSeriesRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Series|Series}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/streams_service.list_series.js + * region_tag:warehouse-visionai_v1_generated_StreamsService_ListSeries_async + */ listSeriesAsync( - request?: protos.google.cloud.visionai.v1.IListSeriesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListSeriesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSeries']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSeries iterate %j', request); return this.descriptors.page.listSeries.asyncIterate( this.innerApiCalls['listSeries'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + /** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getIamPolicy( request: IamProtos.google.iam.v1.GetIamPolicyRequest, options?: @@ -3628,40 +4930,40 @@ export class StreamsServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.getIamPolicy(request, options, callback); } -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ setIamPolicy( request: IamProtos.google.iam.v1.SetIamPolicyRequest, options?: @@ -3675,41 +4977,41 @@ export class StreamsServiceClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.setIamPolicy(request, options, callback); } -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ testIamPermissions( request: IamProtos.google.iam.v1.TestIamPermissionsRequest, options?: @@ -3723,12 +5025,12 @@ export class StreamsServiceClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -3763,12 +5065,11 @@ export class StreamsServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -3801,12 +5102,12 @@ export class StreamsServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } -/** + /** * Gets the latest state of a long-running operation. Clients can use this * method to poll the operation result at intervals as recommended by the API * service. @@ -3849,22 +5150,22 @@ export class StreamsServiceClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -3899,15 +5200,15 @@ export class StreamsServiceClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -3941,7 +5242,7 @@ export class StreamsServiceClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -3954,25 +5255,24 @@ export class StreamsServiceClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.cancelOperation(request, options, callback); } - /** * Deletes a long-running operation. This method indicates that the client is * no longer interested in the operation result. It does not cancel the @@ -4011,22 +5311,22 @@ export class StreamsServiceClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -4043,7 +5343,12 @@ export class StreamsServiceClient { * @param {string} analysis * @returns {string} Resource name string. */ - analysisPath(project:string,location:string,cluster:string,analysis:string) { + analysisPath( + project: string, + location: string, + cluster: string, + analysis: string, + ) { return this.pathTemplates.analysisPathTemplate.render({ project: project, location: location, @@ -4106,7 +5411,13 @@ export class StreamsServiceClient { * @param {string} annotation * @returns {string} Resource name string. */ - annotationPath(projectNumber:string,location:string,corpus:string,asset:string,annotation:string) { + annotationPath( + projectNumber: string, + location: string, + corpus: string, + asset: string, + annotation: string, + ) { return this.pathTemplates.annotationPathTemplate.render({ project_number: projectNumber, location: location, @@ -4124,7 +5435,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).project_number; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .project_number; } /** @@ -4135,7 +5447,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the location. */ matchLocationFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).location; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .location; } /** @@ -4146,7 +5459,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).corpus; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .corpus; } /** @@ -4157,7 +5471,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the asset. */ matchAssetFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).asset; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .asset; } /** @@ -4168,7 +5483,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the annotation. */ matchAnnotationFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).annotation; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .annotation; } /** @@ -4179,7 +5495,7 @@ export class StreamsServiceClient { * @param {string} application * @returns {string} Resource name string. */ - applicationPath(project:string,location:string,application:string) { + applicationPath(project: string, location: string, application: string) { return this.pathTemplates.applicationPathTemplate.render({ project: project, location: location, @@ -4195,7 +5511,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the project. */ matchProjectFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).project; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .project; } /** @@ -4206,7 +5523,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the location. */ matchLocationFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).location; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .location; } /** @@ -4217,7 +5535,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the application. */ matchApplicationFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).application; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .application; } /** @@ -4229,7 +5548,12 @@ export class StreamsServiceClient { * @param {string} asset * @returns {string} Resource name string. */ - assetPath(projectNumber:string,location:string,corpus:string,asset:string) { + assetPath( + projectNumber: string, + location: string, + corpus: string, + asset: string, + ) { return this.pathTemplates.assetPathTemplate.render({ project_number: projectNumber, location: location, @@ -4291,7 +5615,12 @@ export class StreamsServiceClient { * @param {string} channel * @returns {string} Resource name string. */ - channelPath(project:string,location:string,cluster:string,channel:string) { + channelPath( + project: string, + location: string, + cluster: string, + channel: string, + ) { return this.pathTemplates.channelPathTemplate.render({ project: project, location: location, @@ -4352,7 +5681,7 @@ export class StreamsServiceClient { * @param {string} cluster * @returns {string} Resource name string. */ - clusterPath(project:string,location:string,cluster:string) { + clusterPath(project: string, location: string, cluster: string) { return this.pathTemplates.clusterPathTemplate.render({ project: project, location: location, @@ -4402,7 +5731,12 @@ export class StreamsServiceClient { * @param {string} collection * @returns {string} Resource name string. */ - collectionPath(projectNumber:string,location:string,corpus:string,collection:string) { + collectionPath( + projectNumber: string, + location: string, + corpus: string, + collection: string, + ) { return this.pathTemplates.collectionPathTemplate.render({ project_number: projectNumber, location: location, @@ -4419,7 +5753,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).project_number; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .project_number; } /** @@ -4430,7 +5765,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the location. */ matchLocationFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).location; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .location; } /** @@ -4441,7 +5777,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).corpus; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .corpus; } /** @@ -4452,7 +5789,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the collection. */ matchCollectionFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).collection; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .collection; } /** @@ -4463,7 +5801,7 @@ export class StreamsServiceClient { * @param {string} corpus * @returns {string} Resource name string. */ - corpusPath(projectNumber:string,location:string,corpus:string) { + corpusPath(projectNumber: string, location: string, corpus: string) { return this.pathTemplates.corpusPathTemplate.render({ project_number: projectNumber, location: location, @@ -4479,7 +5817,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromCorpusName(corpusName: string) { - return this.pathTemplates.corpusPathTemplate.match(corpusName).project_number; + return this.pathTemplates.corpusPathTemplate.match(corpusName) + .project_number; } /** @@ -4513,7 +5852,12 @@ export class StreamsServiceClient { * @param {string} data_schema * @returns {string} Resource name string. */ - dataSchemaPath(projectNumber:string,location:string,corpus:string,dataSchema:string) { + dataSchemaPath( + projectNumber: string, + location: string, + corpus: string, + dataSchema: string, + ) { return this.pathTemplates.dataSchemaPathTemplate.render({ project_number: projectNumber, location: location, @@ -4530,7 +5874,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).project_number; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .project_number; } /** @@ -4541,7 +5886,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the location. */ matchLocationFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).location; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .location; } /** @@ -4552,7 +5898,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).corpus; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .corpus; } /** @@ -4563,7 +5910,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the data_schema. */ matchDataSchemaFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).data_schema; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .data_schema; } /** @@ -4575,7 +5923,12 @@ export class StreamsServiceClient { * @param {string} draft * @returns {string} Resource name string. */ - draftPath(project:string,location:string,application:string,draft:string) { + draftPath( + project: string, + location: string, + application: string, + draft: string, + ) { return this.pathTemplates.draftPathTemplate.render({ project: project, location: location, @@ -4637,7 +5990,7 @@ export class StreamsServiceClient { * @param {string} event * @returns {string} Resource name string. */ - eventPath(project:string,location:string,cluster:string,event:string) { + eventPath(project: string, location: string, cluster: string, event: string) { return this.pathTemplates.eventPathTemplate.render({ project: project, location: location, @@ -4699,7 +6052,12 @@ export class StreamsServiceClient { * @param {string} index * @returns {string} Resource name string. */ - indexPath(projectNumber:string,location:string,corpus:string,index:string) { + indexPath( + projectNumber: string, + location: string, + corpus: string, + index: string, + ) { return this.pathTemplates.indexPathTemplate.render({ project_number: projectNumber, location: location, @@ -4760,7 +6118,7 @@ export class StreamsServiceClient { * @param {string} index_endpoint * @returns {string} Resource name string. */ - indexEndpointPath(project:string,location:string,indexEndpoint:string) { + indexEndpointPath(project: string, location: string, indexEndpoint: string) { return this.pathTemplates.indexEndpointPathTemplate.render({ project: project, location: location, @@ -4776,7 +6134,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the project. */ matchProjectFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).project; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .project; } /** @@ -4787,7 +6146,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the location. */ matchLocationFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).location; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .location; } /** @@ -4798,7 +6158,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the index_endpoint. */ matchIndexEndpointFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).index_endpoint; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .index_endpoint; } /** @@ -4810,7 +6171,12 @@ export class StreamsServiceClient { * @param {string} instance * @returns {string} Resource name string. */ - instancePath(project:string,location:string,application:string,instance:string) { + instancePath( + project: string, + location: string, + application: string, + instance: string, + ) { return this.pathTemplates.instancePathTemplate.render({ project: project, location: location, @@ -4849,7 +6215,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the application. */ matchApplicationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).application; + return this.pathTemplates.instancePathTemplate.match(instanceName) + .application; } /** @@ -4870,7 +6237,7 @@ export class StreamsServiceClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -4907,7 +6274,7 @@ export class StreamsServiceClient { * @param {string} operator * @returns {string} Resource name string. */ - operatorPath(project:string,location:string,operator:string) { + operatorPath(project: string, location: string, operator: string) { return this.pathTemplates.operatorPathTemplate.render({ project: project, location: location, @@ -4957,7 +6324,12 @@ export class StreamsServiceClient { * @param {string} process * @returns {string} Resource name string. */ - processPath(project:string,location:string,cluster:string,process:string) { + processPath( + project: string, + location: string, + cluster: string, + process: string, + ) { return this.pathTemplates.processPathTemplate.render({ project: project, location: location, @@ -5018,7 +6390,7 @@ export class StreamsServiceClient { * @param {string} processor * @returns {string} Resource name string. */ - processorPath(project:string,location:string,processor:string) { + processorPath(project: string, location: string, processor: string) { return this.pathTemplates.processorPathTemplate.render({ project: project, location: location, @@ -5034,7 +6406,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the project. */ matchProjectFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).project; + return this.pathTemplates.processorPathTemplate.match(processorName) + .project; } /** @@ -5045,7 +6418,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the location. */ matchLocationFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).location; + return this.pathTemplates.processorPathTemplate.match(processorName) + .location; } /** @@ -5056,7 +6430,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the processor. */ matchProcessorFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).processor; + return this.pathTemplates.processorPathTemplate.match(processorName) + .processor; } /** @@ -5065,7 +6440,7 @@ export class StreamsServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -5091,7 +6466,12 @@ export class StreamsServiceClient { * @param {string} search_config * @returns {string} Resource name string. */ - searchConfigPath(projectNumber:string,location:string,corpus:string,searchConfig:string) { + searchConfigPath( + projectNumber: string, + location: string, + corpus: string, + searchConfig: string, + ) { return this.pathTemplates.searchConfigPathTemplate.render({ project_number: projectNumber, location: location, @@ -5108,7 +6488,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).project_number; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .project_number; } /** @@ -5119,7 +6500,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the location. */ matchLocationFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).location; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .location; } /** @@ -5130,7 +6512,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).corpus; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .corpus; } /** @@ -5141,7 +6524,8 @@ export class StreamsServiceClient { * @returns {string} A string representing the search_config. */ matchSearchConfigFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).search_config; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .search_config; } /** @@ -5153,7 +6537,12 @@ export class StreamsServiceClient { * @param {string} search_hypernym * @returns {string} Resource name string. */ - searchHypernymPath(projectNumber:string,location:string,corpus:string,searchHypernym:string) { + searchHypernymPath( + projectNumber: string, + location: string, + corpus: string, + searchHypernym: string, + ) { return this.pathTemplates.searchHypernymPathTemplate.render({ project_number: projectNumber, location: location, @@ -5170,7 +6559,9 @@ export class StreamsServiceClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).project_number; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).project_number; } /** @@ -5181,7 +6572,9 @@ export class StreamsServiceClient { * @returns {string} A string representing the location. */ matchLocationFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).location; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).location; } /** @@ -5192,7 +6585,9 @@ export class StreamsServiceClient { * @returns {string} A string representing the corpus. */ matchCorpusFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).corpus; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).corpus; } /** @@ -5203,7 +6598,9 @@ export class StreamsServiceClient { * @returns {string} A string representing the search_hypernym. */ matchSearchHypernymFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).search_hypernym; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).search_hypernym; } /** @@ -5215,7 +6612,12 @@ export class StreamsServiceClient { * @param {string} series * @returns {string} Resource name string. */ - seriesPath(project:string,location:string,cluster:string,series:string) { + seriesPath( + project: string, + location: string, + cluster: string, + series: string, + ) { return this.pathTemplates.seriesPathTemplate.render({ project: project, location: location, @@ -5277,7 +6679,12 @@ export class StreamsServiceClient { * @param {string} stream * @returns {string} Resource name string. */ - streamPath(project:string,location:string,cluster:string,stream:string) { + streamPath( + project: string, + location: string, + cluster: string, + stream: string, + ) { return this.pathTemplates.streamPathTemplate.render({ project: project, location: location, @@ -5338,15 +6745,19 @@ export class StreamsServiceClient { */ close(): Promise { if (this.streamsServiceStub && !this._terminated) { - return this.streamsServiceStub.then(stub => { + return this.streamsServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-visionai/src/v1/warehouse_client.ts b/packages/google-cloud-visionai/src/v1/warehouse_client.ts index 8d95f9145e4d..2b6716636074 100644 --- a/packages/google-cloud-visionai/src/v1/warehouse_client.ts +++ b/packages/google-cloud-visionai/src/v1/warehouse_client.ts @@ -18,11 +18,24 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform, PassThrough } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +57,7 @@ export class WarehouseClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('visionai'); @@ -57,12 +70,12 @@ export class WarehouseClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - warehouseStub?: Promise<{[name: string]: Function}>; + warehouseStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of WarehouseClient. @@ -103,21 +116,42 @@ export class WarehouseClient { * const client = new WarehouseClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof WarehouseClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'warehouse-visionai.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -142,7 +176,7 @@ export class WarehouseClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,18 +189,14 @@ export class WarehouseClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -188,70 +218,70 @@ export class WarehouseClient { // Create useful helper objects for these. this.pathTemplates = { analysisPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/analyses/{analysis}' + 'projects/{project}/locations/{location}/clusters/{cluster}/analyses/{analysis}', ), annotationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}', ), applicationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}' + 'projects/{project}/locations/{location}/applications/{application}', ), assetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}', ), channelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/channels/{channel}' + 'projects/{project}/locations/{location}/clusters/{cluster}/channels/{channel}', ), clusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}' + 'projects/{project}/locations/{location}/clusters/{cluster}', ), collectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}', ), corpusPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}', ), dataSchemaPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}', ), draftPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}/drafts/{draft}' + 'projects/{project}/locations/{location}/applications/{application}/drafts/{draft}', ), eventPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/events/{event}' + 'projects/{project}/locations/{location}/clusters/{cluster}/events/{event}', ), indexPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}', ), indexEndpointPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}' + 'projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}', ), instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/applications/{application}/instances/{instance}' + 'projects/{project}/locations/{location}/applications/{application}/instances/{instance}', ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), operatorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/operators/{operator}' + 'projects/{project}/locations/{location}/operators/{operator}', ), processPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/processes/{process}' + 'projects/{project}/locations/{location}/clusters/{cluster}/processes/{process}', ), processorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/processors/{processor}' + 'projects/{project}/locations/{location}/processors/{processor}', ), searchConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}', ), searchHypernymPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}' + 'projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}', ), seriesPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/series/{series}' + 'projects/{project}/locations/{location}/clusters/{cluster}/series/{series}', ), streamPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/clusters/{cluster}/streams/{stream}' + 'projects/{project}/locations/{location}/clusters/{cluster}/streams/{stream}', ), }; @@ -259,38 +289,81 @@ export class WarehouseClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'assets'), - viewIndexedAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'indexedAssets'), - listIndexes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'indexes'), - listCorpora: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'corpora'), - listDataSchemas: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'dataSchemas'), - listAnnotations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'annotations'), - listSearchConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'searchConfigs'), - listSearchHypernyms: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'searchHypernyms'), - searchAssets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'searchResultItems'), - searchIndexEndpoint: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'searchResultItems'), - listIndexEndpoints: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'indexEndpoints'), - listCollections: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'collections'), - viewCollectionItems: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'items') + listAssets: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'assets', + ), + viewIndexedAssets: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'indexedAssets', + ), + listIndexes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'indexes', + ), + listCorpora: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'corpora', + ), + listDataSchemas: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'dataSchemas', + ), + listAnnotations: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'annotations', + ), + listSearchConfigs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'searchConfigs', + ), + listSearchHypernyms: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'searchHypernyms', + ), + searchAssets: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'searchResultItems', + ), + searchIndexEndpoint: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'searchResultItems', + ), + listIndexEndpoints: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'indexEndpoints', + ), + listCollections: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'collections', + ), + viewCollectionItems: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'items', + ), }; // Some of the methods on this service provide streaming responses. // Provide descriptors for these. this.descriptors.stream = { - ingestAsset: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) + ingestAsset: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + !!opts.fallback, + !!opts.gaxServerStreamingRetries, + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -299,166 +372,269 @@ export class WarehouseClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',additional_bindings: [{get: '/v1/{name=projects/*/locations/*/warehouseOperations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/assets/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/collections/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/imageIndexes/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/indexes/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/corpora/*/operations/*}',},{get: '/v1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + additional_bindings: [ + { get: '/v1/{name=projects/*/locations/*/warehouseOperations/*}' }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/assets/*/operations/*}', + }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/collections/*/operations/*}', + }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/imageIndexes/*/operations/*}', + }, + { + get: '/v1/{name=projects/*/locations/*/corpora/*/indexes/*/operations/*}', + }, + { get: '/v1/{name=projects/*/locations/*/corpora/*/operations/*}' }, + { + get: '/v1/{name=projects/*/locations/*/indexEndpoints/*/operations/*}', + }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const deleteAssetResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteAssetMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.DeleteAssetMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.DeleteAssetMetadata', + ) as gax.protobuf.Type; const uploadAssetResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.UploadAssetResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.UploadAssetResponse', + ) as gax.protobuf.Type; const uploadAssetMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.UploadAssetMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.UploadAssetMetadata', + ) as gax.protobuf.Type; const analyzeAssetResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.AnalyzeAssetResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.AnalyzeAssetResponse', + ) as gax.protobuf.Type; const analyzeAssetMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.AnalyzeAssetMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.AnalyzeAssetMetadata', + ) as gax.protobuf.Type; const indexAssetResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.IndexAssetResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.IndexAssetResponse', + ) as gax.protobuf.Type; const indexAssetMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.IndexAssetMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.IndexAssetMetadata', + ) as gax.protobuf.Type; const removeIndexAssetResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.RemoveIndexAssetResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.RemoveIndexAssetResponse', + ) as gax.protobuf.Type; const removeIndexAssetMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.RemoveIndexAssetMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.RemoveIndexAssetMetadata', + ) as gax.protobuf.Type; const createIndexResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Index') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Index', + ) as gax.protobuf.Type; const createIndexMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.CreateIndexMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.CreateIndexMetadata', + ) as gax.protobuf.Type; const updateIndexResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Index') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Index', + ) as gax.protobuf.Type; const updateIndexMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.UpdateIndexMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.UpdateIndexMetadata', + ) as gax.protobuf.Type; const deleteIndexResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteIndexMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.DeleteIndexMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.DeleteIndexMetadata', + ) as gax.protobuf.Type; const createCorpusResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Corpus') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Corpus', + ) as gax.protobuf.Type; const createCorpusMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.CreateCorpusMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.CreateCorpusMetadata', + ) as gax.protobuf.Type; const analyzeCorpusResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.AnalyzeCorpusResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.AnalyzeCorpusResponse', + ) as gax.protobuf.Type; const analyzeCorpusMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.AnalyzeCorpusMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.AnalyzeCorpusMetadata', + ) as gax.protobuf.Type; const importAssetsResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.ImportAssetsResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.ImportAssetsResponse', + ) as gax.protobuf.Type; const importAssetsMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.ImportAssetsMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.ImportAssetsMetadata', + ) as gax.protobuf.Type; const createIndexEndpointResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.IndexEndpoint') as gax.protobuf.Type; + '.google.cloud.visionai.v1.IndexEndpoint', + ) as gax.protobuf.Type; const createIndexEndpointMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.CreateIndexEndpointMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.CreateIndexEndpointMetadata', + ) as gax.protobuf.Type; const updateIndexEndpointResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.IndexEndpoint') as gax.protobuf.Type; + '.google.cloud.visionai.v1.IndexEndpoint', + ) as gax.protobuf.Type; const updateIndexEndpointMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.UpdateIndexEndpointMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.UpdateIndexEndpointMetadata', + ) as gax.protobuf.Type; const deleteIndexEndpointResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteIndexEndpointMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.DeleteIndexEndpointMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.DeleteIndexEndpointMetadata', + ) as gax.protobuf.Type; const deployIndexResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.DeployIndexResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.DeployIndexResponse', + ) as gax.protobuf.Type; const deployIndexMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.DeployIndexMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.DeployIndexMetadata', + ) as gax.protobuf.Type; const undeployIndexResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.UndeployIndexResponse') as gax.protobuf.Type; + '.google.cloud.visionai.v1.UndeployIndexResponse', + ) as gax.protobuf.Type; const undeployIndexMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.UndeployIndexMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.UndeployIndexMetadata', + ) as gax.protobuf.Type; const createCollectionResponse = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.Collection') as gax.protobuf.Type; + '.google.cloud.visionai.v1.Collection', + ) as gax.protobuf.Type; const createCollectionMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.CreateCollectionMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.CreateCollectionMetadata', + ) as gax.protobuf.Type; const deleteCollectionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteCollectionMetadata = protoFilesRoot.lookup( - '.google.cloud.visionai.v1.DeleteCollectionMetadata') as gax.protobuf.Type; + '.google.cloud.visionai.v1.DeleteCollectionMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { deleteAsset: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteAssetResponse.decode.bind(deleteAssetResponse), - deleteAssetMetadata.decode.bind(deleteAssetMetadata)), + deleteAssetMetadata.decode.bind(deleteAssetMetadata), + ), uploadAsset: new this._gaxModule.LongrunningDescriptor( this.operationsClient, uploadAssetResponse.decode.bind(uploadAssetResponse), - uploadAssetMetadata.decode.bind(uploadAssetMetadata)), + uploadAssetMetadata.decode.bind(uploadAssetMetadata), + ), analyzeAsset: new this._gaxModule.LongrunningDescriptor( this.operationsClient, analyzeAssetResponse.decode.bind(analyzeAssetResponse), - analyzeAssetMetadata.decode.bind(analyzeAssetMetadata)), + analyzeAssetMetadata.decode.bind(analyzeAssetMetadata), + ), indexAsset: new this._gaxModule.LongrunningDescriptor( this.operationsClient, indexAssetResponse.decode.bind(indexAssetResponse), - indexAssetMetadata.decode.bind(indexAssetMetadata)), + indexAssetMetadata.decode.bind(indexAssetMetadata), + ), removeIndexAsset: new this._gaxModule.LongrunningDescriptor( this.operationsClient, removeIndexAssetResponse.decode.bind(removeIndexAssetResponse), - removeIndexAssetMetadata.decode.bind(removeIndexAssetMetadata)), + removeIndexAssetMetadata.decode.bind(removeIndexAssetMetadata), + ), createIndex: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createIndexResponse.decode.bind(createIndexResponse), - createIndexMetadata.decode.bind(createIndexMetadata)), + createIndexMetadata.decode.bind(createIndexMetadata), + ), updateIndex: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateIndexResponse.decode.bind(updateIndexResponse), - updateIndexMetadata.decode.bind(updateIndexMetadata)), + updateIndexMetadata.decode.bind(updateIndexMetadata), + ), deleteIndex: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteIndexResponse.decode.bind(deleteIndexResponse), - deleteIndexMetadata.decode.bind(deleteIndexMetadata)), + deleteIndexMetadata.decode.bind(deleteIndexMetadata), + ), createCorpus: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createCorpusResponse.decode.bind(createCorpusResponse), - createCorpusMetadata.decode.bind(createCorpusMetadata)), + createCorpusMetadata.decode.bind(createCorpusMetadata), + ), analyzeCorpus: new this._gaxModule.LongrunningDescriptor( this.operationsClient, analyzeCorpusResponse.decode.bind(analyzeCorpusResponse), - analyzeCorpusMetadata.decode.bind(analyzeCorpusMetadata)), + analyzeCorpusMetadata.decode.bind(analyzeCorpusMetadata), + ), importAssets: new this._gaxModule.LongrunningDescriptor( this.operationsClient, importAssetsResponse.decode.bind(importAssetsResponse), - importAssetsMetadata.decode.bind(importAssetsMetadata)), + importAssetsMetadata.decode.bind(importAssetsMetadata), + ), createIndexEndpoint: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createIndexEndpointResponse.decode.bind(createIndexEndpointResponse), - createIndexEndpointMetadata.decode.bind(createIndexEndpointMetadata)), + createIndexEndpointMetadata.decode.bind(createIndexEndpointMetadata), + ), updateIndexEndpoint: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateIndexEndpointResponse.decode.bind(updateIndexEndpointResponse), - updateIndexEndpointMetadata.decode.bind(updateIndexEndpointMetadata)), + updateIndexEndpointMetadata.decode.bind(updateIndexEndpointMetadata), + ), deleteIndexEndpoint: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteIndexEndpointResponse.decode.bind(deleteIndexEndpointResponse), - deleteIndexEndpointMetadata.decode.bind(deleteIndexEndpointMetadata)), + deleteIndexEndpointMetadata.decode.bind(deleteIndexEndpointMetadata), + ), deployIndex: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deployIndexResponse.decode.bind(deployIndexResponse), - deployIndexMetadata.decode.bind(deployIndexMetadata)), + deployIndexMetadata.decode.bind(deployIndexMetadata), + ), undeployIndex: new this._gaxModule.LongrunningDescriptor( this.operationsClient, undeployIndexResponse.decode.bind(undeployIndexResponse), - undeployIndexMetadata.decode.bind(undeployIndexMetadata)), + undeployIndexMetadata.decode.bind(undeployIndexMetadata), + ), createCollection: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createCollectionResponse.decode.bind(createCollectionResponse), - createCollectionMetadata.decode.bind(createCollectionMetadata)), + createCollectionMetadata.decode.bind(createCollectionMetadata), + ), deleteCollection: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteCollectionResponse.decode.bind(deleteCollectionResponse), - deleteCollectionMetadata.decode.bind(deleteCollectionMetadata)) + deleteCollectionMetadata.decode.bind(deleteCollectionMetadata), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.visionai.v1.Warehouse', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.visionai.v1.Warehouse', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -489,35 +665,109 @@ export class WarehouseClient { // Put together the "service stub" for // google.cloud.visionai.v1.Warehouse. this.warehouseStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.visionai.v1.Warehouse') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.visionai.v1.Warehouse', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.visionai.v1.Warehouse, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const warehouseStubMethods = - ['createAsset', 'updateAsset', 'getAsset', 'listAssets', 'deleteAsset', 'uploadAsset', 'generateRetrievalUrl', 'analyzeAsset', 'indexAsset', 'removeIndexAsset', 'viewIndexedAssets', 'createIndex', 'updateIndex', 'getIndex', 'listIndexes', 'deleteIndex', 'createCorpus', 'getCorpus', 'updateCorpus', 'listCorpora', 'deleteCorpus', 'analyzeCorpus', 'createDataSchema', 'updateDataSchema', 'getDataSchema', 'deleteDataSchema', 'listDataSchemas', 'createAnnotation', 'getAnnotation', 'listAnnotations', 'updateAnnotation', 'deleteAnnotation', 'ingestAsset', 'clipAsset', 'generateHlsUri', 'importAssets', 'createSearchConfig', 'updateSearchConfig', 'getSearchConfig', 'deleteSearchConfig', 'listSearchConfigs', 'createSearchHypernym', 'updateSearchHypernym', 'getSearchHypernym', 'deleteSearchHypernym', 'listSearchHypernyms', 'searchAssets', 'searchIndexEndpoint', 'createIndexEndpoint', 'getIndexEndpoint', 'listIndexEndpoints', 'updateIndexEndpoint', 'deleteIndexEndpoint', 'deployIndex', 'undeployIndex', 'createCollection', 'deleteCollection', 'getCollection', 'updateCollection', 'listCollections', 'addCollectionItem', 'removeCollectionItem', 'viewCollectionItems']; + const warehouseStubMethods = [ + 'createAsset', + 'updateAsset', + 'getAsset', + 'listAssets', + 'deleteAsset', + 'uploadAsset', + 'generateRetrievalUrl', + 'analyzeAsset', + 'indexAsset', + 'removeIndexAsset', + 'viewIndexedAssets', + 'createIndex', + 'updateIndex', + 'getIndex', + 'listIndexes', + 'deleteIndex', + 'createCorpus', + 'getCorpus', + 'updateCorpus', + 'listCorpora', + 'deleteCorpus', + 'analyzeCorpus', + 'createDataSchema', + 'updateDataSchema', + 'getDataSchema', + 'deleteDataSchema', + 'listDataSchemas', + 'createAnnotation', + 'getAnnotation', + 'listAnnotations', + 'updateAnnotation', + 'deleteAnnotation', + 'ingestAsset', + 'clipAsset', + 'generateHlsUri', + 'importAssets', + 'createSearchConfig', + 'updateSearchConfig', + 'getSearchConfig', + 'deleteSearchConfig', + 'listSearchConfigs', + 'createSearchHypernym', + 'updateSearchHypernym', + 'getSearchHypernym', + 'deleteSearchHypernym', + 'listSearchHypernyms', + 'searchAssets', + 'searchIndexEndpoint', + 'createIndexEndpoint', + 'getIndexEndpoint', + 'listIndexEndpoints', + 'updateIndexEndpoint', + 'deleteIndexEndpoint', + 'deployIndex', + 'undeployIndex', + 'createCollection', + 'deleteCollection', + 'getCollection', + 'updateCollection', + 'listCollections', + 'addCollectionItem', + 'removeCollectionItem', + 'viewCollectionItems', + ]; for (const methodName of warehouseStubMethods) { const callPromise = this.warehouseStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough({ objectMode: true }); + setImmediate(() => { + stream.emit( + 'error', + new this._gaxModule.GoogleError( + 'The client has already been closed.', + ), + ); + }); + return stream; + } + return Promise.reject('The client has already been closed.'); } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); const descriptor = this.descriptors.page[methodName] || @@ -528,7 +778,7 @@ export class WarehouseClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -543,8 +793,14 @@ export class WarehouseClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'warehouse-visionai.googleapis.com'; } @@ -555,8 +811,14 @@ export class WarehouseClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'warehouse-visionai.googleapis.com'; } @@ -587,9 +849,7 @@ export class WarehouseClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -598,8 +858,9 @@ export class WarehouseClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -610,5231 +871,7542 @@ export class WarehouseClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Creates an asset inside corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this asset will be created. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` - * @param {google.cloud.visionai.v1.Asset} request.asset - * Required. The asset to create. - * @param {string} [request.assetId] - * Optional. The ID to use for the asset, which will become the final - * component of the asset's resource name if user choose to specify. - * Otherwise, asset id will be generated by system. - * - * This value should be up to 63 characters, and valid characters - * are /{@link protos.0-9|a-z}-/. The first character must be a letter, the last could be - * a letter or a number. - * @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 protos.google.cloud.visionai.v1.Asset|Asset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.create_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateAsset_async - */ + /** + * Creates an asset inside corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this asset will be created. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` + * @param {google.cloud.visionai.v1.Asset} request.asset + * Required. The asset to create. + * @param {string} [request.assetId] + * Optional. The ID to use for the asset, which will become the final + * component of the asset's resource name if user choose to specify. + * Otherwise, asset id will be generated by system. + * + * This value should be up to 63 characters, and valid characters + * are /{@link protos.0-9|a-z}-/. The first character must be a letter, the last could be + * a letter or a number. + * @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 protos.google.cloud.visionai.v1.Asset|Asset}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.create_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateAsset_async + */ createAsset( - request?: protos.google.cloud.visionai.v1.ICreateAssetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.ICreateAssetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateAssetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.ICreateAssetRequest | undefined, + {} | undefined, + ] + >; createAsset( - request: protos.google.cloud.visionai.v1.ICreateAssetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.ICreateAssetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateAssetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.ICreateAssetRequest | null | undefined, + {} | null | undefined + >, + ): void; createAsset( - request: protos.google.cloud.visionai.v1.ICreateAssetRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.ICreateAssetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateAssetRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.ICreateAssetRequest | null | undefined, + {} | null | undefined + >, + ): void; createAsset( - request?: protos.google.cloud.visionai.v1.ICreateAssetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.ICreateAssetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.ICreateAssetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.ICreateAssetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.ICreateAssetRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.ICreateAssetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.ICreateAssetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.ICreateAssetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createAsset request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.ICreateAssetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IAsset, + | protos.google.cloud.visionai.v1.ICreateAssetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createAsset response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createAsset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.ICreateAssetRequest|undefined, - {}|undefined - ]) => { - this._log.info('createAsset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createAsset(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.ICreateAssetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createAsset response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates an asset inside corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.Asset} request.asset - * Required. The asset to update. - * - * The asset's `name` field is used to identify the asset to be updated. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}` - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. - * @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 protos.google.cloud.visionai.v1.Asset|Asset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.update_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateAsset_async - */ + /** + * Updates an asset inside corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.Asset} request.asset + * Required. The asset to update. + * + * The asset's `name` field is used to identify the asset to be updated. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}` + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * @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 protos.google.cloud.visionai.v1.Asset|Asset}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.update_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateAsset_async + */ updateAsset( - request?: protos.google.cloud.visionai.v1.IUpdateAssetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IUpdateAssetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateAssetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.IUpdateAssetRequest | undefined, + {} | undefined, + ] + >; updateAsset( - request: protos.google.cloud.visionai.v1.IUpdateAssetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IUpdateAssetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateAssetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.IUpdateAssetRequest | null | undefined, + {} | null | undefined + >, + ): void; updateAsset( - request: protos.google.cloud.visionai.v1.IUpdateAssetRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IUpdateAssetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateAssetRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.IUpdateAssetRequest | null | undefined, + {} | null | undefined + >, + ): void; updateAsset( - request?: protos.google.cloud.visionai.v1.IUpdateAssetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IUpdateAssetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IUpdateAssetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IUpdateAssetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IUpdateAssetRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IUpdateAssetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.IUpdateAssetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.IUpdateAssetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'asset.name': request.asset!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'asset.name': request.asset!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateAsset request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IUpdateAssetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IAsset, + | protos.google.cloud.visionai.v1.IUpdateAssetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateAsset response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateAsset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IUpdateAssetRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateAsset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateAsset(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.IUpdateAssetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateAsset response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Reads an asset inside corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the asset to retrieve. - * Format: - * projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset} - * @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 protos.google.cloud.visionai.v1.Asset|Asset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.get_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_GetAsset_async - */ + /** + * Reads an asset inside corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the asset to retrieve. + * Format: + * projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset} + * @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 protos.google.cloud.visionai.v1.Asset|Asset}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.get_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_GetAsset_async + */ getAsset( - request?: protos.google.cloud.visionai.v1.IGetAssetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IGetAssetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetAssetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.IGetAssetRequest | undefined, + {} | undefined, + ] + >; getAsset( - request: protos.google.cloud.visionai.v1.IGetAssetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IGetAssetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetAssetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.IGetAssetRequest | null | undefined, + {} | null | undefined + >, + ): void; getAsset( - request: protos.google.cloud.visionai.v1.IGetAssetRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IGetAssetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetAssetRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.IGetAssetRequest | null | undefined, + {} | null | undefined + >, + ): void; getAsset( - request?: protos.google.cloud.visionai.v1.IGetAssetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IGetAssetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetAssetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IGetAssetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IGetAssetRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.visionai.v1.IGetAssetRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.IGetAssetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.IGetAssetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getAsset request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IGetAssetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.IGetAssetRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getAsset response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getAsset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IAsset, - protos.google.cloud.visionai.v1.IGetAssetRequest|undefined, - {}|undefined - ]) => { - this._log.info('getAsset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getAsset(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IAsset, + protos.google.cloud.visionai.v1.IGetAssetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getAsset response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Generates a signed url for downloading the asset. - * For video warehouse, please see comment of UploadAsset about how to allow - * retrieval of cloud storage files in a different project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the asset to request signed url for. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` - * @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 protos.google.cloud.visionai.v1.GenerateRetrievalUrlResponse|GenerateRetrievalUrlResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.generate_retrieval_url.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_GenerateRetrievalUrl_async - */ + /** + * Generates a signed url for downloading the asset. + * For video warehouse, please see comment of UploadAsset about how to allow + * retrieval of cloud storage files in a different project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the asset to request signed url for. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` + * @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 protos.google.cloud.visionai.v1.GenerateRetrievalUrlResponse|GenerateRetrievalUrlResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.generate_retrieval_url.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_GenerateRetrievalUrl_async + */ generateRetrievalUrl( - request?: protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, + protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest | undefined, + {} | undefined, + ] + >; generateRetrievalUrl( - request: protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, + | protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest + | null + | undefined, + {} | null | undefined + >, + ): void; generateRetrievalUrl( - request: protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, + | protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest + | null + | undefined, + {} | null | undefined + >, + ): void; generateRetrievalUrl( - request?: protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, + | protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, + protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('generateRetrievalUrl request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, + | protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('generateRetrievalUrl response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.generateRetrievalUrl(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, - protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest|undefined, - {}|undefined - ]) => { - this._log.info('generateRetrievalUrl response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .generateRetrievalUrl(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse, + ( + | protos.google.cloud.visionai.v1.IGenerateRetrievalUrlRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('generateRetrievalUrl response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets the details of a single Index under a Corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the Index resource. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}` - * @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 protos.google.cloud.visionai.v1.Index|Index}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.get_index.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_GetIndex_async - */ + /** + * Gets the details of a single Index under a Corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the Index resource. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}` + * @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 protos.google.cloud.visionai.v1.Index|Index}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.get_index.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_GetIndex_async + */ getIndex( - request?: protos.google.cloud.visionai.v1.IGetIndexRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IIndex, - protos.google.cloud.visionai.v1.IGetIndexRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetIndexRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IGetIndexRequest | undefined, + {} | undefined, + ] + >; getIndex( - request: protos.google.cloud.visionai.v1.IGetIndexRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IIndex, - protos.google.cloud.visionai.v1.IGetIndexRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetIndexRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IGetIndexRequest | null | undefined, + {} | null | undefined + >, + ): void; getIndex( - request: protos.google.cloud.visionai.v1.IGetIndexRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IIndex, - protos.google.cloud.visionai.v1.IGetIndexRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetIndexRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IGetIndexRequest | null | undefined, + {} | null | undefined + >, + ): void; getIndex( - request?: protos.google.cloud.visionai.v1.IGetIndexRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IIndex, - protos.google.cloud.visionai.v1.IGetIndexRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetIndexRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IIndex, - protos.google.cloud.visionai.v1.IGetIndexRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IIndex, - protos.google.cloud.visionai.v1.IGetIndexRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.visionai.v1.IGetIndexRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IGetIndexRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IGetIndexRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getIndex request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IIndex, - protos.google.cloud.visionai.v1.IGetIndexRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IGetIndexRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getIndex response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getIndex(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IIndex, - protos.google.cloud.visionai.v1.IGetIndexRequest|undefined, - {}|undefined - ]) => { - this._log.info('getIndex response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getIndex(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IGetIndexRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getIndex response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets corpus details inside a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the corpus to retrieve. - * @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 protos.google.cloud.visionai.v1.Corpus|Corpus}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.get_corpus.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_GetCorpus_async - */ + /** + * Gets corpus details inside a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the corpus to retrieve. + * @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 protos.google.cloud.visionai.v1.Corpus|Corpus}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.get_corpus.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_GetCorpus_async + */ getCorpus( - request?: protos.google.cloud.visionai.v1.IGetCorpusRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IGetCorpusRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetCorpusRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.IGetCorpusRequest | undefined, + {} | undefined, + ] + >; getCorpus( - request: protos.google.cloud.visionai.v1.IGetCorpusRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IGetCorpusRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetCorpusRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.IGetCorpusRequest | null | undefined, + {} | null | undefined + >, + ): void; getCorpus( - request: protos.google.cloud.visionai.v1.IGetCorpusRequest, - callback: Callback< - protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IGetCorpusRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetCorpusRequest, + callback: Callback< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.IGetCorpusRequest | null | undefined, + {} | null | undefined + >, + ): void; getCorpus( - request?: protos.google.cloud.visionai.v1.IGetCorpusRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IGetCorpusRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetCorpusRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IGetCorpusRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IGetCorpusRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.visionai.v1.IGetCorpusRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.IGetCorpusRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.IGetCorpusRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getCorpus request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IGetCorpusRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.IGetCorpusRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getCorpus response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getCorpus(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IGetCorpusRequest|undefined, - {}|undefined - ]) => { - this._log.info('getCorpus response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getCorpus(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.IGetCorpusRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getCorpus response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates a corpus in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.Corpus} request.corpus - * Required. The corpus which replaces the resource on the server. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. - * @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 protos.google.cloud.visionai.v1.Corpus|Corpus}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.update_corpus.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateCorpus_async - */ + /** + * Updates a corpus in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.Corpus} request.corpus + * Required. The corpus which replaces the resource on the server. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * @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 protos.google.cloud.visionai.v1.Corpus|Corpus}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.update_corpus.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateCorpus_async + */ updateCorpus( - request?: protos.google.cloud.visionai.v1.IUpdateCorpusRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IUpdateCorpusRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateCorpusRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.IUpdateCorpusRequest | undefined, + {} | undefined, + ] + >; updateCorpus( - request: protos.google.cloud.visionai.v1.IUpdateCorpusRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IUpdateCorpusRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateCorpusRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.IUpdateCorpusRequest | null | undefined, + {} | null | undefined + >, + ): void; updateCorpus( - request: protos.google.cloud.visionai.v1.IUpdateCorpusRequest, - callback: Callback< - protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IUpdateCorpusRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateCorpusRequest, + callback: Callback< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.IUpdateCorpusRequest | null | undefined, + {} | null | undefined + >, + ): void; updateCorpus( - request?: protos.google.cloud.visionai.v1.IUpdateCorpusRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IUpdateCorpusRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IUpdateCorpusRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IUpdateCorpusRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IUpdateCorpusRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IUpdateCorpusRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.IUpdateCorpusRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.IUpdateCorpusRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'corpus.name': request.corpus!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'corpus.name': request.corpus!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateCorpus request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IUpdateCorpusRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.ICorpus, + | protos.google.cloud.visionai.v1.IUpdateCorpusRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateCorpus response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateCorpus(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.ICorpus, - protos.google.cloud.visionai.v1.IUpdateCorpusRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateCorpus response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateCorpus(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.IUpdateCorpusRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateCorpus response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes a corpus only if its empty. - * Returns empty response. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the corpus to delete. - * @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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.delete_corpus.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteCorpus_async - */ + /** + * Deletes a corpus only if its empty. + * Returns empty response. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the corpus to delete. + * @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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.delete_corpus.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteCorpus_async + */ deleteCorpus( - request?: protos.google.cloud.visionai.v1.IDeleteCorpusRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteCorpusRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteCorpusRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCorpusRequest | undefined, + {} | undefined, + ] + >; deleteCorpus( - request: protos.google.cloud.visionai.v1.IDeleteCorpusRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteCorpusRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteCorpusRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCorpusRequest | null | undefined, + {} | null | undefined + >, + ): void; deleteCorpus( - request: protos.google.cloud.visionai.v1.IDeleteCorpusRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteCorpusRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteCorpusRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCorpusRequest | null | undefined, + {} | null | undefined + >, + ): void; deleteCorpus( - request?: protos.google.cloud.visionai.v1.IDeleteCorpusRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteCorpusRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IDeleteCorpusRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteCorpusRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteCorpusRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IDeleteCorpusRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCorpusRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCorpusRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteCorpus request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteCorpusRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteCorpusRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteCorpus response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteCorpus(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteCorpusRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteCorpus response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .deleteCorpus(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCorpusRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteCorpus response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates data schema inside corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this data schema will be created. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` - * @param {google.cloud.visionai.v1.DataSchema} request.dataSchema - * Required. The data schema to create. - * @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 protos.google.cloud.visionai.v1.DataSchema|DataSchema}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.create_data_schema.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateDataSchema_async - */ + /** + * Creates data schema inside corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this data schema will be created. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` + * @param {google.cloud.visionai.v1.DataSchema} request.dataSchema + * Required. The data schema to create. + * @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 protos.google.cloud.visionai.v1.DataSchema|DataSchema}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.create_data_schema.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateDataSchema_async + */ createDataSchema( - request?: protos.google.cloud.visionai.v1.ICreateDataSchemaRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.ICreateDataSchemaRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateDataSchemaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IDataSchema, + protos.google.cloud.visionai.v1.ICreateDataSchemaRequest | undefined, + {} | undefined, + ] + >; createDataSchema( - request: protos.google.cloud.visionai.v1.ICreateDataSchemaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.ICreateDataSchemaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateDataSchemaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IDataSchema, + | protos.google.cloud.visionai.v1.ICreateDataSchemaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createDataSchema( - request: protos.google.cloud.visionai.v1.ICreateDataSchemaRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.ICreateDataSchemaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateDataSchemaRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IDataSchema, + | protos.google.cloud.visionai.v1.ICreateDataSchemaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createDataSchema( - request?: protos.google.cloud.visionai.v1.ICreateDataSchemaRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.ICreateDataSchemaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.ICreateDataSchemaRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.ICreateDataSchemaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.ICreateDataSchemaRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.ICreateDataSchemaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IDataSchema, + | protos.google.cloud.visionai.v1.ICreateDataSchemaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IDataSchema, + protos.google.cloud.visionai.v1.ICreateDataSchemaRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createDataSchema request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.ICreateDataSchemaRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IDataSchema, + | protos.google.cloud.visionai.v1.ICreateDataSchemaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createDataSchema response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createDataSchema(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.ICreateDataSchemaRequest|undefined, - {}|undefined - ]) => { - this._log.info('createDataSchema response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createDataSchema(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IDataSchema, + protos.google.cloud.visionai.v1.ICreateDataSchemaRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createDataSchema response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates data schema inside corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.DataSchema} request.dataSchema - * Required. The data schema's `name` field is used to identify the data - * schema to be updated. Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}` - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. - * @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 protos.google.cloud.visionai.v1.DataSchema|DataSchema}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.update_data_schema.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateDataSchema_async - */ + /** + * Updates data schema inside corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.DataSchema} request.dataSchema + * Required. The data schema's `name` field is used to identify the data + * schema to be updated. Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/dataSchemas/{data_schema}` + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * @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 protos.google.cloud.visionai.v1.DataSchema|DataSchema}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.update_data_schema.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateDataSchema_async + */ updateDataSchema( - request?: protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IDataSchema, + protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest | undefined, + {} | undefined, + ] + >; updateDataSchema( - request: protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IDataSchema, + | protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateDataSchema( - request: protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IDataSchema, + | protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateDataSchema( - request?: protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IDataSchema, + | protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IDataSchema, + protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'data_schema.name': request.dataSchema!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'data_schema.name': request.dataSchema!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateDataSchema request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IDataSchema, + | protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateDataSchema response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateDataSchema(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateDataSchema response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateDataSchema(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IDataSchema, + protos.google.cloud.visionai.v1.IUpdateDataSchemaRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateDataSchema response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets data schema inside corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the data schema to retrieve. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}` - * @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 protos.google.cloud.visionai.v1.DataSchema|DataSchema}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.get_data_schema.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_GetDataSchema_async - */ + /** + * Gets data schema inside corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the data schema to retrieve. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}` + * @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 protos.google.cloud.visionai.v1.DataSchema|DataSchema}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.get_data_schema.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_GetDataSchema_async + */ getDataSchema( - request?: protos.google.cloud.visionai.v1.IGetDataSchemaRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IGetDataSchemaRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetDataSchemaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IDataSchema, + protos.google.cloud.visionai.v1.IGetDataSchemaRequest | undefined, + {} | undefined, + ] + >; getDataSchema( - request: protos.google.cloud.visionai.v1.IGetDataSchemaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IGetDataSchemaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetDataSchemaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IDataSchema, + protos.google.cloud.visionai.v1.IGetDataSchemaRequest | null | undefined, + {} | null | undefined + >, + ): void; getDataSchema( - request: protos.google.cloud.visionai.v1.IGetDataSchemaRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IGetDataSchemaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetDataSchemaRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IDataSchema, + protos.google.cloud.visionai.v1.IGetDataSchemaRequest | null | undefined, + {} | null | undefined + >, + ): void; getDataSchema( - request?: protos.google.cloud.visionai.v1.IGetDataSchemaRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IGetDataSchemaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetDataSchemaRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IGetDataSchemaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IGetDataSchemaRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IGetDataSchemaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IDataSchema, + protos.google.cloud.visionai.v1.IGetDataSchemaRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IDataSchema, + protos.google.cloud.visionai.v1.IGetDataSchemaRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getDataSchema request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IGetDataSchemaRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IDataSchema, + | protos.google.cloud.visionai.v1.IGetDataSchemaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getDataSchema response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getDataSchema(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IDataSchema, - protos.google.cloud.visionai.v1.IGetDataSchemaRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDataSchema response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getDataSchema(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IDataSchema, + protos.google.cloud.visionai.v1.IGetDataSchemaRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getDataSchema response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes data schema inside corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the data schema to delete. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}` - * @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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.delete_data_schema.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteDataSchema_async - */ + /** + * Deletes data schema inside corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the data schema to delete. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/dataSchemas/{data_schema_id}` + * @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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.delete_data_schema.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteDataSchema_async + */ deleteDataSchema( - request?: protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest | undefined, + {} | undefined, + ] + >; deleteDataSchema( - request: protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteDataSchema( - request: protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteDataSchema( - request?: protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteDataSchema request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteDataSchema response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteDataSchema(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteDataSchema response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .deleteDataSchema(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteDataSchemaRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteDataSchema response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates annotation inside asset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this annotation will be created. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` - * @param {google.cloud.visionai.v1.Annotation} request.annotation - * Required. The annotation to create. - * @param {string} [request.annotationId] - * Optional. The ID to use for the annotation, which will become the final - * component of the annotation's resource name if user choose to specify. - * Otherwise, annotation id will be generated by system. - * - * This value should be up to 63 characters, and valid characters - * are /{@link protos.0-9|a-z}-/. The first character must be a letter, the last could be - * a letter or a number. - * @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 protos.google.cloud.visionai.v1.Annotation|Annotation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.create_annotation.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateAnnotation_async - */ + /** + * Creates annotation inside asset. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this annotation will be created. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` + * @param {google.cloud.visionai.v1.Annotation} request.annotation + * Required. The annotation to create. + * @param {string} [request.annotationId] + * Optional. The ID to use for the annotation, which will become the final + * component of the annotation's resource name if user choose to specify. + * Otherwise, annotation id will be generated by system. + * + * This value should be up to 63 characters, and valid characters + * are /{@link protos.0-9|a-z}-/. The first character must be a letter, the last could be + * a letter or a number. + * @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 protos.google.cloud.visionai.v1.Annotation|Annotation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.create_annotation.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateAnnotation_async + */ createAnnotation( - request?: protos.google.cloud.visionai.v1.ICreateAnnotationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.ICreateAnnotationRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateAnnotationRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAnnotation, + protos.google.cloud.visionai.v1.ICreateAnnotationRequest | undefined, + {} | undefined, + ] + >; createAnnotation( - request: protos.google.cloud.visionai.v1.ICreateAnnotationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.ICreateAnnotationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateAnnotationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IAnnotation, + | protos.google.cloud.visionai.v1.ICreateAnnotationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createAnnotation( - request: protos.google.cloud.visionai.v1.ICreateAnnotationRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.ICreateAnnotationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateAnnotationRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IAnnotation, + | protos.google.cloud.visionai.v1.ICreateAnnotationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createAnnotation( - request?: protos.google.cloud.visionai.v1.ICreateAnnotationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.ICreateAnnotationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.ICreateAnnotationRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.ICreateAnnotationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.ICreateAnnotationRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.ICreateAnnotationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IAnnotation, + | protos.google.cloud.visionai.v1.ICreateAnnotationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAnnotation, + protos.google.cloud.visionai.v1.ICreateAnnotationRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createAnnotation request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.ICreateAnnotationRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IAnnotation, + | protos.google.cloud.visionai.v1.ICreateAnnotationRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createAnnotation response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createAnnotation(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.ICreateAnnotationRequest|undefined, - {}|undefined - ]) => { - this._log.info('createAnnotation response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createAnnotation(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IAnnotation, + protos.google.cloud.visionai.v1.ICreateAnnotationRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createAnnotation response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Reads annotation inside asset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the annotation to retrieve. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}` - * @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 protos.google.cloud.visionai.v1.Annotation|Annotation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.get_annotation.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_GetAnnotation_async - */ + /** + * Reads annotation inside asset. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the annotation to retrieve. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}` + * @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 protos.google.cloud.visionai.v1.Annotation|Annotation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.get_annotation.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_GetAnnotation_async + */ getAnnotation( - request?: protos.google.cloud.visionai.v1.IGetAnnotationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IGetAnnotationRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetAnnotationRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAnnotation, + protos.google.cloud.visionai.v1.IGetAnnotationRequest | undefined, + {} | undefined, + ] + >; getAnnotation( - request: protos.google.cloud.visionai.v1.IGetAnnotationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IGetAnnotationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetAnnotationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IAnnotation, + protos.google.cloud.visionai.v1.IGetAnnotationRequest | null | undefined, + {} | null | undefined + >, + ): void; getAnnotation( - request: protos.google.cloud.visionai.v1.IGetAnnotationRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IGetAnnotationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetAnnotationRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IAnnotation, + protos.google.cloud.visionai.v1.IGetAnnotationRequest | null | undefined, + {} | null | undefined + >, + ): void; getAnnotation( - request?: protos.google.cloud.visionai.v1.IGetAnnotationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IGetAnnotationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetAnnotationRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IGetAnnotationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IGetAnnotationRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IGetAnnotationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IAnnotation, + protos.google.cloud.visionai.v1.IGetAnnotationRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAnnotation, + protos.google.cloud.visionai.v1.IGetAnnotationRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getAnnotation request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IGetAnnotationRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IAnnotation, + | protos.google.cloud.visionai.v1.IGetAnnotationRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getAnnotation response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getAnnotation(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IGetAnnotationRequest|undefined, - {}|undefined - ]) => { - this._log.info('getAnnotation response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getAnnotation(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IAnnotation, + protos.google.cloud.visionai.v1.IGetAnnotationRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getAnnotation response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates annotation inside asset. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.Annotation} request.annotation - * Required. The annotation to update. - * The annotation's `name` field is used to identify the annotation to be - * updated. Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}` - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. - * @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 protos.google.cloud.visionai.v1.Annotation|Annotation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.update_annotation.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateAnnotation_async - */ + /** + * Updates annotation inside asset. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.Annotation} request.annotation + * Required. The annotation to update. + * The annotation's `name` field is used to identify the annotation to be + * updated. Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}` + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * @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 protos.google.cloud.visionai.v1.Annotation|Annotation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.update_annotation.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateAnnotation_async + */ updateAnnotation( - request?: protos.google.cloud.visionai.v1.IUpdateAnnotationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IUpdateAnnotationRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateAnnotationRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAnnotation, + protos.google.cloud.visionai.v1.IUpdateAnnotationRequest | undefined, + {} | undefined, + ] + >; updateAnnotation( - request: protos.google.cloud.visionai.v1.IUpdateAnnotationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IUpdateAnnotationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateAnnotationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IAnnotation, + | protos.google.cloud.visionai.v1.IUpdateAnnotationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateAnnotation( - request: protos.google.cloud.visionai.v1.IUpdateAnnotationRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IUpdateAnnotationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateAnnotationRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IAnnotation, + | protos.google.cloud.visionai.v1.IUpdateAnnotationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateAnnotation( - request?: protos.google.cloud.visionai.v1.IUpdateAnnotationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IUpdateAnnotationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IUpdateAnnotationRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IUpdateAnnotationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IUpdateAnnotationRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IUpdateAnnotationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IAnnotation, + | protos.google.cloud.visionai.v1.IUpdateAnnotationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAnnotation, + protos.google.cloud.visionai.v1.IUpdateAnnotationRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'annotation.name': request.annotation!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'annotation.name': request.annotation!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateAnnotation request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IUpdateAnnotationRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IAnnotation, + | protos.google.cloud.visionai.v1.IUpdateAnnotationRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateAnnotation response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateAnnotation(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IAnnotation, - protos.google.cloud.visionai.v1.IUpdateAnnotationRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateAnnotation response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateAnnotation(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IAnnotation, + protos.google.cloud.visionai.v1.IUpdateAnnotationRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateAnnotation response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes annotation inside asset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the annotation to delete. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}` - * @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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.delete_annotation.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteAnnotation_async - */ + /** + * Deletes annotation inside asset. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the annotation to delete. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}/annotations/{annotation}` + * @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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.delete_annotation.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteAnnotation_async + */ deleteAnnotation( - request?: protos.google.cloud.visionai.v1.IDeleteAnnotationRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteAnnotationRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteAnnotationRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteAnnotationRequest | undefined, + {} | undefined, + ] + >; deleteAnnotation( - request: protos.google.cloud.visionai.v1.IDeleteAnnotationRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteAnnotationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteAnnotationRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteAnnotationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteAnnotation( - request: protos.google.cloud.visionai.v1.IDeleteAnnotationRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteAnnotationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteAnnotationRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteAnnotationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteAnnotation( - request?: protos.google.cloud.visionai.v1.IDeleteAnnotationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteAnnotationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IDeleteAnnotationRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteAnnotationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteAnnotationRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IDeleteAnnotationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteAnnotationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteAnnotationRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteAnnotation request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteAnnotationRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteAnnotationRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteAnnotation response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteAnnotation(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteAnnotationRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteAnnotation response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .deleteAnnotation(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteAnnotationRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteAnnotation response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Supported by STREAM_VIDEO corpus type. - * Generates clips for downloading. The api takes in a time range, and - * generates a clip of the first content available after start_time and - * before end_time, which may overflow beyond these bounds. - * Returned clips are truncated if the total size of the clips are larger - * than 100MB. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the asset to request clips for. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` - * @param {google.cloud.visionai.v1.Partition.TemporalPartition} request.temporalPartition - * Required. The time range to request clips for. - * @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 protos.google.cloud.visionai.v1.ClipAssetResponse|ClipAssetResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.clip_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_ClipAsset_async - */ + /** + * Supported by STREAM_VIDEO corpus type. + * Generates clips for downloading. The api takes in a time range, and + * generates a clip of the first content available after start_time and + * before end_time, which may overflow beyond these bounds. + * Returned clips are truncated if the total size of the clips are larger + * than 100MB. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the asset to request clips for. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` + * @param {google.cloud.visionai.v1.Partition.TemporalPartition} request.temporalPartition + * Required. The time range to request clips for. + * @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 protos.google.cloud.visionai.v1.ClipAssetResponse|ClipAssetResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.clip_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_ClipAsset_async + */ clipAsset( - request?: protos.google.cloud.visionai.v1.IClipAssetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IClipAssetResponse, - protos.google.cloud.visionai.v1.IClipAssetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IClipAssetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IClipAssetResponse, + protos.google.cloud.visionai.v1.IClipAssetRequest | undefined, + {} | undefined, + ] + >; clipAsset( - request: protos.google.cloud.visionai.v1.IClipAssetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IClipAssetResponse, - protos.google.cloud.visionai.v1.IClipAssetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IClipAssetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IClipAssetResponse, + protos.google.cloud.visionai.v1.IClipAssetRequest | null | undefined, + {} | null | undefined + >, + ): void; clipAsset( - request: protos.google.cloud.visionai.v1.IClipAssetRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IClipAssetResponse, - protos.google.cloud.visionai.v1.IClipAssetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IClipAssetRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IClipAssetResponse, + protos.google.cloud.visionai.v1.IClipAssetRequest | null | undefined, + {} | null | undefined + >, + ): void; clipAsset( - request?: protos.google.cloud.visionai.v1.IClipAssetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IClipAssetResponse, - protos.google.cloud.visionai.v1.IClipAssetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IClipAssetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IClipAssetResponse, - protos.google.cloud.visionai.v1.IClipAssetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IClipAssetResponse, - protos.google.cloud.visionai.v1.IClipAssetRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.visionai.v1.IClipAssetRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IClipAssetResponse, + protos.google.cloud.visionai.v1.IClipAssetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IClipAssetResponse, + protos.google.cloud.visionai.v1.IClipAssetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('clipAsset request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IClipAssetResponse, - protos.google.cloud.visionai.v1.IClipAssetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IClipAssetResponse, + protos.google.cloud.visionai.v1.IClipAssetRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('clipAsset response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.clipAsset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IClipAssetResponse, - protos.google.cloud.visionai.v1.IClipAssetRequest|undefined, - {}|undefined - ]) => { - this._log.info('clipAsset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .clipAsset(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IClipAssetResponse, + protos.google.cloud.visionai.v1.IClipAssetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('clipAsset response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Generates a uri for an HLS manifest. The api takes in a collection of time - * ranges, and generates a URI for an HLS manifest that covers all the - * requested time ranges. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the asset to request clips for. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` - * @param {number[]} request.temporalPartitions - * The time range to request clips for. Will be ignored if `get_live_view` is - * set to True. The total time range requested should be smaller than 24h. - * @param {boolean} request.liveViewEnabled - * Option to exclusively show a livestream of the asset with up to 3 minutes - * of backlog data. - * @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 protos.google.cloud.visionai.v1.GenerateHlsUriResponse|GenerateHlsUriResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.generate_hls_uri.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_GenerateHlsUri_async - */ + /** + * Generates a uri for an HLS manifest. The api takes in a collection of time + * ranges, and generates a URI for an HLS manifest that covers all the + * requested time ranges. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the asset to request clips for. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` + * @param {number[]} request.temporalPartitions + * The time range to request clips for. Will be ignored if `get_live_view` is + * set to True. The total time range requested should be smaller than 24h. + * @param {boolean} request.liveViewEnabled + * Option to exclusively show a livestream of the asset with up to 3 minutes + * of backlog data. + * @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 protos.google.cloud.visionai.v1.GenerateHlsUriResponse|GenerateHlsUriResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.generate_hls_uri.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_GenerateHlsUri_async + */ generateHlsUri( - request?: protos.google.cloud.visionai.v1.IGenerateHlsUriRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, - protos.google.cloud.visionai.v1.IGenerateHlsUriRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGenerateHlsUriRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, + protos.google.cloud.visionai.v1.IGenerateHlsUriRequest | undefined, + {} | undefined, + ] + >; generateHlsUri( - request: protos.google.cloud.visionai.v1.IGenerateHlsUriRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, - protos.google.cloud.visionai.v1.IGenerateHlsUriRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGenerateHlsUriRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, + protos.google.cloud.visionai.v1.IGenerateHlsUriRequest | null | undefined, + {} | null | undefined + >, + ): void; generateHlsUri( - request: protos.google.cloud.visionai.v1.IGenerateHlsUriRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, - protos.google.cloud.visionai.v1.IGenerateHlsUriRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGenerateHlsUriRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, + protos.google.cloud.visionai.v1.IGenerateHlsUriRequest | null | undefined, + {} | null | undefined + >, + ): void; generateHlsUri( - request?: protos.google.cloud.visionai.v1.IGenerateHlsUriRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, - protos.google.cloud.visionai.v1.IGenerateHlsUriRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGenerateHlsUriRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, - protos.google.cloud.visionai.v1.IGenerateHlsUriRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, - protos.google.cloud.visionai.v1.IGenerateHlsUriRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { + | protos.google.cloud.visionai.v1.IGenerateHlsUriRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, + protos.google.cloud.visionai.v1.IGenerateHlsUriRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, + protos.google.cloud.visionai.v1.IGenerateHlsUriRequest | 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 || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('generateHlsUri request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, - protos.google.cloud.visionai.v1.IGenerateHlsUriRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, + | protos.google.cloud.visionai.v1.IGenerateHlsUriRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('generateHlsUri response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.generateHlsUri(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, - protos.google.cloud.visionai.v1.IGenerateHlsUriRequest|undefined, - {}|undefined - ]) => { - this._log.info('generateHlsUri response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .generateHlsUri(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IGenerateHlsUriResponse, + protos.google.cloud.visionai.v1.IGenerateHlsUriRequest | undefined, + {} | undefined, + ]) => { + this._log.info('generateHlsUri response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a search configuration inside a corpus. - * - * Please follow the rules below to create a valid CreateSearchConfigRequest. - * --- General Rules --- - * 1. Request.search_config_id must not be associated with an existing - * SearchConfig. - * 2. Request must contain at least one non-empty search_criteria_property or - * facet_property. - * 3. mapped_fields must not be empty, and must map to existing UGA keys. - * 4. All mapped_fields must be of the same type. - * 5. All mapped_fields must share the same granularity. - * 6. All mapped_fields must share the same semantic SearchConfig match - * options. - * For property-specific rules, please reference the comments for - * FacetProperty and SearchCriteriaProperty. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this search configuration will be - * created. Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` - * @param {google.cloud.visionai.v1.SearchConfig} request.searchConfig - * Required. The search config to create. - * @param {string} request.searchConfigId - * Required. ID to use for the new search config. Will become the final - * component of the SearchConfig's resource name. This value should be up to - * 63 characters, and valid characters are /{@link protos.0-9|a-z}-_/. The first character - * must be a letter, the last could be a letter or a number. - * @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 protos.google.cloud.visionai.v1.SearchConfig|SearchConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.create_search_config.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateSearchConfig_async - */ + /** + * Creates a search configuration inside a corpus. + * + * Please follow the rules below to create a valid CreateSearchConfigRequest. + * --- General Rules --- + * 1. Request.search_config_id must not be associated with an existing + * SearchConfig. + * 2. Request must contain at least one non-empty search_criteria_property or + * facet_property. + * 3. mapped_fields must not be empty, and must map to existing UGA keys. + * 4. All mapped_fields must be of the same type. + * 5. All mapped_fields must share the same granularity. + * 6. All mapped_fields must share the same semantic SearchConfig match + * options. + * For property-specific rules, please reference the comments for + * FacetProperty and SearchCriteriaProperty. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this search configuration will be + * created. Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` + * @param {google.cloud.visionai.v1.SearchConfig} request.searchConfig + * Required. The search config to create. + * @param {string} request.searchConfigId + * Required. ID to use for the new search config. Will become the final + * component of the SearchConfig's resource name. This value should be up to + * 63 characters, and valid characters are /{@link protos.0-9|a-z}-_/. The first character + * must be a letter, the last could be a letter or a number. + * @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 protos.google.cloud.visionai.v1.SearchConfig|SearchConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.create_search_config.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateSearchConfig_async + */ createSearchConfig( - request?: protos.google.cloud.visionai.v1.ICreateSearchConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.ICreateSearchConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateSearchConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchConfig, + protos.google.cloud.visionai.v1.ICreateSearchConfigRequest | undefined, + {} | undefined, + ] + >; createSearchConfig( - request: protos.google.cloud.visionai.v1.ICreateSearchConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.ICreateSearchConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateSearchConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.ISearchConfig, + | protos.google.cloud.visionai.v1.ICreateSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createSearchConfig( - request: protos.google.cloud.visionai.v1.ICreateSearchConfigRequest, - callback: Callback< - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.ICreateSearchConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateSearchConfigRequest, + callback: Callback< + protos.google.cloud.visionai.v1.ISearchConfig, + | protos.google.cloud.visionai.v1.ICreateSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createSearchConfig( - request?: protos.google.cloud.visionai.v1.ICreateSearchConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.ICreateSearchConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.ICreateSearchConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.ICreateSearchConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.ICreateSearchConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.ICreateSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.ISearchConfig, + | protos.google.cloud.visionai.v1.ICreateSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchConfig, + protos.google.cloud.visionai.v1.ICreateSearchConfigRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createSearchConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.ICreateSearchConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.ISearchConfig, + | protos.google.cloud.visionai.v1.ICreateSearchConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createSearchConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createSearchConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.ICreateSearchConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('createSearchConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createSearchConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.ISearchConfig, + ( + | protos.google.cloud.visionai.v1.ICreateSearchConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createSearchConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates a search configuration inside a corpus. - * - * Please follow the rules below to create a valid UpdateSearchConfigRequest. - * --- General Rules --- - * 1. Request.search_configuration.name must already exist. - * 2. Request must contain at least one non-empty search_criteria_property or - * facet_property. - * 3. mapped_fields must not be empty, and must map to existing UGA keys. - * 4. All mapped_fields must be of the same type. - * 5. All mapped_fields must share the same granularity. - * 6. All mapped_fields must share the same semantic SearchConfig match - * options. - * For property-specific rules, please reference the comments for - * FacetProperty and SearchCriteriaProperty. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.SearchConfig} request.searchConfig - * Required. The search configuration to update. - * - * The search configuration's `name` field is used to identify the resource to - * be updated. Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}` - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. If left unset, all field paths will be - * updated/overwritten. - * @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 protos.google.cloud.visionai.v1.SearchConfig|SearchConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.update_search_config.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateSearchConfig_async - */ + /** + * Updates a search configuration inside a corpus. + * + * Please follow the rules below to create a valid UpdateSearchConfigRequest. + * --- General Rules --- + * 1. Request.search_configuration.name must already exist. + * 2. Request must contain at least one non-empty search_criteria_property or + * facet_property. + * 3. mapped_fields must not be empty, and must map to existing UGA keys. + * 4. All mapped_fields must be of the same type. + * 5. All mapped_fields must share the same granularity. + * 6. All mapped_fields must share the same semantic SearchConfig match + * options. + * For property-specific rules, please reference the comments for + * FacetProperty and SearchCriteriaProperty. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.SearchConfig} request.searchConfig + * Required. The search configuration to update. + * + * The search configuration's `name` field is used to identify the resource to + * be updated. Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}` + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. If left unset, all field paths will be + * updated/overwritten. + * @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 protos.google.cloud.visionai.v1.SearchConfig|SearchConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.update_search_config.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateSearchConfig_async + */ updateSearchConfig( - request?: protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchConfig, + protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest | undefined, + {} | undefined, + ] + >; updateSearchConfig( - request: protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.ISearchConfig, + | protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateSearchConfig( - request: protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest, - callback: Callback< - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest, + callback: Callback< + protos.google.cloud.visionai.v1.ISearchConfig, + | protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateSearchConfig( - request?: protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.ISearchConfig, + | protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchConfig, + protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'search_config.name': request.searchConfig!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'search_config.name': request.searchConfig!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateSearchConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.ISearchConfig, + | protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateSearchConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateSearchConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateSearchConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateSearchConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.ISearchConfig, + ( + | protos.google.cloud.visionai.v1.IUpdateSearchConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateSearchConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a search configuration inside a corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the search configuration to retrieve. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}` - * @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 protos.google.cloud.visionai.v1.SearchConfig|SearchConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.get_search_config.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_GetSearchConfig_async - */ + /** + * Gets a search configuration inside a corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the search configuration to retrieve. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}` + * @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 protos.google.cloud.visionai.v1.SearchConfig|SearchConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.get_search_config.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_GetSearchConfig_async + */ getSearchConfig( - request?: protos.google.cloud.visionai.v1.IGetSearchConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IGetSearchConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetSearchConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchConfig, + protos.google.cloud.visionai.v1.IGetSearchConfigRequest | undefined, + {} | undefined, + ] + >; getSearchConfig( - request: protos.google.cloud.visionai.v1.IGetSearchConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IGetSearchConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetSearchConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.ISearchConfig, + | protos.google.cloud.visionai.v1.IGetSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSearchConfig( - request: protos.google.cloud.visionai.v1.IGetSearchConfigRequest, - callback: Callback< - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IGetSearchConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetSearchConfigRequest, + callback: Callback< + protos.google.cloud.visionai.v1.ISearchConfig, + | protos.google.cloud.visionai.v1.IGetSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSearchConfig( - request?: protos.google.cloud.visionai.v1.IGetSearchConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IGetSearchConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetSearchConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IGetSearchConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IGetSearchConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IGetSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.ISearchConfig, + | protos.google.cloud.visionai.v1.IGetSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchConfig, + protos.google.cloud.visionai.v1.IGetSearchConfigRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getSearchConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IGetSearchConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.ISearchConfig, + | protos.google.cloud.visionai.v1.IGetSearchConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getSearchConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getSearchConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.ISearchConfig, - protos.google.cloud.visionai.v1.IGetSearchConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSearchConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getSearchConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.ISearchConfig, + protos.google.cloud.visionai.v1.IGetSearchConfigRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getSearchConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes a search configuration inside a corpus. - * - * For a DeleteSearchConfigRequest to be valid, - * Request.search_configuration.name must already exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the search configuration to delete. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}` - * @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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.delete_search_config.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteSearchConfig_async - */ + /** + * Deletes a search configuration inside a corpus. + * + * For a DeleteSearchConfigRequest to be valid, + * Request.search_configuration.name must already exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the search configuration to delete. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/searchConfigs/{search_config}` + * @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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.delete_search_config.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteSearchConfig_async + */ deleteSearchConfig( - request?: protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest | undefined, + {} | undefined, + ] + >; deleteSearchConfig( - request: protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteSearchConfig( - request: protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteSearchConfig( - request?: protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteSearchConfig request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteSearchConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteSearchConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteSearchConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .deleteSearchConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.visionai.v1.IDeleteSearchConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deleteSearchConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a SearchHypernym inside a corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this SearchHypernym will be created. - * Format: `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {google.cloud.visionai.v1.SearchHypernym} request.searchHypernym - * Required. The SearchHypernym to create. - * @param {string} [request.searchHypernymId] - * Optional. The search hypernym id. - * If omitted, a random UUID will be generated. - * @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 protos.google.cloud.visionai.v1.SearchHypernym|SearchHypernym}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.create_search_hypernym.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateSearchHypernym_async - */ + /** + * Creates a SearchHypernym inside a corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this SearchHypernym will be created. + * Format: `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {google.cloud.visionai.v1.SearchHypernym} request.searchHypernym + * Required. The SearchHypernym to create. + * @param {string} [request.searchHypernymId] + * Optional. The search hypernym id. + * If omitted, a random UUID will be generated. + * @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 protos.google.cloud.visionai.v1.SearchHypernym|SearchHypernym}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.create_search_hypernym.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateSearchHypernym_async + */ createSearchHypernym( - request?: protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchHypernym, + protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest | undefined, + {} | undefined, + ] + >; createSearchHypernym( - request: protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.ISearchHypernym, + | protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createSearchHypernym( - request: protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest, - callback: Callback< - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest, + callback: Callback< + protos.google.cloud.visionai.v1.ISearchHypernym, + | protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createSearchHypernym( - request?: protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.ISearchHypernym, + | protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchHypernym, + protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createSearchHypernym request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.ISearchHypernym, + | protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createSearchHypernym response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createSearchHypernym(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest|undefined, - {}|undefined - ]) => { - this._log.info('createSearchHypernym response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createSearchHypernym(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.ISearchHypernym, + ( + | protos.google.cloud.visionai.v1.ICreateSearchHypernymRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createSearchHypernym response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates a SearchHypernym inside a corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.SearchHypernym} request.searchHypernym - * Required. The SearchHypernym to update. - * The search hypernym's `name` field is used to identify the search hypernym - * to be updated. Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}` - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. If left unset, all field paths will be - * updated/overwritten. - * @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 protos.google.cloud.visionai.v1.SearchHypernym|SearchHypernym}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.update_search_hypernym.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateSearchHypernym_async - */ + /** + * Updates a SearchHypernym inside a corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.SearchHypernym} request.searchHypernym + * Required. The SearchHypernym to update. + * The search hypernym's `name` field is used to identify the search hypernym + * to be updated. Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}` + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. If left unset, all field paths will be + * updated/overwritten. + * @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 protos.google.cloud.visionai.v1.SearchHypernym|SearchHypernym}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.update_search_hypernym.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateSearchHypernym_async + */ updateSearchHypernym( - request?: protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchHypernym, + protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest | undefined, + {} | undefined, + ] + >; updateSearchHypernym( - request: protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.ISearchHypernym, + | protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateSearchHypernym( - request: protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest, - callback: Callback< - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest, + callback: Callback< + protos.google.cloud.visionai.v1.ISearchHypernym, + | protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateSearchHypernym( - request?: protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.ISearchHypernym, + | protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchHypernym, + protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'search_hypernym.name': request.searchHypernym!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'search_hypernym.name': request.searchHypernym!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateSearchHypernym request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.ISearchHypernym, + | protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateSearchHypernym response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateSearchHypernym(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateSearchHypernym response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateSearchHypernym(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.ISearchHypernym, + ( + | protos.google.cloud.visionai.v1.IUpdateSearchHypernymRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateSearchHypernym response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a SearchHypernym inside a corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the SearchHypernym to retrieve. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}` - * @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 protos.google.cloud.visionai.v1.SearchHypernym|SearchHypernym}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.get_search_hypernym.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_GetSearchHypernym_async - */ + /** + * Gets a SearchHypernym inside a corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the SearchHypernym to retrieve. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}` + * @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 protos.google.cloud.visionai.v1.SearchHypernym|SearchHypernym}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.get_search_hypernym.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_GetSearchHypernym_async + */ getSearchHypernym( - request?: protos.google.cloud.visionai.v1.IGetSearchHypernymRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IGetSearchHypernymRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetSearchHypernymRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchHypernym, + protos.google.cloud.visionai.v1.IGetSearchHypernymRequest | undefined, + {} | undefined, + ] + >; getSearchHypernym( - request: protos.google.cloud.visionai.v1.IGetSearchHypernymRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IGetSearchHypernymRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetSearchHypernymRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.ISearchHypernym, + | protos.google.cloud.visionai.v1.IGetSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSearchHypernym( - request: protos.google.cloud.visionai.v1.IGetSearchHypernymRequest, - callback: Callback< - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IGetSearchHypernymRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetSearchHypernymRequest, + callback: Callback< + protos.google.cloud.visionai.v1.ISearchHypernym, + | protos.google.cloud.visionai.v1.IGetSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSearchHypernym( - request?: protos.google.cloud.visionai.v1.IGetSearchHypernymRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IGetSearchHypernymRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetSearchHypernymRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IGetSearchHypernymRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IGetSearchHypernymRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IGetSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.ISearchHypernym, + | protos.google.cloud.visionai.v1.IGetSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchHypernym, + protos.google.cloud.visionai.v1.IGetSearchHypernymRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getSearchHypernym request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IGetSearchHypernymRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.ISearchHypernym, + | protos.google.cloud.visionai.v1.IGetSearchHypernymRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getSearchHypernym response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getSearchHypernym(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.ISearchHypernym, - protos.google.cloud.visionai.v1.IGetSearchHypernymRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSearchHypernym response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getSearchHypernym(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.ISearchHypernym, + protos.google.cloud.visionai.v1.IGetSearchHypernymRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getSearchHypernym response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes a SearchHypernym inside a corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the SearchHypernym to delete. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}` - * @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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.delete_search_hypernym.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteSearchHypernym_async - */ + /** + * Deletes a SearchHypernym inside a corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the SearchHypernym to delete. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/searchHypernyms/{search_hypernym}` + * @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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.delete_search_hypernym.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteSearchHypernym_async + */ deleteSearchHypernym( - request?: protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest | undefined, + {} | undefined, + ] + >; deleteSearchHypernym( - request: protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteSearchHypernym( - request: protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteSearchHypernym( - request?: protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteSearchHypernym request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteSearchHypernym response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteSearchHypernym(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteSearchHypernym response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .deleteSearchHypernym(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.visionai.v1.IDeleteSearchHypernymRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deleteSearchHypernym response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets an IndexEndpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the IndexEndpoint resource. - * @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 protos.google.cloud.visionai.v1.IndexEndpoint|IndexEndpoint}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.get_index_endpoint.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_GetIndexEndpoint_async - */ + /** + * Gets an IndexEndpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the IndexEndpoint resource. + * @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 protos.google.cloud.visionai.v1.IndexEndpoint|IndexEndpoint}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.get_index_endpoint.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_GetIndexEndpoint_async + */ getIndexEndpoint( - request?: protos.google.cloud.visionai.v1.IGetIndexEndpointRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IIndexEndpoint, - protos.google.cloud.visionai.v1.IGetIndexEndpointRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetIndexEndpointRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.IGetIndexEndpointRequest | undefined, + {} | undefined, + ] + >; getIndexEndpoint( - request: protos.google.cloud.visionai.v1.IGetIndexEndpointRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IIndexEndpoint, - protos.google.cloud.visionai.v1.IGetIndexEndpointRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetIndexEndpointRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IIndexEndpoint, + | protos.google.cloud.visionai.v1.IGetIndexEndpointRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getIndexEndpoint( - request: protos.google.cloud.visionai.v1.IGetIndexEndpointRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IIndexEndpoint, - protos.google.cloud.visionai.v1.IGetIndexEndpointRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetIndexEndpointRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IIndexEndpoint, + | protos.google.cloud.visionai.v1.IGetIndexEndpointRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getIndexEndpoint( - request?: protos.google.cloud.visionai.v1.IGetIndexEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IIndexEndpoint, - protos.google.cloud.visionai.v1.IGetIndexEndpointRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetIndexEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IIndexEndpoint, - protos.google.cloud.visionai.v1.IGetIndexEndpointRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IIndexEndpoint, - protos.google.cloud.visionai.v1.IGetIndexEndpointRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IGetIndexEndpointRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IIndexEndpoint, + | protos.google.cloud.visionai.v1.IGetIndexEndpointRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.IGetIndexEndpointRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getIndexEndpoint request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IIndexEndpoint, - protos.google.cloud.visionai.v1.IGetIndexEndpointRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IIndexEndpoint, + | protos.google.cloud.visionai.v1.IGetIndexEndpointRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getIndexEndpoint response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getIndexEndpoint(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IIndexEndpoint, - protos.google.cloud.visionai.v1.IGetIndexEndpointRequest|undefined, - {}|undefined - ]) => { - this._log.info('getIndexEndpoint response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getIndexEndpoint(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.IGetIndexEndpointRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getIndexEndpoint response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a collection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the collection to retrieve. Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}` - * @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 protos.google.cloud.visionai.v1.Collection|Collection}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.get_collection.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_GetCollection_async - */ + /** + * Gets a collection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the collection to retrieve. Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}` + * @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 protos.google.cloud.visionai.v1.Collection|Collection}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.get_collection.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_GetCollection_async + */ getCollection( - request?: protos.google.cloud.visionai.v1.IGetCollectionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IGetCollectionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IGetCollectionRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.IGetCollectionRequest | undefined, + {} | undefined, + ] + >; getCollection( - request: protos.google.cloud.visionai.v1.IGetCollectionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IGetCollectionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetCollectionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.IGetCollectionRequest | null | undefined, + {} | null | undefined + >, + ): void; getCollection( - request: protos.google.cloud.visionai.v1.IGetCollectionRequest, - callback: Callback< - protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IGetCollectionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IGetCollectionRequest, + callback: Callback< + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.IGetCollectionRequest | null | undefined, + {} | null | undefined + >, + ): void; getCollection( - request?: protos.google.cloud.visionai.v1.IGetCollectionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IGetCollectionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IGetCollectionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IGetCollectionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IGetCollectionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IGetCollectionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.IGetCollectionRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.IGetCollectionRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getCollection request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IGetCollectionRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.ICollection, + | protos.google.cloud.visionai.v1.IGetCollectionRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getCollection response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getCollection(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IGetCollectionRequest|undefined, - {}|undefined - ]) => { - this._log.info('getCollection response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getCollection(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.IGetCollectionRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getCollection response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates a collection. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.Collection} request.collection - * Required. The collection to update. - * - * The collection's `name` field is used to identify the collection to be - * updated. Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}` - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to be updated. - * - Unset `update_mask` or set `update_mask` to be a single "*" only will - * update all updatable fields with the value provided in `collection`. - * - To update `display_name` value to empty string, set it in the - * `collection` - * to empty string, and set `update_mask` with "display_name". Same applies - * to other updatable string fields in the `collection`. - * @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 protos.google.cloud.visionai.v1.Collection|Collection}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.update_collection.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateCollection_async - */ + /** + * Updates a collection. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.Collection} request.collection + * Required. The collection to update. + * + * The collection's `name` field is used to identify the collection to be + * updated. Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}` + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to be updated. + * - Unset `update_mask` or set `update_mask` to be a single "*" only will + * update all updatable fields with the value provided in `collection`. + * - To update `display_name` value to empty string, set it in the + * `collection` + * to empty string, and set `update_mask` with "display_name". Same applies + * to other updatable string fields in the `collection`. + * @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 protos.google.cloud.visionai.v1.Collection|Collection}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.update_collection.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateCollection_async + */ updateCollection( - request?: protos.google.cloud.visionai.v1.IUpdateCollectionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IUpdateCollectionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateCollectionRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.IUpdateCollectionRequest | undefined, + {} | undefined, + ] + >; updateCollection( - request: protos.google.cloud.visionai.v1.IUpdateCollectionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IUpdateCollectionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateCollectionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.ICollection, + | protos.google.cloud.visionai.v1.IUpdateCollectionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateCollection( - request: protos.google.cloud.visionai.v1.IUpdateCollectionRequest, - callback: Callback< - protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IUpdateCollectionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateCollectionRequest, + callback: Callback< + protos.google.cloud.visionai.v1.ICollection, + | protos.google.cloud.visionai.v1.IUpdateCollectionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateCollection( - request?: protos.google.cloud.visionai.v1.IUpdateCollectionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IUpdateCollectionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IUpdateCollectionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IUpdateCollectionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IUpdateCollectionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IUpdateCollectionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.ICollection, + | protos.google.cloud.visionai.v1.IUpdateCollectionRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.IUpdateCollectionRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'collection.name': request.collection!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'collection.name': request.collection!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateCollection request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IUpdateCollectionRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.ICollection, + | protos.google.cloud.visionai.v1.IUpdateCollectionRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateCollection response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateCollection(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.ICollection, - protos.google.cloud.visionai.v1.IUpdateCollectionRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateCollection response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateCollection(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.IUpdateCollectionRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateCollection response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Adds an item into a Collection. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.CollectionItem} request.item - * Required. The item to be added. - * @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 protos.google.cloud.visionai.v1.AddCollectionItemResponse|AddCollectionItemResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.add_collection_item.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_AddCollectionItem_async - */ + /** + * Adds an item into a Collection. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.CollectionItem} request.item + * Required. The item to be added. + * @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 protos.google.cloud.visionai.v1.AddCollectionItemResponse|AddCollectionItemResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.add_collection_item.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_AddCollectionItem_async + */ addCollectionItem( - request?: protos.google.cloud.visionai.v1.IAddCollectionItemRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IAddCollectionItemResponse, - protos.google.cloud.visionai.v1.IAddCollectionItemRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IAddCollectionItemRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAddCollectionItemResponse, + protos.google.cloud.visionai.v1.IAddCollectionItemRequest | undefined, + {} | undefined, + ] + >; addCollectionItem( - request: protos.google.cloud.visionai.v1.IAddCollectionItemRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IAddCollectionItemResponse, - protos.google.cloud.visionai.v1.IAddCollectionItemRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IAddCollectionItemRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IAddCollectionItemResponse, + | protos.google.cloud.visionai.v1.IAddCollectionItemRequest + | null + | undefined, + {} | null | undefined + >, + ): void; addCollectionItem( - request: protos.google.cloud.visionai.v1.IAddCollectionItemRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IAddCollectionItemResponse, - protos.google.cloud.visionai.v1.IAddCollectionItemRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IAddCollectionItemRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IAddCollectionItemResponse, + | protos.google.cloud.visionai.v1.IAddCollectionItemRequest + | null + | undefined, + {} | null | undefined + >, + ): void; addCollectionItem( - request?: protos.google.cloud.visionai.v1.IAddCollectionItemRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IAddCollectionItemResponse, - protos.google.cloud.visionai.v1.IAddCollectionItemRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IAddCollectionItemRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IAddCollectionItemResponse, - protos.google.cloud.visionai.v1.IAddCollectionItemRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IAddCollectionItemResponse, - protos.google.cloud.visionai.v1.IAddCollectionItemRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IAddCollectionItemRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IAddCollectionItemResponse, + | protos.google.cloud.visionai.v1.IAddCollectionItemRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAddCollectionItemResponse, + protos.google.cloud.visionai.v1.IAddCollectionItemRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'item.collection': request.item!.collection ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'item.collection': request.item!.collection ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('addCollectionItem request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IAddCollectionItemResponse, - protos.google.cloud.visionai.v1.IAddCollectionItemRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IAddCollectionItemResponse, + | protos.google.cloud.visionai.v1.IAddCollectionItemRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('addCollectionItem response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.addCollectionItem(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IAddCollectionItemResponse, - protos.google.cloud.visionai.v1.IAddCollectionItemRequest|undefined, - {}|undefined - ]) => { - this._log.info('addCollectionItem response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .addCollectionItem(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IAddCollectionItemResponse, + protos.google.cloud.visionai.v1.IAddCollectionItemRequest | undefined, + {} | undefined, + ]) => { + this._log.info('addCollectionItem response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Removes an item from a collection. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.CollectionItem} request.item - * Required. The item to be removed. - * @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 protos.google.cloud.visionai.v1.RemoveCollectionItemResponse|RemoveCollectionItemResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.remove_collection_item.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_RemoveCollectionItem_async - */ + /** + * Removes an item from a collection. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.CollectionItem} request.item + * Required. The item to be removed. + * @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 protos.google.cloud.visionai.v1.RemoveCollectionItemResponse|RemoveCollectionItemResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.remove_collection_item.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_RemoveCollectionItem_async + */ removeCollectionItem( - request?: protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, - protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, + protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest | undefined, + {} | undefined, + ] + >; removeCollectionItem( - request: protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, - protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, + | protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest + | null + | undefined, + {} | null | undefined + >, + ): void; removeCollectionItem( - request: protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest, - callback: Callback< - protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, - protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest, + callback: Callback< + protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, + | protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest + | null + | undefined, + {} | null | undefined + >, + ): void; removeCollectionItem( - request?: protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, - protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, - protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, - protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, + | protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, + protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'item.collection': request.item!.collection ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'item.collection': request.item!.collection ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('removeCollectionItem request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, - protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, + | protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('removeCollectionItem response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.removeCollectionItem(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, - protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest|undefined, - {}|undefined - ]) => { - this._log.info('removeCollectionItem response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .removeCollectionItem(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse, + ( + | protos.google.cloud.visionai.v1.IRemoveCollectionItemRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('removeCollectionItem response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Ingests data for the asset. It is not allowed to ingest a data chunk which - * is already expired according to TTL. - * This method is only available via the gRPC API (not HTTP since - * bi-directional streaming is not supported via HTTP). - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which is both readable and writable. It accepts objects - * representing {@link protos.google.cloud.visionai.v1.IngestAssetRequest|IngestAssetRequest} for write() method, and - * will emit objects representing {@link protos.google.cloud.visionai.v1.IngestAssetResponse|IngestAssetResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.ingest_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_IngestAsset_async - */ - ingestAsset( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); + /** + * Ingests data for the asset. It is not allowed to ingest a data chunk which + * is already expired according to TTL. + * This method is only available via the gRPC API (not HTTP since + * bi-directional streaming is not supported via HTTP). + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.cloud.visionai.v1.IngestAssetRequest|IngestAssetRequest} for write() method, and + * will emit objects representing {@link protos.google.cloud.visionai.v1.IngestAssetResponse|IngestAssetResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.ingest_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_IngestAsset_async + */ + ingestAsset(options?: CallOptions): gax.CancellableStream { + this.initialize().catch((err) => { + throw err; + }); this._log.info('ingestAsset stream %j', options); return this.innerApiCalls.ingestAsset(null, options); } -/** - * Deletes asset inside corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the asset to delete. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.delete_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteAsset_async - */ + /** + * Deletes asset inside corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the asset to delete. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}` + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.delete_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteAsset_async + */ deleteAsset( - request?: protos.google.cloud.visionai.v1.IDeleteAssetRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteAssetRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteAsset( - request: protos.google.cloud.visionai.v1.IDeleteAssetRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteAssetRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAsset( - request: protos.google.cloud.visionai.v1.IDeleteAssetRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteAssetRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteAsset( - request?: protos.google.cloud.visionai.v1.IDeleteAssetRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteAssetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteAsset response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteAsset request %j', request); - return this.innerApiCalls.deleteAsset(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteAsset response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteAsset(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteAsset response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteAsset()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.delete_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteAsset_async - */ - async checkDeleteAssetProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteAsset()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.delete_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteAsset_async + */ + async checkDeleteAssetProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.DeleteAssetMetadata + > + > { this._log.info('deleteAsset long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteAsset, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteAsset, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.DeleteAssetMetadata + >; } -/** - * Upload asset by specifing the asset Cloud Storage uri. - * For video warehouse, it requires users who call this API have read access - * to the cloud storage file. Once it is uploaded, it can be retrieved by - * GenerateRetrievalUrl API which by default, only can retrieve cloud storage - * files from the same project of the warehouse. To allow retrieval cloud - * storage files that are in a separate project, it requires to find the - * vision ai service account (Go to IAM, check checkbox to show "Include - * Google-provided role grants", search for "Cloud Vision AI Service Agent") - * and grant the read access of the cloud storage files to that service - * account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the asset to upload. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` - * @param {google.cloud.visionai.v1.AssetSource} request.assetSource - * The source of the asset. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.upload_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UploadAsset_async - */ + /** + * Upload asset by specifing the asset Cloud Storage uri. + * For video warehouse, it requires users who call this API have read access + * to the cloud storage file. Once it is uploaded, it can be retrieved by + * GenerateRetrievalUrl API which by default, only can retrieve cloud storage + * files from the same project of the warehouse. To allow retrieval cloud + * storage files that are in a separate project, it requires to find the + * vision ai service account (Go to IAM, check checkbox to show "Include + * Google-provided role grants", search for "Cloud Vision AI Service Agent") + * and grant the read access of the cloud storage files to that service + * account. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the asset to upload. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` + * @param {google.cloud.visionai.v1.AssetSource} request.assetSource + * The source of the asset. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.upload_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UploadAsset_async + */ uploadAsset( - request?: protos.google.cloud.visionai.v1.IUploadAssetRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUploadAssetRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IUploadAssetResponse, + protos.google.cloud.visionai.v1.IUploadAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; uploadAsset( - request: protos.google.cloud.visionai.v1.IUploadAssetRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUploadAssetRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUploadAssetResponse, + protos.google.cloud.visionai.v1.IUploadAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; uploadAsset( - request: protos.google.cloud.visionai.v1.IUploadAssetRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUploadAssetRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUploadAssetResponse, + protos.google.cloud.visionai.v1.IUploadAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; uploadAsset( - request?: protos.google.cloud.visionai.v1.IUploadAssetRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUploadAssetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IUploadAssetResponse, + protos.google.cloud.visionai.v1.IUploadAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUploadAssetResponse, + protos.google.cloud.visionai.v1.IUploadAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IUploadAssetResponse, + protos.google.cloud.visionai.v1.IUploadAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IUploadAssetResponse, + protos.google.cloud.visionai.v1.IUploadAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('uploadAsset response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('uploadAsset request %j', request); - return this.innerApiCalls.uploadAsset(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('uploadAsset response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .uploadAsset(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IUploadAssetResponse, + protos.google.cloud.visionai.v1.IUploadAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('uploadAsset response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `uploadAsset()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.upload_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UploadAsset_async - */ - async checkUploadAssetProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `uploadAsset()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.upload_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UploadAsset_async + */ + async checkUploadAssetProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.UploadAssetResponse, + protos.google.cloud.visionai.v1.UploadAssetMetadata + > + > { this._log.info('uploadAsset long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.uploadAsset, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.uploadAsset, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.UploadAssetResponse, + protos.google.cloud.visionai.v1.UploadAssetMetadata + >; } -/** - * Analyze asset to power search capability. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the asset to analyze. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.analyze_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_AnalyzeAsset_async - */ + /** + * Analyze asset to power search capability. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the asset to analyze. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.analyze_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_AnalyzeAsset_async + */ analyzeAsset( - request?: protos.google.cloud.visionai.v1.IAnalyzeAssetRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IAnalyzeAssetRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeAssetResponse, + protos.google.cloud.visionai.v1.IAnalyzeAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; analyzeAsset( - request: protos.google.cloud.visionai.v1.IAnalyzeAssetRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IAnalyzeAssetRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeAssetResponse, + protos.google.cloud.visionai.v1.IAnalyzeAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; analyzeAsset( - request: protos.google.cloud.visionai.v1.IAnalyzeAssetRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IAnalyzeAssetRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeAssetResponse, + protos.google.cloud.visionai.v1.IAnalyzeAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; analyzeAsset( - request?: protos.google.cloud.visionai.v1.IAnalyzeAssetRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IAnalyzeAssetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeAssetResponse, + protos.google.cloud.visionai.v1.IAnalyzeAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeAssetResponse, + protos.google.cloud.visionai.v1.IAnalyzeAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeAssetResponse, + protos.google.cloud.visionai.v1.IAnalyzeAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeAssetResponse, + protos.google.cloud.visionai.v1.IAnalyzeAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('analyzeAsset response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('analyzeAsset request %j', request); - return this.innerApiCalls.analyzeAsset(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('analyzeAsset response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .analyzeAsset(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeAssetResponse, + protos.google.cloud.visionai.v1.IAnalyzeAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('analyzeAsset response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `analyzeAsset()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.analyze_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_AnalyzeAsset_async - */ - async checkAnalyzeAssetProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `analyzeAsset()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.analyze_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_AnalyzeAsset_async + */ + async checkAnalyzeAssetProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.AnalyzeAssetResponse, + protos.google.cloud.visionai.v1.AnalyzeAssetMetadata + > + > { this._log.info('analyzeAsset long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.analyzeAsset, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.analyzeAsset, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.AnalyzeAssetResponse, + protos.google.cloud.visionai.v1.AnalyzeAssetMetadata + >; } -/** - * Index one asset for search. - * Supported corpus type: Corpus.Type.VIDEO_ON_DEMAND - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the asset to index. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` - * @param {string} [request.index] - * Optional. The name of the index. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.index_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_IndexAsset_async - */ + /** + * Index one asset for search. + * Supported corpus type: Corpus.Type.VIDEO_ON_DEMAND + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the asset to index. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` + * @param {string} [request.index] + * Optional. The name of the index. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}` + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.index_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_IndexAsset_async + */ indexAsset( - request?: protos.google.cloud.visionai.v1.IIndexAssetRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IIndexAssetRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IIndexAssetResponse, + protos.google.cloud.visionai.v1.IIndexAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; indexAsset( - request: protos.google.cloud.visionai.v1.IIndexAssetRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IIndexAssetRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexAssetResponse, + protos.google.cloud.visionai.v1.IIndexAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; indexAsset( - request: protos.google.cloud.visionai.v1.IIndexAssetRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IIndexAssetRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexAssetResponse, + protos.google.cloud.visionai.v1.IIndexAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; indexAsset( - request?: protos.google.cloud.visionai.v1.IIndexAssetRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IIndexAssetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexAssetResponse, + protos.google.cloud.visionai.v1.IIndexAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexAssetResponse, + protos.google.cloud.visionai.v1.IIndexAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IIndexAssetResponse, + protos.google.cloud.visionai.v1.IIndexAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexAssetResponse, + protos.google.cloud.visionai.v1.IIndexAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('indexAsset response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('indexAsset request %j', request); - return this.innerApiCalls.indexAsset(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('indexAsset response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .indexAsset(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IIndexAssetResponse, + protos.google.cloud.visionai.v1.IIndexAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('indexAsset response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `indexAsset()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.index_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_IndexAsset_async - */ - async checkIndexAssetProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `indexAsset()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.index_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_IndexAsset_async + */ + async checkIndexAssetProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.IndexAssetResponse, + protos.google.cloud.visionai.v1.IndexAssetMetadata + > + > { this._log.info('indexAsset long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.indexAsset, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.indexAsset, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.IndexAssetResponse, + protos.google.cloud.visionai.v1.IndexAssetMetadata + >; } -/** - * Remove one asset's index data for search. - * Supported corpus type: Corpus.Type.VIDEO_ON_DEMAND - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the asset to index. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` - * @param {string} [request.index] - * Optional. The name of the index. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.remove_index_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_RemoveIndexAsset_async - */ + /** + * Remove one asset's index data for search. + * Supported corpus type: Corpus.Type.VIDEO_ON_DEMAND + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the asset to index. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}/assets/{asset_id}` + * @param {string} [request.index] + * Optional. The name of the index. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}` + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.remove_index_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_RemoveIndexAsset_async + */ removeIndexAsset( - request?: protos.google.cloud.visionai.v1.IRemoveIndexAssetRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IRemoveIndexAssetRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IRemoveIndexAssetResponse, + protos.google.cloud.visionai.v1.IRemoveIndexAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; removeIndexAsset( - request: protos.google.cloud.visionai.v1.IRemoveIndexAssetRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IRemoveIndexAssetRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IRemoveIndexAssetResponse, + protos.google.cloud.visionai.v1.IRemoveIndexAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; removeIndexAsset( - request: protos.google.cloud.visionai.v1.IRemoveIndexAssetRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IRemoveIndexAssetRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IRemoveIndexAssetResponse, + protos.google.cloud.visionai.v1.IRemoveIndexAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; removeIndexAsset( - request?: protos.google.cloud.visionai.v1.IRemoveIndexAssetRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IRemoveIndexAssetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IRemoveIndexAssetResponse, + protos.google.cloud.visionai.v1.IRemoveIndexAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IRemoveIndexAssetResponse, + protos.google.cloud.visionai.v1.IRemoveIndexAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IRemoveIndexAssetResponse, + protos.google.cloud.visionai.v1.IRemoveIndexAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IRemoveIndexAssetResponse, + protos.google.cloud.visionai.v1.IRemoveIndexAssetMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('removeIndexAsset response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('removeIndexAsset request %j', request); - return this.innerApiCalls.removeIndexAsset(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('removeIndexAsset response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .removeIndexAsset(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IRemoveIndexAssetResponse, + protos.google.cloud.visionai.v1.IRemoveIndexAssetMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('removeIndexAsset response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `removeIndexAsset()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.remove_index_asset.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_RemoveIndexAsset_async - */ - async checkRemoveIndexAssetProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `removeIndexAsset()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.remove_index_asset.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_RemoveIndexAsset_async + */ + async checkRemoveIndexAssetProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.RemoveIndexAssetResponse, + protos.google.cloud.visionai.v1.RemoveIndexAssetMetadata + > + > { this._log.info('removeIndexAsset long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.removeIndexAsset, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.removeIndexAsset, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.RemoveIndexAssetResponse, + protos.google.cloud.visionai.v1.RemoveIndexAssetMetadata + >; } -/** - * Creates an Index under the corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Value for the parent. The resource name of the Corpus under which - * this index is created. Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` - * @param {string} [request.indexId] - * Optional. The ID for the index. This will become the final resource name - * for the index. If the user does not specify this value, it will be - * generated by system. - * - * This value should be up to 63 characters, and valid characters - * are /{@link protos.0-9|a-z}-/. The first character must be a letter, the last could be - * a letter or a number. - * @param {google.cloud.visionai.v1.Index} request.index - * Required. The index being created. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.create_index.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateIndex_async - */ + /** + * Creates an Index under the corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Value for the parent. The resource name of the Corpus under which + * this index is created. Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` + * @param {string} [request.indexId] + * Optional. The ID for the index. This will become the final resource name + * for the index. If the user does not specify this value, it will be + * generated by system. + * + * This value should be up to 63 characters, and valid characters + * are /{@link protos.0-9|a-z}-/. The first character must be a letter, the last could be + * a letter or a number. + * @param {google.cloud.visionai.v1.Index} request.index + * Required. The index being created. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.create_index.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateIndex_async + */ createIndex( - request?: protos.google.cloud.visionai.v1.ICreateIndexRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateIndexRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.ICreateIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createIndex( - request: protos.google.cloud.visionai.v1.ICreateIndexRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateIndexRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.ICreateIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createIndex( - request: protos.google.cloud.visionai.v1.ICreateIndexRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateIndexRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.ICreateIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createIndex( - request?: protos.google.cloud.visionai.v1.ICreateIndexRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.ICreateIndexRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.ICreateIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.ICreateIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.ICreateIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.ICreateIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createIndex response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createIndex request %j', request); - return this.innerApiCalls.createIndex(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createIndex response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createIndex(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.ICreateIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createIndex response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createIndex()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.create_index.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateIndex_async - */ - async checkCreateIndexProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createIndex()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.create_index.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateIndex_async + */ + async checkCreateIndexProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Index, + protos.google.cloud.visionai.v1.CreateIndexMetadata + > + > { this._log.info('createIndex long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createIndex, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createIndex, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Index, + protos.google.cloud.visionai.v1.CreateIndexMetadata + >; } -/** - * Updates an Index under the corpus. - * Users can perform a metadata-only update or trigger a full index rebuild - * with different update_mask values. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.Index} request.index - * Required. The resource being updated. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * Index resource by the update. The fields specified in the update_mask are - * relative to the resource, not the full request. A field of the resource - * will be overwritten if it is in the mask. Empty field mask is not allowed. - * If the mask is "*", it triggers a full update of the index, and also a - * whole rebuild of index data. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.update_index.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateIndex_async - */ + /** + * Updates an Index under the corpus. + * Users can perform a metadata-only update or trigger a full index rebuild + * with different update_mask values. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.Index} request.index + * Required. The resource being updated. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * Index resource by the update. The fields specified in the update_mask are + * relative to the resource, not the full request. A field of the resource + * will be overwritten if it is in the mask. Empty field mask is not allowed. + * If the mask is "*", it triggers a full update of the index, and also a + * whole rebuild of index data. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.update_index.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateIndex_async + */ updateIndex( - request?: protos.google.cloud.visionai.v1.IUpdateIndexRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateIndexRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IUpdateIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateIndex( - request: protos.google.cloud.visionai.v1.IUpdateIndexRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateIndexRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IUpdateIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateIndex( - request: protos.google.cloud.visionai.v1.IUpdateIndexRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateIndexRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IUpdateIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateIndex( - request?: protos.google.cloud.visionai.v1.IUpdateIndexRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUpdateIndexRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IUpdateIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IUpdateIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IUpdateIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'index.name': request.index!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'index.name': request.index!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IUpdateIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateIndex response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateIndex request %j', request); - return this.innerApiCalls.updateIndex(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateIndex response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateIndex(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IUpdateIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateIndex response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateIndex()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.update_index.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateIndex_async - */ - async checkUpdateIndexProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateIndex()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.update_index.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateIndex_async + */ + async checkUpdateIndexProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Index, + protos.google.cloud.visionai.v1.UpdateIndexMetadata + > + > { this._log.info('updateIndex long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateIndex, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateIndex, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Index, + protos.google.cloud.visionai.v1.UpdateIndexMetadata + >; } -/** - * Delete a single Index. In order to delete an index, the caller must - * make sure that it is not deployed to any index endpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the index to delete. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.delete_index.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteIndex_async - */ + /** + * Delete a single Index. In order to delete an index, the caller must + * make sure that it is not deployed to any index endpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the index to delete. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}` + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.delete_index.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteIndex_async + */ deleteIndex( - request?: protos.google.cloud.visionai.v1.IDeleteIndexRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteIndexRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteIndex( - request: protos.google.cloud.visionai.v1.IDeleteIndexRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteIndexRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteIndex( - request: protos.google.cloud.visionai.v1.IDeleteIndexRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteIndexRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteIndex( - request?: protos.google.cloud.visionai.v1.IDeleteIndexRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteIndexRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteIndex response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteIndex request %j', request); - return this.innerApiCalls.deleteIndex(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteIndex response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteIndex(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteIndex response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteIndex()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.delete_index.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteIndex_async - */ - async checkDeleteIndexProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteIndex()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.delete_index.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteIndex_async + */ + async checkDeleteIndexProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.DeleteIndexMetadata + > + > { this._log.info('deleteIndex long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteIndex, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteIndex, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.DeleteIndexMetadata + >; } -/** - * Creates a corpus inside a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Form: `projects/{project_number}/locations/{location_id}` - * @param {google.cloud.visionai.v1.Corpus} request.corpus - * Required. The corpus to be created. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.create_corpus.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateCorpus_async - */ + /** + * Creates a corpus inside a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Form: `projects/{project_number}/locations/{location_id}` + * @param {google.cloud.visionai.v1.Corpus} request.corpus + * Required. The corpus to be created. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.create_corpus.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateCorpus_async + */ createCorpus( - request?: protos.google.cloud.visionai.v1.ICreateCorpusRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateCorpusRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.ICreateCorpusMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createCorpus( - request: protos.google.cloud.visionai.v1.ICreateCorpusRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateCorpusRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.ICreateCorpusMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createCorpus( - request: protos.google.cloud.visionai.v1.ICreateCorpusRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateCorpusRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.ICreateCorpusMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createCorpus( - request?: protos.google.cloud.visionai.v1.ICreateCorpusRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.ICreateCorpusRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.ICreateCorpusMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.ICreateCorpusMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.ICreateCorpusMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.ICreateCorpusMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createCorpus response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createCorpus request %j', request); - return this.innerApiCalls.createCorpus(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createCorpus response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createCorpus(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.ICreateCorpusMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createCorpus response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createCorpus()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.create_corpus.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateCorpus_async - */ - async checkCreateCorpusProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createCorpus()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.create_corpus.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateCorpus_async + */ + async checkCreateCorpusProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Corpus, + protos.google.cloud.visionai.v1.CreateCorpusMetadata + > + > { this._log.info('createCorpus long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createCorpus, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createCorpus, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Corpus, + protos.google.cloud.visionai.v1.CreateCorpusMetadata + >; } -/** - * Analyzes a corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The parent corpus resource where the assets will be analyzed. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.analyze_corpus.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_AnalyzeCorpus_async - */ + /** + * Analyzes a corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The parent corpus resource where the assets will be analyzed. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.analyze_corpus.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_AnalyzeCorpus_async + */ analyzeCorpus( - request?: protos.google.cloud.visionai.v1.IAnalyzeCorpusRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IAnalyzeCorpusRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeCorpusResponse, + protos.google.cloud.visionai.v1.IAnalyzeCorpusMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; analyzeCorpus( - request: protos.google.cloud.visionai.v1.IAnalyzeCorpusRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IAnalyzeCorpusRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeCorpusResponse, + protos.google.cloud.visionai.v1.IAnalyzeCorpusMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; analyzeCorpus( - request: protos.google.cloud.visionai.v1.IAnalyzeCorpusRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IAnalyzeCorpusRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeCorpusResponse, + protos.google.cloud.visionai.v1.IAnalyzeCorpusMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; analyzeCorpus( - request?: protos.google.cloud.visionai.v1.IAnalyzeCorpusRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IAnalyzeCorpusRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeCorpusResponse, + protos.google.cloud.visionai.v1.IAnalyzeCorpusMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeCorpusResponse, + protos.google.cloud.visionai.v1.IAnalyzeCorpusMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeCorpusResponse, + protos.google.cloud.visionai.v1.IAnalyzeCorpusMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeCorpusResponse, + protos.google.cloud.visionai.v1.IAnalyzeCorpusMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('analyzeCorpus response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('analyzeCorpus request %j', request); - return this.innerApiCalls.analyzeCorpus(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('analyzeCorpus response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .analyzeCorpus(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IAnalyzeCorpusResponse, + protos.google.cloud.visionai.v1.IAnalyzeCorpusMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('analyzeCorpus response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `analyzeCorpus()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.analyze_corpus.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_AnalyzeCorpus_async - */ - async checkAnalyzeCorpusProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `analyzeCorpus()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.analyze_corpus.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_AnalyzeCorpus_async + */ + async checkAnalyzeCorpusProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.AnalyzeCorpusResponse, + protos.google.cloud.visionai.v1.AnalyzeCorpusMetadata + > + > { this._log.info('analyzeCorpus long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.analyzeCorpus, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.analyzeCorpus, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.AnalyzeCorpusResponse, + protos.google.cloud.visionai.v1.AnalyzeCorpusMetadata + >; } -/** - * Imports assets (images plus annotations) from a meta file on cloud storage. - * Each row in the meta file is corresponding to an image (specified by a - * cloud storage uri) and its annotations. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.assetsGcsUri - * The file contains all assets information to be imported. - * * The file is in JSONL format. - * * Each line corresponding to one asset. - * * Each line will be converted into InputImageAsset proto. - * @param {string} request.parent - * Required. The parent corpus resource where the assets will be imported. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.import_assets.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_ImportAssets_async - */ + /** + * Imports assets (images plus annotations) from a meta file on cloud storage. + * Each row in the meta file is corresponding to an image (specified by a + * cloud storage uri) and its annotations. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.assetsGcsUri + * The file contains all assets information to be imported. + * * The file is in JSONL format. + * * Each line corresponding to one asset. + * * Each line will be converted into InputImageAsset proto. + * @param {string} request.parent + * Required. The parent corpus resource where the assets will be imported. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.import_assets.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_ImportAssets_async + */ importAssets( - request?: protos.google.cloud.visionai.v1.IImportAssetsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IImportAssetsRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IImportAssetsResponse, + protos.google.cloud.visionai.v1.IImportAssetsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; importAssets( - request: protos.google.cloud.visionai.v1.IImportAssetsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IImportAssetsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IImportAssetsResponse, + protos.google.cloud.visionai.v1.IImportAssetsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; importAssets( - request: protos.google.cloud.visionai.v1.IImportAssetsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IImportAssetsRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IImportAssetsResponse, + protos.google.cloud.visionai.v1.IImportAssetsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; importAssets( - request?: protos.google.cloud.visionai.v1.IImportAssetsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IImportAssetsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IImportAssetsResponse, + protos.google.cloud.visionai.v1.IImportAssetsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IImportAssetsResponse, + protos.google.cloud.visionai.v1.IImportAssetsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IImportAssetsResponse, + protos.google.cloud.visionai.v1.IImportAssetsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IImportAssetsResponse, + protos.google.cloud.visionai.v1.IImportAssetsMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('importAssets response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('importAssets request %j', request); - return this.innerApiCalls.importAssets(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('importAssets response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .importAssets(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IImportAssetsResponse, + protos.google.cloud.visionai.v1.IImportAssetsMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('importAssets response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `importAssets()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.import_assets.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_ImportAssets_async - */ - async checkImportAssetsProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `importAssets()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.import_assets.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_ImportAssets_async + */ + async checkImportAssetsProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.ImportAssetsResponse, + protos.google.cloud.visionai.v1.ImportAssetsMetadata + > + > { this._log.info('importAssets long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importAssets, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.importAssets, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.ImportAssetsResponse, + protos.google.cloud.visionai.v1.ImportAssetsMetadata + >; } -/** - * Creates an IndexEndpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Format: `projects/{project}/locations/{location}` - * @param {string} [request.indexEndpointId] - * Optional. The ID to use for the IndexEndpoint, which will become the final - * component of the IndexEndpoint's resource name if the user specifies it. - * Otherwise, IndexEndpoint id will be autogenerated. - * - * This value should be up to 63 characters, and valid characters - * are a-z, 0-9 and dash (-). The first character must be a letter, the last - * must be a letter or a number. - * @param {google.cloud.visionai.v1.IndexEndpoint} request.indexEndpoint - * Required. The resource being created. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.create_index_endpoint.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateIndexEndpoint_async - */ + /** + * Creates an IndexEndpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Format: `projects/{project}/locations/{location}` + * @param {string} [request.indexEndpointId] + * Optional. The ID to use for the IndexEndpoint, which will become the final + * component of the IndexEndpoint's resource name if the user specifies it. + * Otherwise, IndexEndpoint id will be autogenerated. + * + * This value should be up to 63 characters, and valid characters + * are a-z, 0-9 and dash (-). The first character must be a letter, the last + * must be a letter or a number. + * @param {google.cloud.visionai.v1.IndexEndpoint} request.indexEndpoint + * Required. The resource being created. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.create_index_endpoint.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateIndexEndpoint_async + */ createIndexEndpoint( - request?: protos.google.cloud.visionai.v1.ICreateIndexEndpointRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateIndexEndpointRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.ICreateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createIndexEndpoint( - request: protos.google.cloud.visionai.v1.ICreateIndexEndpointRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateIndexEndpointRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.ICreateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createIndexEndpoint( - request: protos.google.cloud.visionai.v1.ICreateIndexEndpointRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateIndexEndpointRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.ICreateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createIndexEndpoint( - request?: protos.google.cloud.visionai.v1.ICreateIndexEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.ICreateIndexEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.ICreateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.ICreateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.ICreateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.ICreateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createIndexEndpoint response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createIndexEndpoint request %j', request); - return this.innerApiCalls.createIndexEndpoint(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createIndexEndpoint response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createIndexEndpoint(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.ICreateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createIndexEndpoint response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createIndexEndpoint()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.create_index_endpoint.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateIndexEndpoint_async - */ - async checkCreateIndexEndpointProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createIndexEndpoint()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.create_index_endpoint.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateIndexEndpoint_async + */ + async checkCreateIndexEndpointProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.IndexEndpoint, + protos.google.cloud.visionai.v1.CreateIndexEndpointMetadata + > + > { this._log.info('createIndexEndpoint long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createIndexEndpoint, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createIndexEndpoint, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.IndexEndpoint, + protos.google.cloud.visionai.v1.CreateIndexEndpointMetadata + >; } -/** - * Updates an IndexEndpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.IndexEndpoint} request.indexEndpoint - * Required. The resource being updated. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * IndexEndpoint resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. - * A field of the resource will be overwritten if it is in the mask. - * Empty field mask is not allowed. - * If the mask is "*", then this is a full replacement of the resource. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.update_index_endpoint.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateIndexEndpoint_async - */ + /** + * Updates an IndexEndpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.IndexEndpoint} request.indexEndpoint + * Required. The resource being updated. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * IndexEndpoint resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. + * A field of the resource will be overwritten if it is in the mask. + * Empty field mask is not allowed. + * If the mask is "*", then this is a full replacement of the resource. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.update_index_endpoint.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateIndexEndpoint_async + */ updateIndexEndpoint( - request?: protos.google.cloud.visionai.v1.IUpdateIndexEndpointRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUpdateIndexEndpointRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.IUpdateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateIndexEndpoint( - request: protos.google.cloud.visionai.v1.IUpdateIndexEndpointRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateIndexEndpointRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.IUpdateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateIndexEndpoint( - request: protos.google.cloud.visionai.v1.IUpdateIndexEndpointRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUpdateIndexEndpointRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.IUpdateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateIndexEndpoint( - request?: protos.google.cloud.visionai.v1.IUpdateIndexEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUpdateIndexEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.IUpdateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.IUpdateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.IUpdateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'index_endpoint.name': request.indexEndpoint!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'index_endpoint.name': request.indexEndpoint!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.IUpdateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateIndexEndpoint response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateIndexEndpoint request %j', request); - return this.innerApiCalls.updateIndexEndpoint(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateIndexEndpoint response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateIndexEndpoint(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.IUpdateIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateIndexEndpoint response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateIndexEndpoint()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.update_index_endpoint.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateIndexEndpoint_async - */ - async checkUpdateIndexEndpointProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateIndexEndpoint()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.update_index_endpoint.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UpdateIndexEndpoint_async + */ + async checkUpdateIndexEndpointProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.IndexEndpoint, + protos.google.cloud.visionai.v1.UpdateIndexEndpointMetadata + > + > { this._log.info('updateIndexEndpoint long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateIndexEndpoint, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes an IndexEndpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.delete_index_endpoint.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteIndexEndpoint_async - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateIndexEndpoint, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.IndexEndpoint, + protos.google.cloud.visionai.v1.UpdateIndexEndpointMetadata + >; + } + /** + * Deletes an IndexEndpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.delete_index_endpoint.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteIndexEndpoint_async + */ deleteIndexEndpoint( - request?: protos.google.cloud.visionai.v1.IDeleteIndexEndpointRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteIndexEndpointRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteIndexEndpoint( - request: protos.google.cloud.visionai.v1.IDeleteIndexEndpointRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteIndexEndpointRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteIndexEndpoint( - request: protos.google.cloud.visionai.v1.IDeleteIndexEndpointRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteIndexEndpointRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteIndexEndpoint( - request?: protos.google.cloud.visionai.v1.IDeleteIndexEndpointRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteIndexEndpointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteIndexEndpoint response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteIndexEndpoint request %j', request); - return this.innerApiCalls.deleteIndexEndpoint(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteIndexEndpoint response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteIndexEndpoint(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexEndpointMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteIndexEndpoint response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteIndexEndpoint()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.delete_index_endpoint.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteIndexEndpoint_async - */ - async checkDeleteIndexEndpointProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteIndexEndpoint()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.delete_index_endpoint.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteIndexEndpoint_async + */ + async checkDeleteIndexEndpointProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.DeleteIndexEndpointMetadata + > + > { this._log.info('deleteIndexEndpoint long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteIndexEndpoint, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteIndexEndpoint, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.DeleteIndexEndpointMetadata + >; } -/** - * Deploys an Index to IndexEndpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.indexEndpoint - * Required. IndexEndpoint the index is deployed to. - * Format: - * `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}` - * @param {google.cloud.visionai.v1.DeployedIndex} request.deployedIndex - * Required. Index to deploy. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.deploy_index.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeployIndex_async - */ + /** + * Deploys an Index to IndexEndpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.indexEndpoint + * Required. IndexEndpoint the index is deployed to. + * Format: + * `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}` + * @param {google.cloud.visionai.v1.DeployedIndex} request.deployedIndex + * Required. Index to deploy. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.deploy_index.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeployIndex_async + */ deployIndex( - request?: protos.google.cloud.visionai.v1.IDeployIndexRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeployIndexRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IDeployIndexResponse, + protos.google.cloud.visionai.v1.IDeployIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deployIndex( - request: protos.google.cloud.visionai.v1.IDeployIndexRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeployIndexRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IDeployIndexResponse, + protos.google.cloud.visionai.v1.IDeployIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deployIndex( - request: protos.google.cloud.visionai.v1.IDeployIndexRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeployIndexRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IDeployIndexResponse, + protos.google.cloud.visionai.v1.IDeployIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deployIndex( - request?: protos.google.cloud.visionai.v1.IDeployIndexRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeployIndexRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IDeployIndexResponse, + protos.google.cloud.visionai.v1.IDeployIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IDeployIndexResponse, + protos.google.cloud.visionai.v1.IDeployIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IDeployIndexResponse, + protos.google.cloud.visionai.v1.IDeployIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'index_endpoint': request.indexEndpoint ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + index_endpoint: request.indexEndpoint ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IDeployIndexResponse, + protos.google.cloud.visionai.v1.IDeployIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deployIndex response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deployIndex request %j', request); - return this.innerApiCalls.deployIndex(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deployIndex response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deployIndex(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IDeployIndexResponse, + protos.google.cloud.visionai.v1.IDeployIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deployIndex response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deployIndex()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.deploy_index.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeployIndex_async - */ - async checkDeployIndexProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deployIndex()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.deploy_index.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeployIndex_async + */ + async checkDeployIndexProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.DeployIndexResponse, + protos.google.cloud.visionai.v1.DeployIndexMetadata + > + > { this._log.info('deployIndex long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deployIndex, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deployIndex, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.DeployIndexResponse, + protos.google.cloud.visionai.v1.DeployIndexMetadata + >; } -/** - * Undeploys an Index from IndexEndpoint. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.indexEndpoint - * Required. Resource name of the IndexEndpoint resource on which the - * undeployment will act. Format: - * `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.undeploy_index.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UndeployIndex_async - */ + /** + * Undeploys an Index from IndexEndpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.indexEndpoint + * Required. Resource name of the IndexEndpoint resource on which the + * undeployment will act. Format: + * `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}` + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.undeploy_index.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UndeployIndex_async + */ undeployIndex( - request?: protos.google.cloud.visionai.v1.IUndeployIndexRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IUndeployIndexRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IUndeployIndexResponse, + protos.google.cloud.visionai.v1.IUndeployIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; undeployIndex( - request: protos.google.cloud.visionai.v1.IUndeployIndexRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUndeployIndexRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUndeployIndexResponse, + protos.google.cloud.visionai.v1.IUndeployIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; undeployIndex( - request: protos.google.cloud.visionai.v1.IUndeployIndexRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IUndeployIndexRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUndeployIndexResponse, + protos.google.cloud.visionai.v1.IUndeployIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; undeployIndex( - request?: protos.google.cloud.visionai.v1.IUndeployIndexRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IUndeployIndexRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IUndeployIndexResponse, + protos.google.cloud.visionai.v1.IUndeployIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.IUndeployIndexResponse, + protos.google.cloud.visionai.v1.IUndeployIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.IUndeployIndexResponse, + protos.google.cloud.visionai.v1.IUndeployIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'index_endpoint': request.indexEndpoint ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + index_endpoint: request.indexEndpoint ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.IUndeployIndexResponse, + protos.google.cloud.visionai.v1.IUndeployIndexMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('undeployIndex response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('undeployIndex request %j', request); - return this.innerApiCalls.undeployIndex(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('undeployIndex response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .undeployIndex(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.IUndeployIndexResponse, + protos.google.cloud.visionai.v1.IUndeployIndexMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('undeployIndex response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `undeployIndex()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.undeploy_index.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_UndeployIndex_async - */ - async checkUndeployIndexProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `undeployIndex()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.undeploy_index.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_UndeployIndex_async + */ + async checkUndeployIndexProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.UndeployIndexResponse, + protos.google.cloud.visionai.v1.UndeployIndexMetadata + > + > { this._log.info('undeployIndex long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.undeployIndex, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.undeployIndex, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.UndeployIndexResponse, + protos.google.cloud.visionai.v1.UndeployIndexMetadata + >; } -/** - * Creates a collection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this collection will be created. - * Format: `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {google.cloud.visionai.v1.Collection} request.collection - * Required. The collection resource to be created. - * @param {string} [request.collectionId] - * Optional. The ID to use for the collection, which will become the final - * component of the resource name if user choose to specify. Otherwise, - * collection id will be generated by system. - * - * This value should be up to 55 characters, and valid characters - * are /{@link protos.0-9|a-z}-/. The first character must be a letter, the last could be - * a letter or a number. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.create_collection.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateCollection_async - */ + /** + * Creates a collection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this collection will be created. + * Format: `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {google.cloud.visionai.v1.Collection} request.collection + * Required. The collection resource to be created. + * @param {string} [request.collectionId] + * Optional. The ID to use for the collection, which will become the final + * component of the resource name if user choose to specify. Otherwise, + * collection id will be generated by system. + * + * This value should be up to 55 characters, and valid characters + * are /{@link protos.0-9|a-z}-/. The first character must be a letter, the last could be + * a letter or a number. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.create_collection.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateCollection_async + */ createCollection( - request?: protos.google.cloud.visionai.v1.ICreateCollectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.ICreateCollectionRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.ICreateCollectionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createCollection( - request: protos.google.cloud.visionai.v1.ICreateCollectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateCollectionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.ICreateCollectionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createCollection( - request: protos.google.cloud.visionai.v1.ICreateCollectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.ICreateCollectionRequest, + callback: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.ICreateCollectionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createCollection( - request?: protos.google.cloud.visionai.v1.ICreateCollectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.ICreateCollectionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.ICreateCollectionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.ICreateCollectionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.ICreateCollectionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.ICreateCollectionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createCollection response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createCollection request %j', request); - return this.innerApiCalls.createCollection(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createCollection response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createCollection(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.ICreateCollectionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createCollection response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createCollection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.create_collection.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateCollection_async - */ - async checkCreateCollectionProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createCollection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.create_collection.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_CreateCollection_async + */ + async checkCreateCollectionProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.visionai.v1.Collection, + protos.google.cloud.visionai.v1.CreateCollectionMetadata + > + > { this._log.info('createCollection long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createCollection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createCollection, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.visionai.v1.Collection, + protos.google.cloud.visionai.v1.CreateCollectionMetadata + >; } -/** - * Deletes a collection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the collection to delete. Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.delete_collection.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteCollection_async - */ + /** + * Deletes a collection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the collection to delete. Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}` + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.delete_collection.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteCollection_async + */ deleteCollection( - request?: protos.google.cloud.visionai.v1.IDeleteCollectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.visionai.v1.IDeleteCollectionRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCollectionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteCollection( - request: protos.google.cloud.visionai.v1.IDeleteCollectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteCollectionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCollectionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteCollection( - request: protos.google.cloud.visionai.v1.IDeleteCollectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.visionai.v1.IDeleteCollectionRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCollectionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteCollection( - request?: protos.google.cloud.visionai.v1.IDeleteCollectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.visionai.v1.IDeleteCollectionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCollectionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCollectionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCollectionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCollectionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteCollection response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteCollection request %j', request); - return this.innerApiCalls.deleteCollection(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteCollection response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteCollection(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCollectionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteCollection response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteCollection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.delete_collection.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteCollection_async - */ - async checkDeleteCollectionProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteCollection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.delete_collection.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_DeleteCollection_async + */ + async checkDeleteCollectionProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.DeleteCollectionMetadata + > + > { this._log.info('deleteCollection long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteCollection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists an list of assets inside corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of assets. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of assets to return. The service may return fewer than - * this value. - * If unspecified, at most 50 assets will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListAssets` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListAssets` must match - * the call that provided the page token. - * @param {string} request.filter - * The filter applied to the returned list. - * Only the following filterings are supported: - * "assets_with_contents = true", which returns assets with contents uploaded; - * "assets_with_contents = false", which returns assets without contents. - * @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 Array of {@link protos.google.cloud.visionai.v1.Asset|Asset}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteCollection, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.visionai.v1.DeleteCollectionMetadata + >; + } + /** + * Lists an list of assets inside corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of assets. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of assets to return. The service may return fewer than + * this value. + * If unspecified, at most 50 assets will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListAssets` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListAssets` must match + * the call that provided the page token. + * @param {string} request.filter + * The filter applied to the returned list. + * Only the following filterings are supported: + * "assets_with_contents = true", which returns assets with contents uploaded; + * "assets_with_contents = false", which returns assets without contents. + * @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 Array of {@link protos.google.cloud.visionai.v1.Asset|Asset}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listAssets( - request?: protos.google.cloud.visionai.v1.IListAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IAsset[], - protos.google.cloud.visionai.v1.IListAssetsRequest|null, - protos.google.cloud.visionai.v1.IListAssetsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListAssetsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAsset[], + protos.google.cloud.visionai.v1.IListAssetsRequest | null, + protos.google.cloud.visionai.v1.IListAssetsResponse, + ] + >; listAssets( - request: protos.google.cloud.visionai.v1.IListAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListAssetsRequest, - protos.google.cloud.visionai.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.IAsset>): void; + request: protos.google.cloud.visionai.v1.IListAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListAssetsRequest, + protos.google.cloud.visionai.v1.IListAssetsResponse | null | undefined, + protos.google.cloud.visionai.v1.IAsset + >, + ): void; listAssets( - request: protos.google.cloud.visionai.v1.IListAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListAssetsRequest, - protos.google.cloud.visionai.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.IAsset>): void; + request: protos.google.cloud.visionai.v1.IListAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListAssetsRequest, + protos.google.cloud.visionai.v1.IListAssetsResponse | null | undefined, + protos.google.cloud.visionai.v1.IAsset + >, + ): void; listAssets( - request?: protos.google.cloud.visionai.v1.IListAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListAssetsRequest, - protos.google.cloud.visionai.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.IAsset>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListAssetsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListAssetsRequest, - protos.google.cloud.visionai.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.IAsset>): - Promise<[ - protos.google.cloud.visionai.v1.IAsset[], - protos.google.cloud.visionai.v1.IListAssetsRequest|null, - protos.google.cloud.visionai.v1.IListAssetsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListAssetsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IAsset + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListAssetsRequest, + protos.google.cloud.visionai.v1.IListAssetsResponse | null | undefined, + protos.google.cloud.visionai.v1.IAsset + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAsset[], + protos.google.cloud.visionai.v1.IListAssetsRequest | null, + protos.google.cloud.visionai.v1.IListAssetsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListAssetsRequest, - protos.google.cloud.visionai.v1.IListAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.IAsset>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListAssetsRequest, + | protos.google.cloud.visionai.v1.IListAssetsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IAsset + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listAssets values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -5843,231 +8415,260 @@ export class WarehouseClient { this._log.info('listAssets request %j', request); return this.innerApiCalls .listAssets(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IAsset[], - protos.google.cloud.visionai.v1.IListAssetsRequest|null, - protos.google.cloud.visionai.v1.IListAssetsResponse - ]) => { - this._log.info('listAssets values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IAsset[], + protos.google.cloud.visionai.v1.IListAssetsRequest | null, + protos.google.cloud.visionai.v1.IListAssetsResponse, + ]) => { + this._log.info('listAssets values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listAssets`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of assets. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of assets to return. The service may return fewer than - * this value. - * If unspecified, at most 50 assets will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListAssets` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListAssets` must match - * the call that provided the page token. - * @param {string} request.filter - * The filter applied to the returned list. - * Only the following filterings are supported: - * "assets_with_contents = true", which returns assets with contents uploaded; - * "assets_with_contents = false", which returns assets without contents. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Asset|Asset} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listAssets`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of assets. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of assets to return. The service may return fewer than + * this value. + * If unspecified, at most 50 assets will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListAssets` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListAssets` must match + * the call that provided the page token. + * @param {string} request.filter + * The filter applied to the returned list. + * Only the following filterings are supported: + * "assets_with_contents = true", which returns assets with contents uploaded; + * "assets_with_contents = false", which returns assets without contents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Asset|Asset} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listAssetsStream( - request?: protos.google.cloud.visionai.v1.IListAssetsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListAssetsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAssets']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAssets stream %j', request); return this.descriptors.page.listAssets.createStream( this.innerApiCalls.listAssets as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of assets. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of assets to return. The service may return fewer than - * this value. - * If unspecified, at most 50 assets will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListAssets` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListAssets` must match - * the call that provided the page token. - * @param {string} request.filter - * The filter applied to the returned list. - * Only the following filterings are supported: - * "assets_with_contents = true", which returns assets with contents uploaded; - * "assets_with_contents = false", which returns assets without contents. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Asset|Asset}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.list_assets.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_ListAssets_async - */ + /** + * Equivalent to `listAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of assets. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of assets to return. The service may return fewer than + * this value. + * If unspecified, at most 50 assets will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListAssets` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListAssets` must match + * the call that provided the page token. + * @param {string} request.filter + * The filter applied to the returned list. + * Only the following filterings are supported: + * "assets_with_contents = true", which returns assets with contents uploaded; + * "assets_with_contents = false", which returns assets without contents. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Asset|Asset}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.list_assets.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_ListAssets_async + */ listAssetsAsync( - request?: protos.google.cloud.visionai.v1.IListAssetsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListAssetsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAssets']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAssets iterate %j', request); return this.descriptors.page.listAssets.asyncIterate( this.innerApiCalls['listAssets'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists assets inside an index. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.index - * Required. The index that owns this collection of assets. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}` - * @param {number} request.pageSize - * The maximum number of assets to return. The service may return fewer than - * this value. - * If unspecified, at most 50 assets will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ViewIndexedAssets` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ViewIndexedAssets` must - * match the call that provided the page token. - * @param {string} request.filter - * The filter applied to the returned list. - * Only the following filterings are supported: - * "asset_id = xxxx", which returns asset with specified id. - * "asset_id = xxxx, yyyy, zzzz", which returns assets with specified ids. - * @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 Array of {@link protos.google.cloud.visionai.v1.IndexedAsset|IndexedAsset}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `viewIndexedAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists assets inside an index. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.index + * Required. The index that owns this collection of assets. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}` + * @param {number} request.pageSize + * The maximum number of assets to return. The service may return fewer than + * this value. + * If unspecified, at most 50 assets will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ViewIndexedAssets` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ViewIndexedAssets` must + * match the call that provided the page token. + * @param {string} request.filter + * The filter applied to the returned list. + * Only the following filterings are supported: + * "asset_id = xxxx", which returns asset with specified id. + * "asset_id = xxxx, yyyy, zzzz", which returns assets with specified ids. + * @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 Array of {@link protos.google.cloud.visionai.v1.IndexedAsset|IndexedAsset}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `viewIndexedAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ viewIndexedAssets( - request?: protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IIndexedAsset[], - protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest|null, - protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IIndexedAsset[], + protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest | null, + protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse, + ] + >; viewIndexedAssets( - request: protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, - protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndexedAsset>): void; + request: protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, + | protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IIndexedAsset + >, + ): void; viewIndexedAssets( - request: protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, - protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndexedAsset>): void; + request: protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, + | protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IIndexedAsset + >, + ): void; viewIndexedAssets( - request?: protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, - protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndexedAsset>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, - protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndexedAsset>): - Promise<[ - protos.google.cloud.visionai.v1.IIndexedAsset[], - protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest|null, - protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IIndexedAsset + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, + | protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IIndexedAsset + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IIndexedAsset[], + protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest | null, + protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'index': request.index ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + index: request.index ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, - protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndexedAsset>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, + | protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IIndexedAsset + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('viewIndexedAssets values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -6076,226 +8677,249 @@ export class WarehouseClient { this._log.info('viewIndexedAssets request %j', request); return this.innerApiCalls .viewIndexedAssets(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IIndexedAsset[], - protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest|null, - protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse - ]) => { - this._log.info('viewIndexedAssets values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IIndexedAsset[], + protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest | null, + protos.google.cloud.visionai.v1.IViewIndexedAssetsResponse, + ]) => { + this._log.info('viewIndexedAssets values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `viewIndexedAssets`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.index - * Required. The index that owns this collection of assets. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}` - * @param {number} request.pageSize - * The maximum number of assets to return. The service may return fewer than - * this value. - * If unspecified, at most 50 assets will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ViewIndexedAssets` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ViewIndexedAssets` must - * match the call that provided the page token. - * @param {string} request.filter - * The filter applied to the returned list. - * Only the following filterings are supported: - * "asset_id = xxxx", which returns asset with specified id. - * "asset_id = xxxx, yyyy, zzzz", which returns assets with specified ids. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.IndexedAsset|IndexedAsset} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `viewIndexedAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `viewIndexedAssets`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.index + * Required. The index that owns this collection of assets. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}` + * @param {number} request.pageSize + * The maximum number of assets to return. The service may return fewer than + * this value. + * If unspecified, at most 50 assets will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ViewIndexedAssets` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ViewIndexedAssets` must + * match the call that provided the page token. + * @param {string} request.filter + * The filter applied to the returned list. + * Only the following filterings are supported: + * "asset_id = xxxx", which returns asset with specified id. + * "asset_id = xxxx, yyyy, zzzz", which returns assets with specified ids. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.IndexedAsset|IndexedAsset} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `viewIndexedAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ viewIndexedAssetsStream( - request?: protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'index': request.index ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + index: request.index ?? '', + }); const defaultCallSettings = this._defaults['viewIndexedAssets']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('viewIndexedAssets stream %j', request); return this.descriptors.page.viewIndexedAssets.createStream( this.innerApiCalls.viewIndexedAssets as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `viewIndexedAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.index - * Required. The index that owns this collection of assets. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}` - * @param {number} request.pageSize - * The maximum number of assets to return. The service may return fewer than - * this value. - * If unspecified, at most 50 assets will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ViewIndexedAssets` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ViewIndexedAssets` must - * match the call that provided the page token. - * @param {string} request.filter - * The filter applied to the returned list. - * Only the following filterings are supported: - * "asset_id = xxxx", which returns asset with specified id. - * "asset_id = xxxx, yyyy, zzzz", which returns assets with specified ids. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.IndexedAsset|IndexedAsset}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.view_indexed_assets.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_ViewIndexedAssets_async - */ + /** + * Equivalent to `viewIndexedAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.index + * Required. The index that owns this collection of assets. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/indexes/{index}` + * @param {number} request.pageSize + * The maximum number of assets to return. The service may return fewer than + * this value. + * If unspecified, at most 50 assets will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ViewIndexedAssets` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ViewIndexedAssets` must + * match the call that provided the page token. + * @param {string} request.filter + * The filter applied to the returned list. + * Only the following filterings are supported: + * "asset_id = xxxx", which returns asset with specified id. + * "asset_id = xxxx, yyyy, zzzz", which returns assets with specified ids. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.IndexedAsset|IndexedAsset}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.view_indexed_assets.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_ViewIndexedAssets_async + */ viewIndexedAssetsAsync( - request?: protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IViewIndexedAssetsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'index': request.index ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + index: request.index ?? '', + }); const defaultCallSettings = this._defaults['viewIndexedAssets']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('viewIndexedAssets iterate %j', request); return this.descriptors.page.viewIndexedAssets.asyncIterate( this.innerApiCalls['viewIndexedAssets'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * List all Indexes in a given Corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent corpus that owns this collection of indexes. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of indexes to return. The service may return fewer than - * this value. - * If unspecified, at most 50 indexes will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListIndexes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListIndexes` must match - * the call that provided the page token. - * @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 Array of {@link protos.google.cloud.visionai.v1.Index|Index}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listIndexesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * List all Indexes in a given Corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent corpus that owns this collection of indexes. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of indexes to return. The service may return fewer than + * this value. + * If unspecified, at most 50 indexes will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListIndexes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListIndexes` must match + * the call that provided the page token. + * @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 Array of {@link protos.google.cloud.visionai.v1.Index|Index}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listIndexesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listIndexes( - request?: protos.google.cloud.visionai.v1.IListIndexesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IIndex[], - protos.google.cloud.visionai.v1.IListIndexesRequest|null, - protos.google.cloud.visionai.v1.IListIndexesResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListIndexesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IIndex[], + protos.google.cloud.visionai.v1.IListIndexesRequest | null, + protos.google.cloud.visionai.v1.IListIndexesResponse, + ] + >; listIndexes( - request: protos.google.cloud.visionai.v1.IListIndexesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListIndexesRequest, - protos.google.cloud.visionai.v1.IListIndexesResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndex>): void; + request: protos.google.cloud.visionai.v1.IListIndexesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListIndexesRequest, + protos.google.cloud.visionai.v1.IListIndexesResponse | null | undefined, + protos.google.cloud.visionai.v1.IIndex + >, + ): void; listIndexes( - request: protos.google.cloud.visionai.v1.IListIndexesRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListIndexesRequest, - protos.google.cloud.visionai.v1.IListIndexesResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndex>): void; + request: protos.google.cloud.visionai.v1.IListIndexesRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListIndexesRequest, + protos.google.cloud.visionai.v1.IListIndexesResponse | null | undefined, + protos.google.cloud.visionai.v1.IIndex + >, + ): void; listIndexes( - request?: protos.google.cloud.visionai.v1.IListIndexesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListIndexesRequest, - protos.google.cloud.visionai.v1.IListIndexesResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndex>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListIndexesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListIndexesRequest, - protos.google.cloud.visionai.v1.IListIndexesResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndex>): - Promise<[ - protos.google.cloud.visionai.v1.IIndex[], - protos.google.cloud.visionai.v1.IListIndexesRequest|null, - protos.google.cloud.visionai.v1.IListIndexesResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListIndexesResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IIndex + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListIndexesRequest, + protos.google.cloud.visionai.v1.IListIndexesResponse | null | undefined, + protos.google.cloud.visionai.v1.IIndex + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IIndex[], + protos.google.cloud.visionai.v1.IListIndexesRequest | null, + protos.google.cloud.visionai.v1.IListIndexesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListIndexesRequest, - protos.google.cloud.visionai.v1.IListIndexesResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndex>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListIndexesRequest, + | protos.google.cloud.visionai.v1.IListIndexesResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IIndex + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listIndexes values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -6304,221 +8928,244 @@ export class WarehouseClient { this._log.info('listIndexes request %j', request); return this.innerApiCalls .listIndexes(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IIndex[], - protos.google.cloud.visionai.v1.IListIndexesRequest|null, - protos.google.cloud.visionai.v1.IListIndexesResponse - ]) => { - this._log.info('listIndexes values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IIndex[], + protos.google.cloud.visionai.v1.IListIndexesRequest | null, + protos.google.cloud.visionai.v1.IListIndexesResponse, + ]) => { + this._log.info('listIndexes values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listIndexes`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent corpus that owns this collection of indexes. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of indexes to return. The service may return fewer than - * this value. - * If unspecified, at most 50 indexes will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListIndexes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListIndexes` must match - * the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Index|Index} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listIndexesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listIndexes`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent corpus that owns this collection of indexes. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of indexes to return. The service may return fewer than + * this value. + * If unspecified, at most 50 indexes will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListIndexes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListIndexes` must match + * the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Index|Index} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listIndexesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listIndexesStream( - request?: protos.google.cloud.visionai.v1.IListIndexesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListIndexesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listIndexes']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listIndexes stream %j', request); return this.descriptors.page.listIndexes.createStream( this.innerApiCalls.listIndexes as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listIndexes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent corpus that owns this collection of indexes. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of indexes to return. The service may return fewer than - * this value. - * If unspecified, at most 50 indexes will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListIndexes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListIndexes` must match - * the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Index|Index}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.list_indexes.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_ListIndexes_async - */ + /** + * Equivalent to `listIndexes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent corpus that owns this collection of indexes. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of indexes to return. The service may return fewer than + * this value. + * If unspecified, at most 50 indexes will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListIndexes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListIndexes` must match + * the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Index|Index}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.list_indexes.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_ListIndexes_async + */ listIndexesAsync( - request?: protos.google.cloud.visionai.v1.IListIndexesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListIndexesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listIndexes']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listIndexes iterate %j', request); return this.descriptors.page.listIndexes.asyncIterate( this.innerApiCalls['listIndexes'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists all corpora in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the project from which to list corpora. - * @param {number} request.pageSize - * Requested page size. API may return fewer results than requested. - * If negative, INVALID_ARGUMENT error will be returned. - * If unspecified or 0, API will pick a default size, which is 10. - * If the requested page size is larger than the maximum size, API will pick - * use the maximum size, which is 20. - * @param {string} request.pageToken - * A token identifying a page of results for the server to return. - * Typically obtained via - * {@link protos.google.cloud.visionai.v1.ListCorporaResponse.next_page_token|ListCorporaResponse.next_page_token} - * of the previous - * {@link protos.google.cloud.visionai.v1.Warehouse.ListCorpora|Warehouse.ListCorpora} - * call. - * @param {string} request.filter - * The filter applied to the returned corpora list. - * Only the following restrictions are supported: - * `type=`, - * `type!=`. - * @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 Array of {@link protos.google.cloud.visionai.v1.Corpus|Corpus}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCorporaAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists all corpora in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the project from which to list corpora. + * @param {number} request.pageSize + * Requested page size. API may return fewer results than requested. + * If negative, INVALID_ARGUMENT error will be returned. + * If unspecified or 0, API will pick a default size, which is 10. + * If the requested page size is larger than the maximum size, API will pick + * use the maximum size, which is 20. + * @param {string} request.pageToken + * A token identifying a page of results for the server to return. + * Typically obtained via + * {@link protos.google.cloud.visionai.v1.ListCorporaResponse.next_page_token|ListCorporaResponse.next_page_token} + * of the previous + * {@link protos.google.cloud.visionai.v1.Warehouse.ListCorpora|Warehouse.ListCorpora} + * call. + * @param {string} request.filter + * The filter applied to the returned corpora list. + * Only the following restrictions are supported: + * `type=`, + * `type!=`. + * @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 Array of {@link protos.google.cloud.visionai.v1.Corpus|Corpus}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCorporaAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listCorpora( - request?: protos.google.cloud.visionai.v1.IListCorporaRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ICorpus[], - protos.google.cloud.visionai.v1.IListCorporaRequest|null, - protos.google.cloud.visionai.v1.IListCorporaResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListCorporaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICorpus[], + protos.google.cloud.visionai.v1.IListCorporaRequest | null, + protos.google.cloud.visionai.v1.IListCorporaResponse, + ] + >; listCorpora( - request: protos.google.cloud.visionai.v1.IListCorporaRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListCorporaRequest, - protos.google.cloud.visionai.v1.IListCorporaResponse|null|undefined, - protos.google.cloud.visionai.v1.ICorpus>): void; + request: protos.google.cloud.visionai.v1.IListCorporaRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListCorporaRequest, + protos.google.cloud.visionai.v1.IListCorporaResponse | null | undefined, + protos.google.cloud.visionai.v1.ICorpus + >, + ): void; listCorpora( - request: protos.google.cloud.visionai.v1.IListCorporaRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListCorporaRequest, - protos.google.cloud.visionai.v1.IListCorporaResponse|null|undefined, - protos.google.cloud.visionai.v1.ICorpus>): void; + request: protos.google.cloud.visionai.v1.IListCorporaRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListCorporaRequest, + protos.google.cloud.visionai.v1.IListCorporaResponse | null | undefined, + protos.google.cloud.visionai.v1.ICorpus + >, + ): void; listCorpora( - request?: protos.google.cloud.visionai.v1.IListCorporaRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListCorporaRequest, - protos.google.cloud.visionai.v1.IListCorporaResponse|null|undefined, - protos.google.cloud.visionai.v1.ICorpus>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListCorporaRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListCorporaRequest, - protos.google.cloud.visionai.v1.IListCorporaResponse|null|undefined, - protos.google.cloud.visionai.v1.ICorpus>): - Promise<[ - protos.google.cloud.visionai.v1.ICorpus[], - protos.google.cloud.visionai.v1.IListCorporaRequest|null, - protos.google.cloud.visionai.v1.IListCorporaResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListCorporaResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ICorpus + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListCorporaRequest, + protos.google.cloud.visionai.v1.IListCorporaResponse | null | undefined, + protos.google.cloud.visionai.v1.ICorpus + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICorpus[], + protos.google.cloud.visionai.v1.IListCorporaRequest | null, + protos.google.cloud.visionai.v1.IListCorporaResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListCorporaRequest, - protos.google.cloud.visionai.v1.IListCorporaResponse|null|undefined, - protos.google.cloud.visionai.v1.ICorpus>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListCorporaRequest, + | protos.google.cloud.visionai.v1.IListCorporaResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ICorpus + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listCorpora values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -6527,225 +9174,254 @@ export class WarehouseClient { this._log.info('listCorpora request %j', request); return this.innerApiCalls .listCorpora(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.ICorpus[], - protos.google.cloud.visionai.v1.IListCorporaRequest|null, - protos.google.cloud.visionai.v1.IListCorporaResponse - ]) => { - this._log.info('listCorpora values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.ICorpus[], + protos.google.cloud.visionai.v1.IListCorporaRequest | null, + protos.google.cloud.visionai.v1.IListCorporaResponse, + ]) => { + this._log.info('listCorpora values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listCorpora`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the project from which to list corpora. - * @param {number} request.pageSize - * Requested page size. API may return fewer results than requested. - * If negative, INVALID_ARGUMENT error will be returned. - * If unspecified or 0, API will pick a default size, which is 10. - * If the requested page size is larger than the maximum size, API will pick - * use the maximum size, which is 20. - * @param {string} request.pageToken - * A token identifying a page of results for the server to return. - * Typically obtained via - * {@link protos.google.cloud.visionai.v1.ListCorporaResponse.next_page_token|ListCorporaResponse.next_page_token} - * of the previous - * {@link protos.google.cloud.visionai.v1.Warehouse.ListCorpora|Warehouse.ListCorpora} - * call. - * @param {string} request.filter - * The filter applied to the returned corpora list. - * Only the following restrictions are supported: - * `type=`, - * `type!=`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Corpus|Corpus} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listCorporaAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listCorpora`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the project from which to list corpora. + * @param {number} request.pageSize + * Requested page size. API may return fewer results than requested. + * If negative, INVALID_ARGUMENT error will be returned. + * If unspecified or 0, API will pick a default size, which is 10. + * If the requested page size is larger than the maximum size, API will pick + * use the maximum size, which is 20. + * @param {string} request.pageToken + * A token identifying a page of results for the server to return. + * Typically obtained via + * {@link protos.google.cloud.visionai.v1.ListCorporaResponse.next_page_token|ListCorporaResponse.next_page_token} + * of the previous + * {@link protos.google.cloud.visionai.v1.Warehouse.ListCorpora|Warehouse.ListCorpora} + * call. + * @param {string} request.filter + * The filter applied to the returned corpora list. + * Only the following restrictions are supported: + * `type=`, + * `type!=`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Corpus|Corpus} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCorporaAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listCorporaStream( - request?: protos.google.cloud.visionai.v1.IListCorporaRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListCorporaRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listCorpora']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listCorpora stream %j', request); return this.descriptors.page.listCorpora.createStream( this.innerApiCalls.listCorpora as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listCorpora`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the project from which to list corpora. - * @param {number} request.pageSize - * Requested page size. API may return fewer results than requested. - * If negative, INVALID_ARGUMENT error will be returned. - * If unspecified or 0, API will pick a default size, which is 10. - * If the requested page size is larger than the maximum size, API will pick - * use the maximum size, which is 20. - * @param {string} request.pageToken - * A token identifying a page of results for the server to return. - * Typically obtained via - * {@link protos.google.cloud.visionai.v1.ListCorporaResponse.next_page_token|ListCorporaResponse.next_page_token} - * of the previous - * {@link protos.google.cloud.visionai.v1.Warehouse.ListCorpora|Warehouse.ListCorpora} - * call. - * @param {string} request.filter - * The filter applied to the returned corpora list. - * Only the following restrictions are supported: - * `type=`, - * `type!=`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Corpus|Corpus}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.list_corpora.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_ListCorpora_async - */ + /** + * Equivalent to `listCorpora`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the project from which to list corpora. + * @param {number} request.pageSize + * Requested page size. API may return fewer results than requested. + * If negative, INVALID_ARGUMENT error will be returned. + * If unspecified or 0, API will pick a default size, which is 10. + * If the requested page size is larger than the maximum size, API will pick + * use the maximum size, which is 20. + * @param {string} request.pageToken + * A token identifying a page of results for the server to return. + * Typically obtained via + * {@link protos.google.cloud.visionai.v1.ListCorporaResponse.next_page_token|ListCorporaResponse.next_page_token} + * of the previous + * {@link protos.google.cloud.visionai.v1.Warehouse.ListCorpora|Warehouse.ListCorpora} + * call. + * @param {string} request.filter + * The filter applied to the returned corpora list. + * Only the following restrictions are supported: + * `type=`, + * `type!=`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Corpus|Corpus}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.list_corpora.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_ListCorpora_async + */ listCorporaAsync( - request?: protos.google.cloud.visionai.v1.IListCorporaRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListCorporaRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listCorpora']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listCorpora iterate %j', request); return this.descriptors.page.listCorpora.asyncIterate( this.innerApiCalls['listCorpora'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists a list of data schemas inside corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of data schemas. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` - * @param {number} request.pageSize - * The maximum number of data schemas to return. The service may return fewer - * than this value. If unspecified, at most 50 data schemas will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListDataSchemas` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListDataSchemas` must - * match the call that provided the page token. - * @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 Array of {@link protos.google.cloud.visionai.v1.DataSchema|DataSchema}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listDataSchemasAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists a list of data schemas inside corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of data schemas. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` + * @param {number} request.pageSize + * The maximum number of data schemas to return. The service may return fewer + * than this value. If unspecified, at most 50 data schemas will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListDataSchemas` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListDataSchemas` must + * match the call that provided the page token. + * @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 Array of {@link protos.google.cloud.visionai.v1.DataSchema|DataSchema}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listDataSchemasAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listDataSchemas( - request?: protos.google.cloud.visionai.v1.IListDataSchemasRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IDataSchema[], - protos.google.cloud.visionai.v1.IListDataSchemasRequest|null, - protos.google.cloud.visionai.v1.IListDataSchemasResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListDataSchemasRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IDataSchema[], + protos.google.cloud.visionai.v1.IListDataSchemasRequest | null, + protos.google.cloud.visionai.v1.IListDataSchemasResponse, + ] + >; listDataSchemas( - request: protos.google.cloud.visionai.v1.IListDataSchemasRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListDataSchemasRequest, - protos.google.cloud.visionai.v1.IListDataSchemasResponse|null|undefined, - protos.google.cloud.visionai.v1.IDataSchema>): void; + request: protos.google.cloud.visionai.v1.IListDataSchemasRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListDataSchemasRequest, + | protos.google.cloud.visionai.v1.IListDataSchemasResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IDataSchema + >, + ): void; listDataSchemas( - request: protos.google.cloud.visionai.v1.IListDataSchemasRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListDataSchemasRequest, - protos.google.cloud.visionai.v1.IListDataSchemasResponse|null|undefined, - protos.google.cloud.visionai.v1.IDataSchema>): void; + request: protos.google.cloud.visionai.v1.IListDataSchemasRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListDataSchemasRequest, + | protos.google.cloud.visionai.v1.IListDataSchemasResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IDataSchema + >, + ): void; listDataSchemas( - request?: protos.google.cloud.visionai.v1.IListDataSchemasRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListDataSchemasRequest, - protos.google.cloud.visionai.v1.IListDataSchemasResponse|null|undefined, - protos.google.cloud.visionai.v1.IDataSchema>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListDataSchemasRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListDataSchemasRequest, - protos.google.cloud.visionai.v1.IListDataSchemasResponse|null|undefined, - protos.google.cloud.visionai.v1.IDataSchema>): - Promise<[ - protos.google.cloud.visionai.v1.IDataSchema[], - protos.google.cloud.visionai.v1.IListDataSchemasRequest|null, - protos.google.cloud.visionai.v1.IListDataSchemasResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListDataSchemasResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IDataSchema + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListDataSchemasRequest, + | protos.google.cloud.visionai.v1.IListDataSchemasResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IDataSchema + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IDataSchema[], + protos.google.cloud.visionai.v1.IListDataSchemasRequest | null, + protos.google.cloud.visionai.v1.IListDataSchemasResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListDataSchemasRequest, - protos.google.cloud.visionai.v1.IListDataSchemasResponse|null|undefined, - protos.google.cloud.visionai.v1.IDataSchema>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListDataSchemasRequest, + | protos.google.cloud.visionai.v1.IListDataSchemasResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IDataSchema + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listDataSchemas values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -6754,229 +9430,258 @@ export class WarehouseClient { this._log.info('listDataSchemas request %j', request); return this.innerApiCalls .listDataSchemas(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IDataSchema[], - protos.google.cloud.visionai.v1.IListDataSchemasRequest|null, - protos.google.cloud.visionai.v1.IListDataSchemasResponse - ]) => { - this._log.info('listDataSchemas values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IDataSchema[], + protos.google.cloud.visionai.v1.IListDataSchemasRequest | null, + protos.google.cloud.visionai.v1.IListDataSchemasResponse, + ]) => { + this._log.info('listDataSchemas values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listDataSchemas`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of data schemas. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` - * @param {number} request.pageSize - * The maximum number of data schemas to return. The service may return fewer - * than this value. If unspecified, at most 50 data schemas will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListDataSchemas` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListDataSchemas` must - * match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.DataSchema|DataSchema} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listDataSchemasAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listDataSchemas`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of data schemas. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` + * @param {number} request.pageSize + * The maximum number of data schemas to return. The service may return fewer + * than this value. If unspecified, at most 50 data schemas will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListDataSchemas` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListDataSchemas` must + * match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.DataSchema|DataSchema} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listDataSchemasAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listDataSchemasStream( - request?: protos.google.cloud.visionai.v1.IListDataSchemasRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListDataSchemasRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDataSchemas']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDataSchemas stream %j', request); return this.descriptors.page.listDataSchemas.createStream( this.innerApiCalls.listDataSchemas as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listDataSchemas`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of data schemas. - * Format: - * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` - * @param {number} request.pageSize - * The maximum number of data schemas to return. The service may return fewer - * than this value. If unspecified, at most 50 data schemas will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListDataSchemas` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListDataSchemas` must - * match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.DataSchema|DataSchema}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.list_data_schemas.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_ListDataSchemas_async - */ + /** + * Equivalent to `listDataSchemas`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of data schemas. + * Format: + * `projects/{project_number}/locations/{location_id}/corpora/{corpus_id}` + * @param {number} request.pageSize + * The maximum number of data schemas to return. The service may return fewer + * than this value. If unspecified, at most 50 data schemas will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListDataSchemas` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListDataSchemas` must + * match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.DataSchema|DataSchema}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.list_data_schemas.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_ListDataSchemas_async + */ listDataSchemasAsync( - request?: protos.google.cloud.visionai.v1.IListDataSchemasRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListDataSchemasRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDataSchemas']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDataSchemas iterate %j', request); return this.descriptors.page.listDataSchemas.asyncIterate( this.innerApiCalls['listDataSchemas'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists a list of annotations inside asset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent, which owns this collection of annotations. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}` - * @param {number} request.pageSize - * The maximum number of annotations to return. The service may return fewer - * than this value. If unspecified, at most 50 annotations will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListAnnotations` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListAnnotations` must - * match the call that provided the page token. - * @param {string} request.filter - * The filter applied to the returned list. - * We only support filtering for the following fields: - * For corpus of STREAM_VIDEO type: - * `partition.temporal_partition.start_time`, - * `partition.temporal_partition.end_time`, and `key`. - * For corpus of VIDEO_ON_DEMAND type, - * `partition.relative_temporal_partition.start_offset`, - * `partition.relative_temporal_partition.end_offset`, and `key`. - * For corpus of IMAGE type, only `key` is supported. - * Timestamps are specified in the RFC-3339 format, and only one restriction - * may be applied per field, joined by conjunctions. - * Format: - * "partition.temporal_partition.start_time > "2012-04-21T11:30:00-04:00" AND - * partition.temporal_partition.end_time < "2012-04-22T11:30:00-04:00" AND - * key = "example_key"" - * @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 Array of {@link protos.google.cloud.visionai.v1.Annotation|Annotation}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAnnotationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists a list of annotations inside asset. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent, which owns this collection of annotations. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}` + * @param {number} request.pageSize + * The maximum number of annotations to return. The service may return fewer + * than this value. If unspecified, at most 50 annotations will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListAnnotations` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListAnnotations` must + * match the call that provided the page token. + * @param {string} request.filter + * The filter applied to the returned list. + * We only support filtering for the following fields: + * For corpus of STREAM_VIDEO type: + * `partition.temporal_partition.start_time`, + * `partition.temporal_partition.end_time`, and `key`. + * For corpus of VIDEO_ON_DEMAND type, + * `partition.relative_temporal_partition.start_offset`, + * `partition.relative_temporal_partition.end_offset`, and `key`. + * For corpus of IMAGE type, only `key` is supported. + * Timestamps are specified in the RFC-3339 format, and only one restriction + * may be applied per field, joined by conjunctions. + * Format: + * "partition.temporal_partition.start_time > "2012-04-21T11:30:00-04:00" AND + * partition.temporal_partition.end_time < "2012-04-22T11:30:00-04:00" AND + * key = "example_key"" + * @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 Array of {@link protos.google.cloud.visionai.v1.Annotation|Annotation}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listAnnotationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listAnnotations( - request?: protos.google.cloud.visionai.v1.IListAnnotationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IAnnotation[], - protos.google.cloud.visionai.v1.IListAnnotationsRequest|null, - protos.google.cloud.visionai.v1.IListAnnotationsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListAnnotationsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAnnotation[], + protos.google.cloud.visionai.v1.IListAnnotationsRequest | null, + protos.google.cloud.visionai.v1.IListAnnotationsResponse, + ] + >; listAnnotations( - request: protos.google.cloud.visionai.v1.IListAnnotationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListAnnotationsRequest, - protos.google.cloud.visionai.v1.IListAnnotationsResponse|null|undefined, - protos.google.cloud.visionai.v1.IAnnotation>): void; + request: protos.google.cloud.visionai.v1.IListAnnotationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListAnnotationsRequest, + | protos.google.cloud.visionai.v1.IListAnnotationsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IAnnotation + >, + ): void; listAnnotations( - request: protos.google.cloud.visionai.v1.IListAnnotationsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListAnnotationsRequest, - protos.google.cloud.visionai.v1.IListAnnotationsResponse|null|undefined, - protos.google.cloud.visionai.v1.IAnnotation>): void; + request: protos.google.cloud.visionai.v1.IListAnnotationsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListAnnotationsRequest, + | protos.google.cloud.visionai.v1.IListAnnotationsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IAnnotation + >, + ): void; listAnnotations( - request?: protos.google.cloud.visionai.v1.IListAnnotationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListAnnotationsRequest, - protos.google.cloud.visionai.v1.IListAnnotationsResponse|null|undefined, - protos.google.cloud.visionai.v1.IAnnotation>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListAnnotationsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListAnnotationsRequest, - protos.google.cloud.visionai.v1.IListAnnotationsResponse|null|undefined, - protos.google.cloud.visionai.v1.IAnnotation>): - Promise<[ - protos.google.cloud.visionai.v1.IAnnotation[], - protos.google.cloud.visionai.v1.IListAnnotationsRequest|null, - protos.google.cloud.visionai.v1.IListAnnotationsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListAnnotationsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IAnnotation + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListAnnotationsRequest, + | protos.google.cloud.visionai.v1.IListAnnotationsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IAnnotation + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IAnnotation[], + protos.google.cloud.visionai.v1.IListAnnotationsRequest | null, + protos.google.cloud.visionai.v1.IListAnnotationsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListAnnotationsRequest, - protos.google.cloud.visionai.v1.IListAnnotationsResponse|null|undefined, - protos.google.cloud.visionai.v1.IAnnotation>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListAnnotationsRequest, + | protos.google.cloud.visionai.v1.IListAnnotationsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IAnnotation + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listAnnotations values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -6985,246 +9690,275 @@ export class WarehouseClient { this._log.info('listAnnotations request %j', request); return this.innerApiCalls .listAnnotations(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IAnnotation[], - protos.google.cloud.visionai.v1.IListAnnotationsRequest|null, - protos.google.cloud.visionai.v1.IListAnnotationsResponse - ]) => { - this._log.info('listAnnotations values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IAnnotation[], + protos.google.cloud.visionai.v1.IListAnnotationsRequest | null, + protos.google.cloud.visionai.v1.IListAnnotationsResponse, + ]) => { + this._log.info('listAnnotations values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listAnnotations`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent, which owns this collection of annotations. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}` - * @param {number} request.pageSize - * The maximum number of annotations to return. The service may return fewer - * than this value. If unspecified, at most 50 annotations will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListAnnotations` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListAnnotations` must - * match the call that provided the page token. - * @param {string} request.filter - * The filter applied to the returned list. - * We only support filtering for the following fields: - * For corpus of STREAM_VIDEO type: - * `partition.temporal_partition.start_time`, - * `partition.temporal_partition.end_time`, and `key`. - * For corpus of VIDEO_ON_DEMAND type, - * `partition.relative_temporal_partition.start_offset`, - * `partition.relative_temporal_partition.end_offset`, and `key`. - * For corpus of IMAGE type, only `key` is supported. - * Timestamps are specified in the RFC-3339 format, and only one restriction - * may be applied per field, joined by conjunctions. - * Format: - * "partition.temporal_partition.start_time > "2012-04-21T11:30:00-04:00" AND - * partition.temporal_partition.end_time < "2012-04-22T11:30:00-04:00" AND - * key = "example_key"" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Annotation|Annotation} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listAnnotationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listAnnotations`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent, which owns this collection of annotations. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}` + * @param {number} request.pageSize + * The maximum number of annotations to return. The service may return fewer + * than this value. If unspecified, at most 50 annotations will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListAnnotations` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListAnnotations` must + * match the call that provided the page token. + * @param {string} request.filter + * The filter applied to the returned list. + * We only support filtering for the following fields: + * For corpus of STREAM_VIDEO type: + * `partition.temporal_partition.start_time`, + * `partition.temporal_partition.end_time`, and `key`. + * For corpus of VIDEO_ON_DEMAND type, + * `partition.relative_temporal_partition.start_offset`, + * `partition.relative_temporal_partition.end_offset`, and `key`. + * For corpus of IMAGE type, only `key` is supported. + * Timestamps are specified in the RFC-3339 format, and only one restriction + * may be applied per field, joined by conjunctions. + * Format: + * "partition.temporal_partition.start_time > "2012-04-21T11:30:00-04:00" AND + * partition.temporal_partition.end_time < "2012-04-22T11:30:00-04:00" AND + * key = "example_key"" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Annotation|Annotation} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listAnnotationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listAnnotationsStream( - request?: protos.google.cloud.visionai.v1.IListAnnotationsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListAnnotationsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAnnotations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAnnotations stream %j', request); return this.descriptors.page.listAnnotations.createStream( this.innerApiCalls.listAnnotations as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listAnnotations`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent, which owns this collection of annotations. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}` - * @param {number} request.pageSize - * The maximum number of annotations to return. The service may return fewer - * than this value. If unspecified, at most 50 annotations will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListAnnotations` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListAnnotations` must - * match the call that provided the page token. - * @param {string} request.filter - * The filter applied to the returned list. - * We only support filtering for the following fields: - * For corpus of STREAM_VIDEO type: - * `partition.temporal_partition.start_time`, - * `partition.temporal_partition.end_time`, and `key`. - * For corpus of VIDEO_ON_DEMAND type, - * `partition.relative_temporal_partition.start_offset`, - * `partition.relative_temporal_partition.end_offset`, and `key`. - * For corpus of IMAGE type, only `key` is supported. - * Timestamps are specified in the RFC-3339 format, and only one restriction - * may be applied per field, joined by conjunctions. - * Format: - * "partition.temporal_partition.start_time > "2012-04-21T11:30:00-04:00" AND - * partition.temporal_partition.end_time < "2012-04-22T11:30:00-04:00" AND - * key = "example_key"" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Annotation|Annotation}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.list_annotations.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_ListAnnotations_async - */ + /** + * Equivalent to `listAnnotations`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent, which owns this collection of annotations. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/assets/{asset}` + * @param {number} request.pageSize + * The maximum number of annotations to return. The service may return fewer + * than this value. If unspecified, at most 50 annotations will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListAnnotations` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListAnnotations` must + * match the call that provided the page token. + * @param {string} request.filter + * The filter applied to the returned list. + * We only support filtering for the following fields: + * For corpus of STREAM_VIDEO type: + * `partition.temporal_partition.start_time`, + * `partition.temporal_partition.end_time`, and `key`. + * For corpus of VIDEO_ON_DEMAND type, + * `partition.relative_temporal_partition.start_offset`, + * `partition.relative_temporal_partition.end_offset`, and `key`. + * For corpus of IMAGE type, only `key` is supported. + * Timestamps are specified in the RFC-3339 format, and only one restriction + * may be applied per field, joined by conjunctions. + * Format: + * "partition.temporal_partition.start_time > "2012-04-21T11:30:00-04:00" AND + * partition.temporal_partition.end_time < "2012-04-22T11:30:00-04:00" AND + * key = "example_key"" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Annotation|Annotation}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.list_annotations.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_ListAnnotations_async + */ listAnnotationsAsync( - request?: protos.google.cloud.visionai.v1.IListAnnotationsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListAnnotationsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listAnnotations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listAnnotations iterate %j', request); return this.descriptors.page.listAnnotations.asyncIterate( this.innerApiCalls['listAnnotations'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists all search configurations inside a corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of search configurations. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of search configurations to return. The service may - * return fewer than this value. If unspecified, a page size of 50 will be - * used. The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListSearchConfigs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListSearchConfigs` must match the call that provided the page - * token. - * @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 Array of {@link protos.google.cloud.visionai.v1.SearchConfig|SearchConfig}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSearchConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists all search configurations inside a corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of search configurations. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of search configurations to return. The service may + * return fewer than this value. If unspecified, a page size of 50 will be + * used. The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListSearchConfigs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListSearchConfigs` must match the call that provided the page + * token. + * @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 Array of {@link protos.google.cloud.visionai.v1.SearchConfig|SearchConfig}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSearchConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listSearchConfigs( - request?: protos.google.cloud.visionai.v1.IListSearchConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ISearchConfig[], - protos.google.cloud.visionai.v1.IListSearchConfigsRequest|null, - protos.google.cloud.visionai.v1.IListSearchConfigsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListSearchConfigsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchConfig[], + protos.google.cloud.visionai.v1.IListSearchConfigsRequest | null, + protos.google.cloud.visionai.v1.IListSearchConfigsResponse, + ] + >; listSearchConfigs( - request: protos.google.cloud.visionai.v1.IListSearchConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListSearchConfigsRequest, - protos.google.cloud.visionai.v1.IListSearchConfigsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchConfig>): void; + request: protos.google.cloud.visionai.v1.IListSearchConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListSearchConfigsRequest, + | protos.google.cloud.visionai.v1.IListSearchConfigsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchConfig + >, + ): void; listSearchConfigs( - request: protos.google.cloud.visionai.v1.IListSearchConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListSearchConfigsRequest, - protos.google.cloud.visionai.v1.IListSearchConfigsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchConfig>): void; + request: protos.google.cloud.visionai.v1.IListSearchConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListSearchConfigsRequest, + | protos.google.cloud.visionai.v1.IListSearchConfigsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchConfig + >, + ): void; listSearchConfigs( - request?: protos.google.cloud.visionai.v1.IListSearchConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListSearchConfigsRequest, - protos.google.cloud.visionai.v1.IListSearchConfigsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchConfig>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListSearchConfigsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListSearchConfigsRequest, - protos.google.cloud.visionai.v1.IListSearchConfigsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchConfig>): - Promise<[ - protos.google.cloud.visionai.v1.ISearchConfig[], - protos.google.cloud.visionai.v1.IListSearchConfigsRequest|null, - protos.google.cloud.visionai.v1.IListSearchConfigsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListSearchConfigsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchConfig + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListSearchConfigsRequest, + | protos.google.cloud.visionai.v1.IListSearchConfigsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchConfig + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchConfig[], + protos.google.cloud.visionai.v1.IListSearchConfigsRequest | null, + protos.google.cloud.visionai.v1.IListSearchConfigsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListSearchConfigsRequest, - protos.google.cloud.visionai.v1.IListSearchConfigsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchConfig>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListSearchConfigsRequest, + | protos.google.cloud.visionai.v1.IListSearchConfigsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchConfig + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listSearchConfigs values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -7233,216 +9967,245 @@ export class WarehouseClient { this._log.info('listSearchConfigs request %j', request); return this.innerApiCalls .listSearchConfigs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.ISearchConfig[], - protos.google.cloud.visionai.v1.IListSearchConfigsRequest|null, - protos.google.cloud.visionai.v1.IListSearchConfigsResponse - ]) => { - this._log.info('listSearchConfigs values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.ISearchConfig[], + protos.google.cloud.visionai.v1.IListSearchConfigsRequest | null, + protos.google.cloud.visionai.v1.IListSearchConfigsResponse, + ]) => { + this._log.info('listSearchConfigs values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listSearchConfigs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of search configurations. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of search configurations to return. The service may - * return fewer than this value. If unspecified, a page size of 50 will be - * used. The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListSearchConfigs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListSearchConfigs` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.SearchConfig|SearchConfig} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSearchConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listSearchConfigs`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of search configurations. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of search configurations to return. The service may + * return fewer than this value. If unspecified, a page size of 50 will be + * used. The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListSearchConfigs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListSearchConfigs` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.SearchConfig|SearchConfig} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSearchConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listSearchConfigsStream( - request?: protos.google.cloud.visionai.v1.IListSearchConfigsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListSearchConfigsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSearchConfigs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSearchConfigs stream %j', request); return this.descriptors.page.listSearchConfigs.createStream( this.innerApiCalls.listSearchConfigs as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listSearchConfigs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of search configurations. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of search configurations to return. The service may - * return fewer than this value. If unspecified, a page size of 50 will be - * used. The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListSearchConfigs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListSearchConfigs` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.SearchConfig|SearchConfig}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.list_search_configs.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_ListSearchConfigs_async - */ + /** + * Equivalent to `listSearchConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of search configurations. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of search configurations to return. The service may + * return fewer than this value. If unspecified, a page size of 50 will be + * used. The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListSearchConfigs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListSearchConfigs` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.SearchConfig|SearchConfig}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.list_search_configs.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_ListSearchConfigs_async + */ listSearchConfigsAsync( - request?: protos.google.cloud.visionai.v1.IListSearchConfigsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListSearchConfigsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSearchConfigs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSearchConfigs iterate %j', request); return this.descriptors.page.listSearchConfigs.asyncIterate( this.innerApiCalls['listSearchConfigs'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists SearchHypernyms inside a corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of SearchHypernyms. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of SearchHypernyms returned. The service may - * return fewer than this value. If unspecified, a page size of 50 will be - * used. The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `SearchHypernym` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `SearchHypernym` must match the call that provided the page - * token. - * @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 Array of {@link protos.google.cloud.visionai.v1.SearchHypernym|SearchHypernym}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSearchHypernymsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists SearchHypernyms inside a corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of SearchHypernyms. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of SearchHypernyms returned. The service may + * return fewer than this value. If unspecified, a page size of 50 will be + * used. The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `SearchHypernym` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `SearchHypernym` must match the call that provided the page + * token. + * @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 Array of {@link protos.google.cloud.visionai.v1.SearchHypernym|SearchHypernym}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSearchHypernymsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listSearchHypernyms( - request?: protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ISearchHypernym[], - protos.google.cloud.visionai.v1.IListSearchHypernymsRequest|null, - protos.google.cloud.visionai.v1.IListSearchHypernymsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchHypernym[], + protos.google.cloud.visionai.v1.IListSearchHypernymsRequest | null, + protos.google.cloud.visionai.v1.IListSearchHypernymsResponse, + ] + >; listSearchHypernyms( - request: protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, - protos.google.cloud.visionai.v1.IListSearchHypernymsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchHypernym>): void; + request: protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, + | protos.google.cloud.visionai.v1.IListSearchHypernymsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchHypernym + >, + ): void; listSearchHypernyms( - request: protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, - protos.google.cloud.visionai.v1.IListSearchHypernymsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchHypernym>): void; + request: protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, + | protos.google.cloud.visionai.v1.IListSearchHypernymsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchHypernym + >, + ): void; listSearchHypernyms( - request?: protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, - protos.google.cloud.visionai.v1.IListSearchHypernymsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchHypernym>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, - protos.google.cloud.visionai.v1.IListSearchHypernymsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchHypernym>): - Promise<[ - protos.google.cloud.visionai.v1.ISearchHypernym[], - protos.google.cloud.visionai.v1.IListSearchHypernymsRequest|null, - protos.google.cloud.visionai.v1.IListSearchHypernymsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListSearchHypernymsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchHypernym + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, + | protos.google.cloud.visionai.v1.IListSearchHypernymsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchHypernym + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchHypernym[], + protos.google.cloud.visionai.v1.IListSearchHypernymsRequest | null, + protos.google.cloud.visionai.v1.IListSearchHypernymsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, - protos.google.cloud.visionai.v1.IListSearchHypernymsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchHypernym>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, + | protos.google.cloud.visionai.v1.IListSearchHypernymsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchHypernym + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listSearchHypernyms values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -7451,232 +10214,255 @@ export class WarehouseClient { this._log.info('listSearchHypernyms request %j', request); return this.innerApiCalls .listSearchHypernyms(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.ISearchHypernym[], - protos.google.cloud.visionai.v1.IListSearchHypernymsRequest|null, - protos.google.cloud.visionai.v1.IListSearchHypernymsResponse - ]) => { - this._log.info('listSearchHypernyms values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.ISearchHypernym[], + protos.google.cloud.visionai.v1.IListSearchHypernymsRequest | null, + protos.google.cloud.visionai.v1.IListSearchHypernymsResponse, + ]) => { + this._log.info('listSearchHypernyms values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listSearchHypernyms`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of SearchHypernyms. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of SearchHypernyms returned. The service may - * return fewer than this value. If unspecified, a page size of 50 will be - * used. The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `SearchHypernym` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `SearchHypernym` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.SearchHypernym|SearchHypernym} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSearchHypernymsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listSearchHypernyms`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of SearchHypernyms. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of SearchHypernyms returned. The service may + * return fewer than this value. If unspecified, a page size of 50 will be + * used. The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `SearchHypernym` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `SearchHypernym` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.SearchHypernym|SearchHypernym} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSearchHypernymsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listSearchHypernymsStream( - request?: protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSearchHypernyms']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSearchHypernyms stream %j', request); return this.descriptors.page.listSearchHypernyms.createStream( this.innerApiCalls.listSearchHypernyms as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listSearchHypernyms`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of SearchHypernyms. - * Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of SearchHypernyms returned. The service may - * return fewer than this value. If unspecified, a page size of 50 will be - * used. The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `SearchHypernym` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `SearchHypernym` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.SearchHypernym|SearchHypernym}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.list_search_hypernyms.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_ListSearchHypernyms_async - */ + /** + * Equivalent to `listSearchHypernyms`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of SearchHypernyms. + * Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of SearchHypernyms returned. The service may + * return fewer than this value. If unspecified, a page size of 50 will be + * used. The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `SearchHypernym` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `SearchHypernym` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.SearchHypernym|SearchHypernym}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.list_search_hypernyms.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_ListSearchHypernyms_async + */ listSearchHypernymsAsync( - request?: protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListSearchHypernymsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSearchHypernyms']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSearchHypernyms iterate %j', request); return this.descriptors.page.listSearchHypernyms.asyncIterate( this.innerApiCalls['listSearchHypernyms'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Search media asset. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.SchemaKeySortingStrategy} request.schemaKeySortingStrategy - * Sort by the value under the data schema key. - * @param {string} request.corpus - * Required. The parent corpus to search. - * Format: `projects/{project_id}/locations/{location_id}/corpora/{corpus_id}' - * @param {number} request.pageSize - * The number of results to be returned in this page. If it's 0, the server - * will decide the appropriate page_size. - * @param {string} request.pageToken - * The continuation token to fetch the next page. If empty, it means it is - * fetching the first page. - * @param {google.cloud.visionai.v1.DateTimeRangeArray} request.contentTimeRanges - * Time ranges that matching video content must fall within. If no ranges are - * provided, there will be no time restriction. This field is treated just - * like the criteria below, but defined separately for convenience as it is - * used frequently. Note that if the end_time is in the future, it will be - * clamped to the time the request was received. - * @param {number[]} request.criteria - * Criteria applied to search results. - * @param {number[]} request.facetSelections - * Stores most recent facet selection state. Only facet groups with user's - * selection will be presented here. Selection state is either selected or - * unselected. Only selected facet buckets will be used as search criteria. - * @param {string[]} request.resultAnnotationKeys - * A list of annotation keys to specify the annotations to be retrieved and - * returned with each search result. - * Annotation granularity must be GRANULARITY_ASSET_LEVEL and its search - * strategy must not be NO_SEARCH. - * @param {string} request.searchQuery - * Global search query. Allows user to search assets without needing to - * specify which field the value belongs to. - * @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 Array of {@link protos.google.cloud.visionai.v1.SearchResultItem|SearchResultItem}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `searchAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Search media asset. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.SchemaKeySortingStrategy} request.schemaKeySortingStrategy + * Sort by the value under the data schema key. + * @param {string} request.corpus + * Required. The parent corpus to search. + * Format: `projects/{project_id}/locations/{location_id}/corpora/{corpus_id}' + * @param {number} request.pageSize + * The number of results to be returned in this page. If it's 0, the server + * will decide the appropriate page_size. + * @param {string} request.pageToken + * The continuation token to fetch the next page. If empty, it means it is + * fetching the first page. + * @param {google.cloud.visionai.v1.DateTimeRangeArray} request.contentTimeRanges + * Time ranges that matching video content must fall within. If no ranges are + * provided, there will be no time restriction. This field is treated just + * like the criteria below, but defined separately for convenience as it is + * used frequently. Note that if the end_time is in the future, it will be + * clamped to the time the request was received. + * @param {number[]} request.criteria + * Criteria applied to search results. + * @param {number[]} request.facetSelections + * Stores most recent facet selection state. Only facet groups with user's + * selection will be presented here. Selection state is either selected or + * unselected. Only selected facet buckets will be used as search criteria. + * @param {string[]} request.resultAnnotationKeys + * A list of annotation keys to specify the annotations to be retrieved and + * returned with each search result. + * Annotation granularity must be GRANULARITY_ASSET_LEVEL and its search + * strategy must not be NO_SEARCH. + * @param {string} request.searchQuery + * Global search query. Allows user to search assets without needing to + * specify which field the value belongs to. + * @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 Array of {@link protos.google.cloud.visionai.v1.SearchResultItem|SearchResultItem}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `searchAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ searchAssets( - request?: protos.google.cloud.visionai.v1.ISearchAssetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ISearchResultItem[], - protos.google.cloud.visionai.v1.ISearchAssetsRequest|null, - protos.google.cloud.visionai.v1.ISearchAssetsResponse - ]>; + request?: protos.google.cloud.visionai.v1.ISearchAssetsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchResultItem[], + protos.google.cloud.visionai.v1.ISearchAssetsRequest | null, + protos.google.cloud.visionai.v1.ISearchAssetsResponse, + ] + >; searchAssets( - request: protos.google.cloud.visionai.v1.ISearchAssetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.ISearchAssetsRequest, - protos.google.cloud.visionai.v1.ISearchAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchResultItem>): void; + request: protos.google.cloud.visionai.v1.ISearchAssetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.ISearchAssetsRequest, + protos.google.cloud.visionai.v1.ISearchAssetsResponse | null | undefined, + protos.google.cloud.visionai.v1.ISearchResultItem + >, + ): void; searchAssets( - request: protos.google.cloud.visionai.v1.ISearchAssetsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.ISearchAssetsRequest, - protos.google.cloud.visionai.v1.ISearchAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchResultItem>): void; + request: protos.google.cloud.visionai.v1.ISearchAssetsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.ISearchAssetsRequest, + protos.google.cloud.visionai.v1.ISearchAssetsResponse | null | undefined, + protos.google.cloud.visionai.v1.ISearchResultItem + >, + ): void; searchAssets( - request?: protos.google.cloud.visionai.v1.ISearchAssetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.ISearchAssetsRequest, - protos.google.cloud.visionai.v1.ISearchAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchResultItem>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.ISearchAssetsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.ISearchAssetsRequest, - protos.google.cloud.visionai.v1.ISearchAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchResultItem>): - Promise<[ - protos.google.cloud.visionai.v1.ISearchResultItem[], - protos.google.cloud.visionai.v1.ISearchAssetsRequest|null, - protos.google.cloud.visionai.v1.ISearchAssetsResponse - ]>|void { + | protos.google.cloud.visionai.v1.ISearchAssetsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchResultItem + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.ISearchAssetsRequest, + protos.google.cloud.visionai.v1.ISearchAssetsResponse | null | undefined, + protos.google.cloud.visionai.v1.ISearchResultItem + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchResultItem[], + protos.google.cloud.visionai.v1.ISearchAssetsRequest | null, + protos.google.cloud.visionai.v1.ISearchAssetsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'corpus': request.corpus ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + corpus: request.corpus ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.ISearchAssetsRequest, - protos.google.cloud.visionai.v1.ISearchAssetsResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchResultItem>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.ISearchAssetsRequest, + | protos.google.cloud.visionai.v1.ISearchAssetsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchResultItem + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('searchAssets values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -7685,255 +10471,284 @@ export class WarehouseClient { this._log.info('searchAssets request %j', request); return this.innerApiCalls .searchAssets(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.ISearchResultItem[], - protos.google.cloud.visionai.v1.ISearchAssetsRequest|null, - protos.google.cloud.visionai.v1.ISearchAssetsResponse - ]) => { - this._log.info('searchAssets values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.ISearchResultItem[], + protos.google.cloud.visionai.v1.ISearchAssetsRequest | null, + protos.google.cloud.visionai.v1.ISearchAssetsResponse, + ]) => { + this._log.info('searchAssets values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `searchAssets`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.SchemaKeySortingStrategy} request.schemaKeySortingStrategy - * Sort by the value under the data schema key. - * @param {string} request.corpus - * Required. The parent corpus to search. - * Format: `projects/{project_id}/locations/{location_id}/corpora/{corpus_id}' - * @param {number} request.pageSize - * The number of results to be returned in this page. If it's 0, the server - * will decide the appropriate page_size. - * @param {string} request.pageToken - * The continuation token to fetch the next page. If empty, it means it is - * fetching the first page. - * @param {google.cloud.visionai.v1.DateTimeRangeArray} request.contentTimeRanges - * Time ranges that matching video content must fall within. If no ranges are - * provided, there will be no time restriction. This field is treated just - * like the criteria below, but defined separately for convenience as it is - * used frequently. Note that if the end_time is in the future, it will be - * clamped to the time the request was received. - * @param {number[]} request.criteria - * Criteria applied to search results. - * @param {number[]} request.facetSelections - * Stores most recent facet selection state. Only facet groups with user's - * selection will be presented here. Selection state is either selected or - * unselected. Only selected facet buckets will be used as search criteria. - * @param {string[]} request.resultAnnotationKeys - * A list of annotation keys to specify the annotations to be retrieved and - * returned with each search result. - * Annotation granularity must be GRANULARITY_ASSET_LEVEL and its search - * strategy must not be NO_SEARCH. - * @param {string} request.searchQuery - * Global search query. Allows user to search assets without needing to - * specify which field the value belongs to. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.SearchResultItem|SearchResultItem} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `searchAssetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `searchAssets`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.SchemaKeySortingStrategy} request.schemaKeySortingStrategy + * Sort by the value under the data schema key. + * @param {string} request.corpus + * Required. The parent corpus to search. + * Format: `projects/{project_id}/locations/{location_id}/corpora/{corpus_id}' + * @param {number} request.pageSize + * The number of results to be returned in this page. If it's 0, the server + * will decide the appropriate page_size. + * @param {string} request.pageToken + * The continuation token to fetch the next page. If empty, it means it is + * fetching the first page. + * @param {google.cloud.visionai.v1.DateTimeRangeArray} request.contentTimeRanges + * Time ranges that matching video content must fall within. If no ranges are + * provided, there will be no time restriction. This field is treated just + * like the criteria below, but defined separately for convenience as it is + * used frequently. Note that if the end_time is in the future, it will be + * clamped to the time the request was received. + * @param {number[]} request.criteria + * Criteria applied to search results. + * @param {number[]} request.facetSelections + * Stores most recent facet selection state. Only facet groups with user's + * selection will be presented here. Selection state is either selected or + * unselected. Only selected facet buckets will be used as search criteria. + * @param {string[]} request.resultAnnotationKeys + * A list of annotation keys to specify the annotations to be retrieved and + * returned with each search result. + * Annotation granularity must be GRANULARITY_ASSET_LEVEL and its search + * strategy must not be NO_SEARCH. + * @param {string} request.searchQuery + * Global search query. Allows user to search assets without needing to + * specify which field the value belongs to. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.SearchResultItem|SearchResultItem} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `searchAssetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ searchAssetsStream( - request?: protos.google.cloud.visionai.v1.ISearchAssetsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.ISearchAssetsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'corpus': request.corpus ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + corpus: request.corpus ?? '', + }); const defaultCallSettings = this._defaults['searchAssets']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('searchAssets stream %j', request); return this.descriptors.page.searchAssets.createStream( this.innerApiCalls.searchAssets as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `searchAssets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.SchemaKeySortingStrategy} request.schemaKeySortingStrategy - * Sort by the value under the data schema key. - * @param {string} request.corpus - * Required. The parent corpus to search. - * Format: `projects/{project_id}/locations/{location_id}/corpora/{corpus_id}' - * @param {number} request.pageSize - * The number of results to be returned in this page. If it's 0, the server - * will decide the appropriate page_size. - * @param {string} request.pageToken - * The continuation token to fetch the next page. If empty, it means it is - * fetching the first page. - * @param {google.cloud.visionai.v1.DateTimeRangeArray} request.contentTimeRanges - * Time ranges that matching video content must fall within. If no ranges are - * provided, there will be no time restriction. This field is treated just - * like the criteria below, but defined separately for convenience as it is - * used frequently. Note that if the end_time is in the future, it will be - * clamped to the time the request was received. - * @param {number[]} request.criteria - * Criteria applied to search results. - * @param {number[]} request.facetSelections - * Stores most recent facet selection state. Only facet groups with user's - * selection will be presented here. Selection state is either selected or - * unselected. Only selected facet buckets will be used as search criteria. - * @param {string[]} request.resultAnnotationKeys - * A list of annotation keys to specify the annotations to be retrieved and - * returned with each search result. - * Annotation granularity must be GRANULARITY_ASSET_LEVEL and its search - * strategy must not be NO_SEARCH. - * @param {string} request.searchQuery - * Global search query. Allows user to search assets without needing to - * specify which field the value belongs to. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.SearchResultItem|SearchResultItem}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.search_assets.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_SearchAssets_async - */ + /** + * Equivalent to `searchAssets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.SchemaKeySortingStrategy} request.schemaKeySortingStrategy + * Sort by the value under the data schema key. + * @param {string} request.corpus + * Required. The parent corpus to search. + * Format: `projects/{project_id}/locations/{location_id}/corpora/{corpus_id}' + * @param {number} request.pageSize + * The number of results to be returned in this page. If it's 0, the server + * will decide the appropriate page_size. + * @param {string} request.pageToken + * The continuation token to fetch the next page. If empty, it means it is + * fetching the first page. + * @param {google.cloud.visionai.v1.DateTimeRangeArray} request.contentTimeRanges + * Time ranges that matching video content must fall within. If no ranges are + * provided, there will be no time restriction. This field is treated just + * like the criteria below, but defined separately for convenience as it is + * used frequently. Note that if the end_time is in the future, it will be + * clamped to the time the request was received. + * @param {number[]} request.criteria + * Criteria applied to search results. + * @param {number[]} request.facetSelections + * Stores most recent facet selection state. Only facet groups with user's + * selection will be presented here. Selection state is either selected or + * unselected. Only selected facet buckets will be used as search criteria. + * @param {string[]} request.resultAnnotationKeys + * A list of annotation keys to specify the annotations to be retrieved and + * returned with each search result. + * Annotation granularity must be GRANULARITY_ASSET_LEVEL and its search + * strategy must not be NO_SEARCH. + * @param {string} request.searchQuery + * Global search query. Allows user to search assets without needing to + * specify which field the value belongs to. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.SearchResultItem|SearchResultItem}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.search_assets.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_SearchAssets_async + */ searchAssetsAsync( - request?: protos.google.cloud.visionai.v1.ISearchAssetsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.ISearchAssetsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'corpus': request.corpus ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + corpus: request.corpus ?? '', + }); const defaultCallSettings = this._defaults['searchAssets']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('searchAssets iterate %j', request); return this.descriptors.page.searchAssets.asyncIterate( this.innerApiCalls['searchAssets'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Search a deployed index endpoint (IMAGE corpus type only). - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.ImageQuery} request.imageQuery - * An image-only query. - * @param {string} request.textQuery - * A text-only query. - * @param {string} request.indexEndpoint - * Required. The index endpoint to search. - * Format: - * `projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}' - * @param {number[]} request.criteria - * Criteria applied to search results. - * @param {number[]} request.exclusionCriteria - * Criteria to exclude from search results. - * Note that `fetch_matched_annotations` will be ignored. - * @param {number} request.pageSize - * Requested page size. API may return fewer results than requested. - * If negative, INVALID_ARGUMENT error will be returned. - * If unspecified or 0, API will pick a default size, which is 10. - * If the requested page size is larger than the maximum size, API will pick - * the maximum size, which is 200. - * @param {string} request.pageToken - * The continuation token to fetch the next page. If empty, it means it is - * fetching the first page. - * @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 Array of {@link protos.google.cloud.visionai.v1.SearchResultItem|SearchResultItem}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `searchIndexEndpointAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Search a deployed index endpoint (IMAGE corpus type only). + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.ImageQuery} request.imageQuery + * An image-only query. + * @param {string} request.textQuery + * A text-only query. + * @param {string} request.indexEndpoint + * Required. The index endpoint to search. + * Format: + * `projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}' + * @param {number[]} request.criteria + * Criteria applied to search results. + * @param {number[]} request.exclusionCriteria + * Criteria to exclude from search results. + * Note that `fetch_matched_annotations` will be ignored. + * @param {number} request.pageSize + * Requested page size. API may return fewer results than requested. + * If negative, INVALID_ARGUMENT error will be returned. + * If unspecified or 0, API will pick a default size, which is 10. + * If the requested page size is larger than the maximum size, API will pick + * the maximum size, which is 200. + * @param {string} request.pageToken + * The continuation token to fetch the next page. If empty, it means it is + * fetching the first page. + * @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 Array of {@link protos.google.cloud.visionai.v1.SearchResultItem|SearchResultItem}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `searchIndexEndpointAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ searchIndexEndpoint( - request?: protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ISearchResultItem[], - protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest|null, - protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse - ]>; + request?: protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchResultItem[], + protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest | null, + protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse, + ] + >; searchIndexEndpoint( - request: protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, - protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchResultItem>): void; + request: protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, + | protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchResultItem + >, + ): void; searchIndexEndpoint( - request: protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, - protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchResultItem>): void; + request: protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, + | protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchResultItem + >, + ): void; searchIndexEndpoint( - request?: protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, - protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchResultItem>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, - protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchResultItem>): - Promise<[ - protos.google.cloud.visionai.v1.ISearchResultItem[], - protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest|null, - protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse - ]>|void { + | protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchResultItem + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, + | protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchResultItem + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ISearchResultItem[], + protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest | null, + protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'index_endpoint': request.indexEndpoint ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + index_endpoint: request.indexEndpoint ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, - protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse|null|undefined, - protos.google.cloud.visionai.v1.ISearchResultItem>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, + | protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ISearchResultItem + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('searchIndexEndpoint values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -7942,236 +10757,265 @@ export class WarehouseClient { this._log.info('searchIndexEndpoint request %j', request); return this.innerApiCalls .searchIndexEndpoint(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.ISearchResultItem[], - protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest|null, - protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse - ]) => { - this._log.info('searchIndexEndpoint values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.ISearchResultItem[], + protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest | null, + protos.google.cloud.visionai.v1.ISearchIndexEndpointResponse, + ]) => { + this._log.info('searchIndexEndpoint values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `searchIndexEndpoint`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.ImageQuery} request.imageQuery - * An image-only query. - * @param {string} request.textQuery - * A text-only query. - * @param {string} request.indexEndpoint - * Required. The index endpoint to search. - * Format: - * `projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}' - * @param {number[]} request.criteria - * Criteria applied to search results. - * @param {number[]} request.exclusionCriteria - * Criteria to exclude from search results. - * Note that `fetch_matched_annotations` will be ignored. - * @param {number} request.pageSize - * Requested page size. API may return fewer results than requested. - * If negative, INVALID_ARGUMENT error will be returned. - * If unspecified or 0, API will pick a default size, which is 10. - * If the requested page size is larger than the maximum size, API will pick - * the maximum size, which is 200. - * @param {string} request.pageToken - * The continuation token to fetch the next page. If empty, it means it is - * fetching the first page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.SearchResultItem|SearchResultItem} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `searchIndexEndpointAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `searchIndexEndpoint`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.ImageQuery} request.imageQuery + * An image-only query. + * @param {string} request.textQuery + * A text-only query. + * @param {string} request.indexEndpoint + * Required. The index endpoint to search. + * Format: + * `projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}' + * @param {number[]} request.criteria + * Criteria applied to search results. + * @param {number[]} request.exclusionCriteria + * Criteria to exclude from search results. + * Note that `fetch_matched_annotations` will be ignored. + * @param {number} request.pageSize + * Requested page size. API may return fewer results than requested. + * If negative, INVALID_ARGUMENT error will be returned. + * If unspecified or 0, API will pick a default size, which is 10. + * If the requested page size is larger than the maximum size, API will pick + * the maximum size, which is 200. + * @param {string} request.pageToken + * The continuation token to fetch the next page. If empty, it means it is + * fetching the first page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.SearchResultItem|SearchResultItem} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `searchIndexEndpointAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ searchIndexEndpointStream( - request?: protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'index_endpoint': request.indexEndpoint ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + index_endpoint: request.indexEndpoint ?? '', + }); const defaultCallSettings = this._defaults['searchIndexEndpoint']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('searchIndexEndpoint stream %j', request); return this.descriptors.page.searchIndexEndpoint.createStream( this.innerApiCalls.searchIndexEndpoint as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `searchIndexEndpoint`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.visionai.v1.ImageQuery} request.imageQuery - * An image-only query. - * @param {string} request.textQuery - * A text-only query. - * @param {string} request.indexEndpoint - * Required. The index endpoint to search. - * Format: - * `projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}' - * @param {number[]} request.criteria - * Criteria applied to search results. - * @param {number[]} request.exclusionCriteria - * Criteria to exclude from search results. - * Note that `fetch_matched_annotations` will be ignored. - * @param {number} request.pageSize - * Requested page size. API may return fewer results than requested. - * If negative, INVALID_ARGUMENT error will be returned. - * If unspecified or 0, API will pick a default size, which is 10. - * If the requested page size is larger than the maximum size, API will pick - * the maximum size, which is 200. - * @param {string} request.pageToken - * The continuation token to fetch the next page. If empty, it means it is - * fetching the first page. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.SearchResultItem|SearchResultItem}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.search_index_endpoint.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_SearchIndexEndpoint_async - */ + /** + * Equivalent to `searchIndexEndpoint`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.visionai.v1.ImageQuery} request.imageQuery + * An image-only query. + * @param {string} request.textQuery + * A text-only query. + * @param {string} request.indexEndpoint + * Required. The index endpoint to search. + * Format: + * `projects/{project_id}/locations/{location_id}/indexEndpoints/{index_endpoint_id}' + * @param {number[]} request.criteria + * Criteria applied to search results. + * @param {number[]} request.exclusionCriteria + * Criteria to exclude from search results. + * Note that `fetch_matched_annotations` will be ignored. + * @param {number} request.pageSize + * Requested page size. API may return fewer results than requested. + * If negative, INVALID_ARGUMENT error will be returned. + * If unspecified or 0, API will pick a default size, which is 10. + * If the requested page size is larger than the maximum size, API will pick + * the maximum size, which is 200. + * @param {string} request.pageToken + * The continuation token to fetch the next page. If empty, it means it is + * fetching the first page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.SearchResultItem|SearchResultItem}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.search_index_endpoint.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_SearchIndexEndpoint_async + */ searchIndexEndpointAsync( - request?: protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.ISearchIndexEndpointRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'index_endpoint': request.indexEndpoint ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + index_endpoint: request.indexEndpoint ?? '', + }); const defaultCallSettings = this._defaults['searchIndexEndpoint']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('searchIndexEndpoint iterate %j', request); return this.descriptors.page.searchIndexEndpoint.asyncIterate( this.innerApiCalls['searchIndexEndpoint'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists all IndexEndpoints in a project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Format: `projects/{project}/locations/{location}` - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. The service may return fewer than this value. If unspecified, a - * page size of 50 will be used. The maximum value is 1000; values above 1000 - * will be coerced to 1000. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. The filter applied to the returned list. - * We only support filtering for the `deployed_image_index.image_index` field. - * However, to filter by a corpus instead of an image index, simply use - * `deployed_image_index.corpus`, which will return all endpoints with - * `deployed_image_index.image_index` inside of the given corpus. - * A basic filter on image index would look like: - * deployed_image_index.image_index = - * "projects/123/locations/us-central1/corpora/my_corpus/imageIndexes/my_image_index" - * A basic filter on corpus would look like: - * deployed_image_index.corpus = - * "projects/123/locations/us-central1/corpora/my_corpus" - * @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 Array of {@link protos.google.cloud.visionai.v1.IndexEndpoint|IndexEndpoint}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listIndexEndpointsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists all IndexEndpoints in a project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Format: `projects/{project}/locations/{location}` + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. The service may return fewer than this value. If unspecified, a + * page size of 50 will be used. The maximum value is 1000; values above 1000 + * will be coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. The filter applied to the returned list. + * We only support filtering for the `deployed_image_index.image_index` field. + * However, to filter by a corpus instead of an image index, simply use + * `deployed_image_index.corpus`, which will return all endpoints with + * `deployed_image_index.image_index` inside of the given corpus. + * A basic filter on image index would look like: + * deployed_image_index.image_index = + * "projects/123/locations/us-central1/corpora/my_corpus/imageIndexes/my_image_index" + * A basic filter on corpus would look like: + * deployed_image_index.corpus = + * "projects/123/locations/us-central1/corpora/my_corpus" + * @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 Array of {@link protos.google.cloud.visionai.v1.IndexEndpoint|IndexEndpoint}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listIndexEndpointsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listIndexEndpoints( - request?: protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.IIndexEndpoint[], - protos.google.cloud.visionai.v1.IListIndexEndpointsRequest|null, - protos.google.cloud.visionai.v1.IListIndexEndpointsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.IIndexEndpoint[], + protos.google.cloud.visionai.v1.IListIndexEndpointsRequest | null, + protos.google.cloud.visionai.v1.IListIndexEndpointsResponse, + ] + >; listIndexEndpoints( - request: protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, - protos.google.cloud.visionai.v1.IListIndexEndpointsResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndexEndpoint>): void; + request: protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, + | protos.google.cloud.visionai.v1.IListIndexEndpointsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IIndexEndpoint + >, + ): void; listIndexEndpoints( - request: protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, - protos.google.cloud.visionai.v1.IListIndexEndpointsResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndexEndpoint>): void; + request: protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, + | protos.google.cloud.visionai.v1.IListIndexEndpointsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IIndexEndpoint + >, + ): void; listIndexEndpoints( - request?: protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, - protos.google.cloud.visionai.v1.IListIndexEndpointsResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndexEndpoint>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, - protos.google.cloud.visionai.v1.IListIndexEndpointsResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndexEndpoint>): - Promise<[ - protos.google.cloud.visionai.v1.IIndexEndpoint[], - protos.google.cloud.visionai.v1.IListIndexEndpointsRequest|null, - protos.google.cloud.visionai.v1.IListIndexEndpointsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListIndexEndpointsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IIndexEndpoint + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, + | protos.google.cloud.visionai.v1.IListIndexEndpointsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IIndexEndpoint + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.IIndexEndpoint[], + protos.google.cloud.visionai.v1.IListIndexEndpointsRequest | null, + protos.google.cloud.visionai.v1.IListIndexEndpointsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, - protos.google.cloud.visionai.v1.IListIndexEndpointsResponse|null|undefined, - protos.google.cloud.visionai.v1.IIndexEndpoint>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, + | protos.google.cloud.visionai.v1.IListIndexEndpointsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.IIndexEndpoint + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listIndexEndpoints values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -8180,226 +11024,255 @@ export class WarehouseClient { this._log.info('listIndexEndpoints request %j', request); return this.innerApiCalls .listIndexEndpoints(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.IIndexEndpoint[], - protos.google.cloud.visionai.v1.IListIndexEndpointsRequest|null, - protos.google.cloud.visionai.v1.IListIndexEndpointsResponse - ]) => { - this._log.info('listIndexEndpoints values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.IIndexEndpoint[], + protos.google.cloud.visionai.v1.IListIndexEndpointsRequest | null, + protos.google.cloud.visionai.v1.IListIndexEndpointsResponse, + ]) => { + this._log.info('listIndexEndpoints values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listIndexEndpoints`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Format: `projects/{project}/locations/{location}` - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. The service may return fewer than this value. If unspecified, a - * page size of 50 will be used. The maximum value is 1000; values above 1000 - * will be coerced to 1000. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. The filter applied to the returned list. - * We only support filtering for the `deployed_image_index.image_index` field. - * However, to filter by a corpus instead of an image index, simply use - * `deployed_image_index.corpus`, which will return all endpoints with - * `deployed_image_index.image_index` inside of the given corpus. - * A basic filter on image index would look like: - * deployed_image_index.image_index = - * "projects/123/locations/us-central1/corpora/my_corpus/imageIndexes/my_image_index" - * A basic filter on corpus would look like: - * deployed_image_index.corpus = - * "projects/123/locations/us-central1/corpora/my_corpus" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.IndexEndpoint|IndexEndpoint} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listIndexEndpointsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listIndexEndpoints`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Format: `projects/{project}/locations/{location}` + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. The service may return fewer than this value. If unspecified, a + * page size of 50 will be used. The maximum value is 1000; values above 1000 + * will be coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. The filter applied to the returned list. + * We only support filtering for the `deployed_image_index.image_index` field. + * However, to filter by a corpus instead of an image index, simply use + * `deployed_image_index.corpus`, which will return all endpoints with + * `deployed_image_index.image_index` inside of the given corpus. + * A basic filter on image index would look like: + * deployed_image_index.image_index = + * "projects/123/locations/us-central1/corpora/my_corpus/imageIndexes/my_image_index" + * A basic filter on corpus would look like: + * deployed_image_index.corpus = + * "projects/123/locations/us-central1/corpora/my_corpus" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.IndexEndpoint|IndexEndpoint} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listIndexEndpointsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listIndexEndpointsStream( - request?: protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listIndexEndpoints']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listIndexEndpoints stream %j', request); return this.descriptors.page.listIndexEndpoints.createStream( this.innerApiCalls.listIndexEndpoints as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listIndexEndpoints`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Format: `projects/{project}/locations/{location}` - * @param {number} [request.pageSize] - * Optional. Requested page size. Server may return fewer items than - * requested. The service may return fewer than this value. If unspecified, a - * page size of 50 will be used. The maximum value is 1000; values above 1000 - * will be coerced to 1000. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * @param {string} [request.filter] - * Optional. The filter applied to the returned list. - * We only support filtering for the `deployed_image_index.image_index` field. - * However, to filter by a corpus instead of an image index, simply use - * `deployed_image_index.corpus`, which will return all endpoints with - * `deployed_image_index.image_index` inside of the given corpus. - * A basic filter on image index would look like: - * deployed_image_index.image_index = - * "projects/123/locations/us-central1/corpora/my_corpus/imageIndexes/my_image_index" - * A basic filter on corpus would look like: - * deployed_image_index.corpus = - * "projects/123/locations/us-central1/corpora/my_corpus" - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.IndexEndpoint|IndexEndpoint}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.list_index_endpoints.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_ListIndexEndpoints_async - */ + /** + * Equivalent to `listIndexEndpoints`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Format: `projects/{project}/locations/{location}` + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. The service may return fewer than this value. If unspecified, a + * page size of 50 will be used. The maximum value is 1000; values above 1000 + * will be coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. The filter applied to the returned list. + * We only support filtering for the `deployed_image_index.image_index` field. + * However, to filter by a corpus instead of an image index, simply use + * `deployed_image_index.corpus`, which will return all endpoints with + * `deployed_image_index.image_index` inside of the given corpus. + * A basic filter on image index would look like: + * deployed_image_index.image_index = + * "projects/123/locations/us-central1/corpora/my_corpus/imageIndexes/my_image_index" + * A basic filter on corpus would look like: + * deployed_image_index.corpus = + * "projects/123/locations/us-central1/corpora/my_corpus" + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.IndexEndpoint|IndexEndpoint}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.list_index_endpoints.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_ListIndexEndpoints_async + */ listIndexEndpointsAsync( - request?: protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListIndexEndpointsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listIndexEndpoints']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listIndexEndpoints iterate %j', request); return this.descriptors.page.listIndexEndpoints.asyncIterate( this.innerApiCalls['listIndexEndpoints'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists collections inside a corpus. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent corpus. Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of collections to return. The service may return fewer - * than this value. If unspecified, at most 50 collections will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListCollectionsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListCollectionsRequest` - * must match the call that provided the page token. - * @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 Array of {@link protos.google.cloud.visionai.v1.Collection|Collection}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCollectionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists collections inside a corpus. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent corpus. Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of collections to return. The service may return fewer + * than this value. If unspecified, at most 50 collections will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListCollectionsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListCollectionsRequest` + * must match the call that provided the page token. + * @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 Array of {@link protos.google.cloud.visionai.v1.Collection|Collection}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCollectionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listCollections( - request?: protos.google.cloud.visionai.v1.IListCollectionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ICollection[], - protos.google.cloud.visionai.v1.IListCollectionsRequest|null, - protos.google.cloud.visionai.v1.IListCollectionsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IListCollectionsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICollection[], + protos.google.cloud.visionai.v1.IListCollectionsRequest | null, + protos.google.cloud.visionai.v1.IListCollectionsResponse, + ] + >; listCollections( - request: protos.google.cloud.visionai.v1.IListCollectionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListCollectionsRequest, - protos.google.cloud.visionai.v1.IListCollectionsResponse|null|undefined, - protos.google.cloud.visionai.v1.ICollection>): void; + request: protos.google.cloud.visionai.v1.IListCollectionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListCollectionsRequest, + | protos.google.cloud.visionai.v1.IListCollectionsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ICollection + >, + ): void; listCollections( - request: protos.google.cloud.visionai.v1.IListCollectionsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IListCollectionsRequest, - protos.google.cloud.visionai.v1.IListCollectionsResponse|null|undefined, - protos.google.cloud.visionai.v1.ICollection>): void; + request: protos.google.cloud.visionai.v1.IListCollectionsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IListCollectionsRequest, + | protos.google.cloud.visionai.v1.IListCollectionsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ICollection + >, + ): void; listCollections( - request?: protos.google.cloud.visionai.v1.IListCollectionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IListCollectionsRequest, - protos.google.cloud.visionai.v1.IListCollectionsResponse|null|undefined, - protos.google.cloud.visionai.v1.ICollection>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IListCollectionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IListCollectionsRequest, - protos.google.cloud.visionai.v1.IListCollectionsResponse|null|undefined, - protos.google.cloud.visionai.v1.ICollection>): - Promise<[ - protos.google.cloud.visionai.v1.ICollection[], - protos.google.cloud.visionai.v1.IListCollectionsRequest|null, - protos.google.cloud.visionai.v1.IListCollectionsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IListCollectionsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ICollection + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IListCollectionsRequest, + | protos.google.cloud.visionai.v1.IListCollectionsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ICollection + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICollection[], + protos.google.cloud.visionai.v1.IListCollectionsRequest | null, + protos.google.cloud.visionai.v1.IListCollectionsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IListCollectionsRequest, - protos.google.cloud.visionai.v1.IListCollectionsResponse|null|undefined, - protos.google.cloud.visionai.v1.ICollection>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IListCollectionsRequest, + | protos.google.cloud.visionai.v1.IListCollectionsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ICollection + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listCollections values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -8408,211 +11281,240 @@ export class WarehouseClient { this._log.info('listCollections request %j', request); return this.innerApiCalls .listCollections(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.ICollection[], - protos.google.cloud.visionai.v1.IListCollectionsRequest|null, - protos.google.cloud.visionai.v1.IListCollectionsResponse - ]) => { - this._log.info('listCollections values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.ICollection[], + protos.google.cloud.visionai.v1.IListCollectionsRequest | null, + protos.google.cloud.visionai.v1.IListCollectionsResponse, + ]) => { + this._log.info('listCollections values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listCollections`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent corpus. Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of collections to return. The service may return fewer - * than this value. If unspecified, at most 50 collections will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListCollectionsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListCollectionsRequest` - * must match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Collection|Collection} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listCollectionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listCollections`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent corpus. Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of collections to return. The service may return fewer + * than this value. If unspecified, at most 50 collections will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListCollectionsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListCollectionsRequest` + * must match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.Collection|Collection} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCollectionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listCollectionsStream( - request?: protos.google.cloud.visionai.v1.IListCollectionsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IListCollectionsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listCollections']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listCollections stream %j', request); return this.descriptors.page.listCollections.createStream( this.innerApiCalls.listCollections as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listCollections`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent corpus. Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}` - * @param {number} request.pageSize - * The maximum number of collections to return. The service may return fewer - * than this value. If unspecified, at most 50 collections will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ListCollectionsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListCollectionsRequest` - * must match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.Collection|Collection}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.list_collections.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_ListCollections_async - */ + /** + * Equivalent to `listCollections`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent corpus. Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}` + * @param {number} request.pageSize + * The maximum number of collections to return. The service may return fewer + * than this value. If unspecified, at most 50 collections will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListCollectionsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListCollectionsRequest` + * must match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.Collection|Collection}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.list_collections.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_ListCollections_async + */ listCollectionsAsync( - request?: protos.google.cloud.visionai.v1.IListCollectionsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IListCollectionsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listCollections']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listCollections iterate %j', request); return this.descriptors.page.listCollections.asyncIterate( this.innerApiCalls['listCollections'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * View items inside a collection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.collection - * Required. The collection to view. Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}` - * @param {number} request.pageSize - * The maximum number of collections to return. The service may return fewer - * than this value. If unspecified, at most 50 collections will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ViewCollectionItemsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ViewCollectionItemsRequest` must match the call that provided the page - * token. - * @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 Array of {@link protos.google.cloud.visionai.v1.CollectionItem|CollectionItem}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `viewCollectionItemsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * View items inside a collection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.collection + * Required. The collection to view. Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}` + * @param {number} request.pageSize + * The maximum number of collections to return. The service may return fewer + * than this value. If unspecified, at most 50 collections will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ViewCollectionItemsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ViewCollectionItemsRequest` must match the call that provided the page + * token. + * @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 Array of {@link protos.google.cloud.visionai.v1.CollectionItem|CollectionItem}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `viewCollectionItemsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ viewCollectionItems( - request?: protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.visionai.v1.ICollectionItem[], - protos.google.cloud.visionai.v1.IViewCollectionItemsRequest|null, - protos.google.cloud.visionai.v1.IViewCollectionItemsResponse - ]>; + request?: protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICollectionItem[], + protos.google.cloud.visionai.v1.IViewCollectionItemsRequest | null, + protos.google.cloud.visionai.v1.IViewCollectionItemsResponse, + ] + >; viewCollectionItems( - request: protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, - protos.google.cloud.visionai.v1.IViewCollectionItemsResponse|null|undefined, - protos.google.cloud.visionai.v1.ICollectionItem>): void; + request: protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, + | protos.google.cloud.visionai.v1.IViewCollectionItemsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ICollectionItem + >, + ): void; viewCollectionItems( - request: protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, - callback: PaginationCallback< - protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, - protos.google.cloud.visionai.v1.IViewCollectionItemsResponse|null|undefined, - protos.google.cloud.visionai.v1.ICollectionItem>): void; + request: protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, + callback: PaginationCallback< + protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, + | protos.google.cloud.visionai.v1.IViewCollectionItemsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ICollectionItem + >, + ): void; viewCollectionItems( - request?: protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, - protos.google.cloud.visionai.v1.IViewCollectionItemsResponse|null|undefined, - protos.google.cloud.visionai.v1.ICollectionItem>, - callback?: PaginationCallback< + request?: protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, - protos.google.cloud.visionai.v1.IViewCollectionItemsResponse|null|undefined, - protos.google.cloud.visionai.v1.ICollectionItem>): - Promise<[ - protos.google.cloud.visionai.v1.ICollectionItem[], - protos.google.cloud.visionai.v1.IViewCollectionItemsRequest|null, - protos.google.cloud.visionai.v1.IViewCollectionItemsResponse - ]>|void { + | protos.google.cloud.visionai.v1.IViewCollectionItemsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ICollectionItem + >, + callback?: PaginationCallback< + protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, + | protos.google.cloud.visionai.v1.IViewCollectionItemsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ICollectionItem + >, + ): Promise< + [ + protos.google.cloud.visionai.v1.ICollectionItem[], + protos.google.cloud.visionai.v1.IViewCollectionItemsRequest | null, + protos.google.cloud.visionai.v1.IViewCollectionItemsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'collection': request.collection ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + collection: request.collection ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, - protos.google.cloud.visionai.v1.IViewCollectionItemsResponse|null|undefined, - protos.google.cloud.visionai.v1.ICollectionItem>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, + | protos.google.cloud.visionai.v1.IViewCollectionItemsResponse + | null + | undefined, + protos.google.cloud.visionai.v1.ICollectionItem + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('viewCollectionItems values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -8621,149 +11523,153 @@ export class WarehouseClient { this._log.info('viewCollectionItems request %j', request); return this.innerApiCalls .viewCollectionItems(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.visionai.v1.ICollectionItem[], - protos.google.cloud.visionai.v1.IViewCollectionItemsRequest|null, - protos.google.cloud.visionai.v1.IViewCollectionItemsResponse - ]) => { - this._log.info('viewCollectionItems values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.visionai.v1.ICollectionItem[], + protos.google.cloud.visionai.v1.IViewCollectionItemsRequest | null, + protos.google.cloud.visionai.v1.IViewCollectionItemsResponse, + ]) => { + this._log.info('viewCollectionItems values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `viewCollectionItems`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.collection - * Required. The collection to view. Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}` - * @param {number} request.pageSize - * The maximum number of collections to return. The service may return fewer - * than this value. If unspecified, at most 50 collections will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ViewCollectionItemsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ViewCollectionItemsRequest` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.CollectionItem|CollectionItem} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `viewCollectionItemsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `viewCollectionItems`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.collection + * Required. The collection to view. Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}` + * @param {number} request.pageSize + * The maximum number of collections to return. The service may return fewer + * than this value. If unspecified, at most 50 collections will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ViewCollectionItemsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ViewCollectionItemsRequest` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.visionai.v1.CollectionItem|CollectionItem} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `viewCollectionItemsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ viewCollectionItemsStream( - request?: protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'collection': request.collection ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + collection: request.collection ?? '', + }); const defaultCallSettings = this._defaults['viewCollectionItems']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('viewCollectionItems stream %j', request); return this.descriptors.page.viewCollectionItems.createStream( this.innerApiCalls.viewCollectionItems as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `viewCollectionItems`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.collection - * Required. The collection to view. Format: - * `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}` - * @param {number} request.pageSize - * The maximum number of collections to return. The service may return fewer - * than this value. If unspecified, at most 50 collections will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * A page token, received from a previous `ViewCollectionItemsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ViewCollectionItemsRequest` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.visionai.v1.CollectionItem|CollectionItem}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/warehouse.view_collection_items.js - * region_tag:warehouse-visionai_v1_generated_Warehouse_ViewCollectionItems_async - */ + /** + * Equivalent to `viewCollectionItems`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.collection + * Required. The collection to view. Format: + * `projects/{project_number}/locations/{location}/corpora/{corpus}/collections/{collection}` + * @param {number} request.pageSize + * The maximum number of collections to return. The service may return fewer + * than this value. If unspecified, at most 50 collections will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ViewCollectionItemsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ViewCollectionItemsRequest` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.visionai.v1.CollectionItem|CollectionItem}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/warehouse.view_collection_items.js + * region_tag:warehouse-visionai_v1_generated_Warehouse_ViewCollectionItems_async + */ viewCollectionItemsAsync( - request?: protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.visionai.v1.IViewCollectionItemsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'collection': request.collection ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + collection: request.collection ?? '', + }); const defaultCallSettings = this._defaults['viewCollectionItems']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('viewCollectionItems iterate %j', request); return this.descriptors.page.viewCollectionItems.asyncIterate( this.innerApiCalls['viewCollectionItems'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + /** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getIamPolicy( request: IamProtos.google.iam.v1.GetIamPolicyRequest, options?: @@ -8777,40 +11683,40 @@ export class WarehouseClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.getIamPolicy(request, options, callback); } -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ setIamPolicy( request: IamProtos.google.iam.v1.SetIamPolicyRequest, options?: @@ -8824,41 +11730,41 @@ export class WarehouseClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.setIamPolicy(request, options, callback); } -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ testIamPermissions( request: IamProtos.google.iam.v1.TestIamPermissionsRequest, options?: @@ -8872,12 +11778,12 @@ export class WarehouseClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -8912,12 +11818,11 @@ export class WarehouseClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -8950,12 +11855,12 @@ export class WarehouseClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } -/** + /** * Gets the latest state of a long-running operation. Clients can use this * method to poll the operation result at intervals as recommended by the API * service. @@ -8998,22 +11903,22 @@ export class WarehouseClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -9048,15 +11953,15 @@ export class WarehouseClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -9090,7 +11995,7 @@ export class WarehouseClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -9103,25 +12008,24 @@ export class WarehouseClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.cancelOperation(request, options, callback); } - /** * Deletes a long-running operation. This method indicates that the client is * no longer interested in the operation result. It does not cancel the @@ -9160,22 +12064,22 @@ export class WarehouseClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -9192,7 +12096,12 @@ export class WarehouseClient { * @param {string} analysis * @returns {string} Resource name string. */ - analysisPath(project:string,location:string,cluster:string,analysis:string) { + analysisPath( + project: string, + location: string, + cluster: string, + analysis: string, + ) { return this.pathTemplates.analysisPathTemplate.render({ project: project, location: location, @@ -9255,7 +12164,13 @@ export class WarehouseClient { * @param {string} annotation * @returns {string} Resource name string. */ - annotationPath(projectNumber:string,location:string,corpus:string,asset:string,annotation:string) { + annotationPath( + projectNumber: string, + location: string, + corpus: string, + asset: string, + annotation: string, + ) { return this.pathTemplates.annotationPathTemplate.render({ project_number: projectNumber, location: location, @@ -9273,7 +12188,8 @@ export class WarehouseClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).project_number; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .project_number; } /** @@ -9284,7 +12200,8 @@ export class WarehouseClient { * @returns {string} A string representing the location. */ matchLocationFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).location; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .location; } /** @@ -9295,7 +12212,8 @@ export class WarehouseClient { * @returns {string} A string representing the corpus. */ matchCorpusFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).corpus; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .corpus; } /** @@ -9306,7 +12224,8 @@ export class WarehouseClient { * @returns {string} A string representing the asset. */ matchAssetFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).asset; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .asset; } /** @@ -9317,7 +12236,8 @@ export class WarehouseClient { * @returns {string} A string representing the annotation. */ matchAnnotationFromAnnotationName(annotationName: string) { - return this.pathTemplates.annotationPathTemplate.match(annotationName).annotation; + return this.pathTemplates.annotationPathTemplate.match(annotationName) + .annotation; } /** @@ -9328,7 +12248,7 @@ export class WarehouseClient { * @param {string} application * @returns {string} Resource name string. */ - applicationPath(project:string,location:string,application:string) { + applicationPath(project: string, location: string, application: string) { return this.pathTemplates.applicationPathTemplate.render({ project: project, location: location, @@ -9344,7 +12264,8 @@ export class WarehouseClient { * @returns {string} A string representing the project. */ matchProjectFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).project; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .project; } /** @@ -9355,7 +12276,8 @@ export class WarehouseClient { * @returns {string} A string representing the location. */ matchLocationFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).location; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .location; } /** @@ -9366,7 +12288,8 @@ export class WarehouseClient { * @returns {string} A string representing the application. */ matchApplicationFromApplicationName(applicationName: string) { - return this.pathTemplates.applicationPathTemplate.match(applicationName).application; + return this.pathTemplates.applicationPathTemplate.match(applicationName) + .application; } /** @@ -9378,7 +12301,12 @@ export class WarehouseClient { * @param {string} asset * @returns {string} Resource name string. */ - assetPath(projectNumber:string,location:string,corpus:string,asset:string) { + assetPath( + projectNumber: string, + location: string, + corpus: string, + asset: string, + ) { return this.pathTemplates.assetPathTemplate.render({ project_number: projectNumber, location: location, @@ -9440,7 +12368,12 @@ export class WarehouseClient { * @param {string} channel * @returns {string} Resource name string. */ - channelPath(project:string,location:string,cluster:string,channel:string) { + channelPath( + project: string, + location: string, + cluster: string, + channel: string, + ) { return this.pathTemplates.channelPathTemplate.render({ project: project, location: location, @@ -9501,7 +12434,7 @@ export class WarehouseClient { * @param {string} cluster * @returns {string} Resource name string. */ - clusterPath(project:string,location:string,cluster:string) { + clusterPath(project: string, location: string, cluster: string) { return this.pathTemplates.clusterPathTemplate.render({ project: project, location: location, @@ -9551,7 +12484,12 @@ export class WarehouseClient { * @param {string} collection * @returns {string} Resource name string. */ - collectionPath(projectNumber:string,location:string,corpus:string,collection:string) { + collectionPath( + projectNumber: string, + location: string, + corpus: string, + collection: string, + ) { return this.pathTemplates.collectionPathTemplate.render({ project_number: projectNumber, location: location, @@ -9568,7 +12506,8 @@ export class WarehouseClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).project_number; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .project_number; } /** @@ -9579,7 +12518,8 @@ export class WarehouseClient { * @returns {string} A string representing the location. */ matchLocationFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).location; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .location; } /** @@ -9590,7 +12530,8 @@ export class WarehouseClient { * @returns {string} A string representing the corpus. */ matchCorpusFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).corpus; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .corpus; } /** @@ -9601,7 +12542,8 @@ export class WarehouseClient { * @returns {string} A string representing the collection. */ matchCollectionFromCollectionName(collectionName: string) { - return this.pathTemplates.collectionPathTemplate.match(collectionName).collection; + return this.pathTemplates.collectionPathTemplate.match(collectionName) + .collection; } /** @@ -9612,7 +12554,7 @@ export class WarehouseClient { * @param {string} corpus * @returns {string} Resource name string. */ - corpusPath(projectNumber:string,location:string,corpus:string) { + corpusPath(projectNumber: string, location: string, corpus: string) { return this.pathTemplates.corpusPathTemplate.render({ project_number: projectNumber, location: location, @@ -9628,7 +12570,8 @@ export class WarehouseClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromCorpusName(corpusName: string) { - return this.pathTemplates.corpusPathTemplate.match(corpusName).project_number; + return this.pathTemplates.corpusPathTemplate.match(corpusName) + .project_number; } /** @@ -9662,7 +12605,12 @@ export class WarehouseClient { * @param {string} data_schema * @returns {string} Resource name string. */ - dataSchemaPath(projectNumber:string,location:string,corpus:string,dataSchema:string) { + dataSchemaPath( + projectNumber: string, + location: string, + corpus: string, + dataSchema: string, + ) { return this.pathTemplates.dataSchemaPathTemplate.render({ project_number: projectNumber, location: location, @@ -9679,7 +12627,8 @@ export class WarehouseClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).project_number; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .project_number; } /** @@ -9690,7 +12639,8 @@ export class WarehouseClient { * @returns {string} A string representing the location. */ matchLocationFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).location; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .location; } /** @@ -9701,7 +12651,8 @@ export class WarehouseClient { * @returns {string} A string representing the corpus. */ matchCorpusFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).corpus; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .corpus; } /** @@ -9712,7 +12663,8 @@ export class WarehouseClient { * @returns {string} A string representing the data_schema. */ matchDataSchemaFromDataSchemaName(dataSchemaName: string) { - return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName).data_schema; + return this.pathTemplates.dataSchemaPathTemplate.match(dataSchemaName) + .data_schema; } /** @@ -9724,7 +12676,12 @@ export class WarehouseClient { * @param {string} draft * @returns {string} Resource name string. */ - draftPath(project:string,location:string,application:string,draft:string) { + draftPath( + project: string, + location: string, + application: string, + draft: string, + ) { return this.pathTemplates.draftPathTemplate.render({ project: project, location: location, @@ -9786,7 +12743,7 @@ export class WarehouseClient { * @param {string} event * @returns {string} Resource name string. */ - eventPath(project:string,location:string,cluster:string,event:string) { + eventPath(project: string, location: string, cluster: string, event: string) { return this.pathTemplates.eventPathTemplate.render({ project: project, location: location, @@ -9848,7 +12805,12 @@ export class WarehouseClient { * @param {string} index * @returns {string} Resource name string. */ - indexPath(projectNumber:string,location:string,corpus:string,index:string) { + indexPath( + projectNumber: string, + location: string, + corpus: string, + index: string, + ) { return this.pathTemplates.indexPathTemplate.render({ project_number: projectNumber, location: location, @@ -9909,7 +12871,7 @@ export class WarehouseClient { * @param {string} index_endpoint * @returns {string} Resource name string. */ - indexEndpointPath(project:string,location:string,indexEndpoint:string) { + indexEndpointPath(project: string, location: string, indexEndpoint: string) { return this.pathTemplates.indexEndpointPathTemplate.render({ project: project, location: location, @@ -9925,7 +12887,8 @@ export class WarehouseClient { * @returns {string} A string representing the project. */ matchProjectFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).project; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .project; } /** @@ -9936,7 +12899,8 @@ export class WarehouseClient { * @returns {string} A string representing the location. */ matchLocationFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).location; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .location; } /** @@ -9947,7 +12911,8 @@ export class WarehouseClient { * @returns {string} A string representing the index_endpoint. */ matchIndexEndpointFromIndexEndpointName(indexEndpointName: string) { - return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName).index_endpoint; + return this.pathTemplates.indexEndpointPathTemplate.match(indexEndpointName) + .index_endpoint; } /** @@ -9959,7 +12924,12 @@ export class WarehouseClient { * @param {string} instance * @returns {string} Resource name string. */ - instancePath(project:string,location:string,application:string,instance:string) { + instancePath( + project: string, + location: string, + application: string, + instance: string, + ) { return this.pathTemplates.instancePathTemplate.render({ project: project, location: location, @@ -9998,7 +12968,8 @@ export class WarehouseClient { * @returns {string} A string representing the application. */ matchApplicationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).application; + return this.pathTemplates.instancePathTemplate.match(instanceName) + .application; } /** @@ -10019,7 +12990,7 @@ export class WarehouseClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -10056,7 +13027,7 @@ export class WarehouseClient { * @param {string} operator * @returns {string} Resource name string. */ - operatorPath(project:string,location:string,operator:string) { + operatorPath(project: string, location: string, operator: string) { return this.pathTemplates.operatorPathTemplate.render({ project: project, location: location, @@ -10106,7 +13077,12 @@ export class WarehouseClient { * @param {string} process * @returns {string} Resource name string. */ - processPath(project:string,location:string,cluster:string,process:string) { + processPath( + project: string, + location: string, + cluster: string, + process: string, + ) { return this.pathTemplates.processPathTemplate.render({ project: project, location: location, @@ -10167,7 +13143,7 @@ export class WarehouseClient { * @param {string} processor * @returns {string} Resource name string. */ - processorPath(project:string,location:string,processor:string) { + processorPath(project: string, location: string, processor: string) { return this.pathTemplates.processorPathTemplate.render({ project: project, location: location, @@ -10183,7 +13159,8 @@ export class WarehouseClient { * @returns {string} A string representing the project. */ matchProjectFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).project; + return this.pathTemplates.processorPathTemplate.match(processorName) + .project; } /** @@ -10194,7 +13171,8 @@ export class WarehouseClient { * @returns {string} A string representing the location. */ matchLocationFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).location; + return this.pathTemplates.processorPathTemplate.match(processorName) + .location; } /** @@ -10205,7 +13183,8 @@ export class WarehouseClient { * @returns {string} A string representing the processor. */ matchProcessorFromProcessorName(processorName: string) { - return this.pathTemplates.processorPathTemplate.match(processorName).processor; + return this.pathTemplates.processorPathTemplate.match(processorName) + .processor; } /** @@ -10217,7 +13196,12 @@ export class WarehouseClient { * @param {string} search_config * @returns {string} Resource name string. */ - searchConfigPath(projectNumber:string,location:string,corpus:string,searchConfig:string) { + searchConfigPath( + projectNumber: string, + location: string, + corpus: string, + searchConfig: string, + ) { return this.pathTemplates.searchConfigPathTemplate.render({ project_number: projectNumber, location: location, @@ -10234,7 +13218,8 @@ export class WarehouseClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).project_number; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .project_number; } /** @@ -10245,7 +13230,8 @@ export class WarehouseClient { * @returns {string} A string representing the location. */ matchLocationFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).location; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .location; } /** @@ -10256,7 +13242,8 @@ export class WarehouseClient { * @returns {string} A string representing the corpus. */ matchCorpusFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).corpus; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .corpus; } /** @@ -10267,7 +13254,8 @@ export class WarehouseClient { * @returns {string} A string representing the search_config. */ matchSearchConfigFromSearchConfigName(searchConfigName: string) { - return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName).search_config; + return this.pathTemplates.searchConfigPathTemplate.match(searchConfigName) + .search_config; } /** @@ -10279,7 +13267,12 @@ export class WarehouseClient { * @param {string} search_hypernym * @returns {string} Resource name string. */ - searchHypernymPath(projectNumber:string,location:string,corpus:string,searchHypernym:string) { + searchHypernymPath( + projectNumber: string, + location: string, + corpus: string, + searchHypernym: string, + ) { return this.pathTemplates.searchHypernymPathTemplate.render({ project_number: projectNumber, location: location, @@ -10296,7 +13289,9 @@ export class WarehouseClient { * @returns {string} A string representing the project_number. */ matchProjectNumberFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).project_number; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).project_number; } /** @@ -10307,7 +13302,9 @@ export class WarehouseClient { * @returns {string} A string representing the location. */ matchLocationFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).location; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).location; } /** @@ -10318,7 +13315,9 @@ export class WarehouseClient { * @returns {string} A string representing the corpus. */ matchCorpusFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).corpus; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).corpus; } /** @@ -10329,7 +13328,9 @@ export class WarehouseClient { * @returns {string} A string representing the search_hypernym. */ matchSearchHypernymFromSearchHypernymName(searchHypernymName: string) { - return this.pathTemplates.searchHypernymPathTemplate.match(searchHypernymName).search_hypernym; + return this.pathTemplates.searchHypernymPathTemplate.match( + searchHypernymName, + ).search_hypernym; } /** @@ -10341,7 +13342,12 @@ export class WarehouseClient { * @param {string} series * @returns {string} Resource name string. */ - seriesPath(project:string,location:string,cluster:string,series:string) { + seriesPath( + project: string, + location: string, + cluster: string, + series: string, + ) { return this.pathTemplates.seriesPathTemplate.render({ project: project, location: location, @@ -10403,7 +13409,12 @@ export class WarehouseClient { * @param {string} stream * @returns {string} Resource name string. */ - streamPath(project:string,location:string,cluster:string,stream:string) { + streamPath( + project: string, + location: string, + cluster: string, + stream: string, + ) { return this.pathTemplates.streamPathTemplate.render({ project: project, location: location, @@ -10464,15 +13475,19 @@ export class WarehouseClient { */ close(): Promise { if (this.warehouseStub && !this._terminated) { - return this.warehouseStub.then(stub => { + return this.warehouseStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-visionai/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-visionai/system-test/fixtures/sample/src/index.ts index 22c658bdca1b..f9f592dbc3b1 100644 --- a/packages/google-cloud-visionai/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-visionai/system-test/fixtures/sample/src/index.ts @@ -16,7 +16,14 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {AppPlatformClient, HealthCheckServiceClient, LiveVideoAnalyticsClient, StreamingServiceClient, StreamsServiceClient, WarehouseClient} from '@google-cloud/visionai'; +import { + AppPlatformClient, + HealthCheckServiceClient, + LiveVideoAnalyticsClient, + StreamingServiceClient, + StreamsServiceClient, + WarehouseClient, +} from '@google-cloud/visionai'; // check that the client class type name can be used function doStuffWithAppPlatformClient(client: AppPlatformClient) { diff --git a/packages/google-cloud-visionai/system-test/install.ts b/packages/google-cloud-visionai/system-test/install.ts index 394f3362d203..ccf167042d2e 100644 --- a/packages/google-cloud-visionai/system-test/install.ts +++ b/packages/google-cloud-visionai/system-test/install.ts @@ -16,34 +16,36 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { + it('TypeScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts', + ).toString(), + }, }; await packNTest(options); }); - it('JavaScript code', async function() { + it('JavaScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } + cjs: readFileSync( + './system-test/fixtures/sample/src/index.js', + ).toString(), + }, }; await packNTest(options); }); - }); diff --git a/packages/google-cloud-visionai/test/gapic_app_platform_v1.ts b/packages/google-cloud-visionai/test/gapic_app_platform_v1.ts index ed171cc17e5f..cbe47bd318dc 100644 --- a/packages/google-cloud-visionai/test/gapic_app_platform_v1.ts +++ b/packages/google-cloud-visionai/test/gapic_app_platform_v1.ts @@ -19,6271 +19,8028 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as appplatformModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + IamProtos, + LocationProtos, +} from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); } -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.AppPlatformClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new appplatformModule.v1.AppPlatformClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new appplatformModule.v1.AppPlatformClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = appplatformModule.v1.AppPlatformClient.servicePath; - assert.strictEqual(servicePath, 'warehouse-visionai.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = appplatformModule.v1.AppPlatformClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new appplatformModule.v1.AppPlatformClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new appplatformModule.v1.AppPlatformClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new appplatformModule.v1.AppPlatformClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new appplatformModule.v1.AppPlatformClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new appplatformModule.v1.AppPlatformClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = appplatformModule.v1.AppPlatformClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new appplatformModule.v1.AppPlatformClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new appplatformModule.v1.AppPlatformClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.appPlatformStub, undefined); - await client.initialize(); - assert(client.appPlatformStub); - }); - - it('has close method for the initialized client', done => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.appPlatformStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.appPlatformStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new appplatformModule.v1.AppPlatformClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); }); - describe('getApplication', () => { - it('invokes getApplication without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Application() - ); - client.innerApiCalls.getApplication = stubSimpleCall(expectedResponse); - const [response] = await client.getApplication(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApplication without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Application() - ); - client.innerApiCalls.getApplication = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getApplication( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IApplication|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApplication with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getApplication = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getApplication(request), expectedError); - const actualRequest = (client.innerApiCalls.getApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getApplication with closed client', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getApplication(request), expectedError); - }); + it('has universeDomain', () => { + const client = new appplatformModule.v1.AppPlatformClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); }); - describe('getInstance', () => { - it('invokes getInstance without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); - const [response] = await client.getInstance(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInstance( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IInstance|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance with closed client', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getInstance(request), expectedError); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = appplatformModule.v1.AppPlatformClient.servicePath; + assert.strictEqual(servicePath, 'warehouse-visionai.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = appplatformModule.v1.AppPlatformClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new appplatformModule.v1.AppPlatformClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); }); - describe('getDraft', () => { - it('invokes getDraft without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetDraftRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetDraftRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Draft() - ); - client.innerApiCalls.getDraft = stubSimpleCall(expectedResponse); - const [response] = await client.getDraft(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDraft without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetDraftRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetDraftRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Draft() - ); - client.innerApiCalls.getDraft = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDraft( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IDraft|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDraft with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetDraftRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetDraftRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDraft = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDraft(request), expectedError); - const actualRequest = (client.innerApiCalls.getDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDraft with closed client', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetDraftRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetDraftRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDraft(request), expectedError); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new appplatformModule.v1.AppPlatformClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); }); - describe('listPrebuiltProcessors', () => { - it('invokes listPrebuiltProcessors without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListPrebuiltProcessorsResponse() - ); - client.innerApiCalls.listPrebuiltProcessors = stubSimpleCall(expectedResponse); - const [response] = await client.listPrebuiltProcessors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrebuiltProcessors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrebuiltProcessors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new appplatformModule.v1.AppPlatformClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new appplatformModule.v1.AppPlatformClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'warehouse-visionai.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new appplatformModule.v1.AppPlatformClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('invokes listPrebuiltProcessors without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListPrebuiltProcessorsResponse() - ); - client.innerApiCalls.listPrebuiltProcessors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPrebuiltProcessors( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrebuiltProcessors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrebuiltProcessors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has port', () => { + const port = appplatformModule.v1.AppPlatformClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('invokes listPrebuiltProcessors with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPrebuiltProcessors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPrebuiltProcessors(request), expectedError); - const actualRequest = (client.innerApiCalls.listPrebuiltProcessors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrebuiltProcessors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with no option', () => { + const client = new appplatformModule.v1.AppPlatformClient(); + assert(client); + }); - it('invokes listPrebuiltProcessors with closed client', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listPrebuiltProcessors(request), expectedError); - }); + it('should create a client with gRPC fallback', () => { + const client = new appplatformModule.v1.AppPlatformClient({ + fallback: true, + }); + assert(client); }); - describe('getProcessor', () => { - it('invokes getProcessor without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetProcessorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetProcessorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Processor() - ); - client.innerApiCalls.getProcessor = stubSimpleCall(expectedResponse); - const [response] = await client.getProcessor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.appPlatformStub, undefined); + await client.initialize(); + assert(client.appPlatformStub); + }); - it('invokes getProcessor without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetProcessorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetProcessorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Processor() - ); - client.innerApiCalls.getProcessor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProcessor( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IProcessor|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.appPlatformStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getProcessor with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetProcessorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetProcessorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProcessor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getProcessor(request), expectedError); - const actualRequest = (client.innerApiCalls.getProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.appPlatformStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getProcessor with closed client', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetProcessorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetProcessorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getProcessor(request), expectedError); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('createApplication', () => { - it('invokes createApplication without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateApplicationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createApplication = stubLongRunningCall(expectedResponse); - const [operation] = await client.createApplication(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getApplication', () => { + it('invokes getApplication without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Application(), + ); + client.innerApiCalls.getApplication = stubSimpleCall(expectedResponse); + const [response] = await client.getApplication(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createApplication without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateApplicationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createApplication = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createApplication( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getApplication without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Application(), + ); + client.innerApiCalls.getApplication = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getApplication( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IApplication | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createApplication with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateApplicationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createApplication = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createApplication(request), expectedError); - const actualRequest = (client.innerApiCalls.createApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getApplication with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getApplication = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getApplication(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createApplication with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateApplicationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createApplication = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createApplication(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getApplication with closed client', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getApplication(request), expectedError); + }); + }); + + describe('getInstance', () => { + it('invokes getInstance without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetInstanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetInstanceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Instance(), + ); + client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); + const [response] = await client.getInstance(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateApplicationProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateApplicationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes getInstance without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetInstanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetInstanceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Instance(), + ); + client.innerApiCalls.getInstance = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getInstance( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IInstance | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateApplicationProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateApplicationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes getInstance with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetInstanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetInstanceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getInstance = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getInstance(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getInstance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getInstance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateApplication', () => { - it('invokes updateApplication without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateApplicationRequest() - ); - request.application ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateApplicationRequest', ['application', 'name']); - request.application.name = defaultValue1; - const expectedHeaderRequestParams = `application.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateApplication = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateApplication(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getInstance with closed client', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetInstanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetInstanceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getInstance(request), expectedError); + }); + }); + + describe('getDraft', () => { + it('invokes getDraft without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetDraftRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetDraftRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Draft(), + ); + client.innerApiCalls.getDraft = stubSimpleCall(expectedResponse); + const [response] = await client.getDraft(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateApplication without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateApplicationRequest() - ); - request.application ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateApplicationRequest', ['application', 'name']); - request.application.name = defaultValue1; - const expectedHeaderRequestParams = `application.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateApplication = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateApplication( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDraft without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetDraftRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetDraftRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Draft(), + ); + client.innerApiCalls.getDraft = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDraft( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IDraft | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateApplication with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateApplicationRequest() - ); - request.application ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateApplicationRequest', ['application', 'name']); - request.application.name = defaultValue1; - const expectedHeaderRequestParams = `application.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateApplication = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateApplication(request), expectedError); - const actualRequest = (client.innerApiCalls.updateApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDraft with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetDraftRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetDraftRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDraft = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getDraft(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateApplication with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateApplicationRequest() - ); - request.application ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateApplicationRequest', ['application', 'name']); - request.application.name = defaultValue1; - const expectedHeaderRequestParams = `application.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateApplication = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateApplication(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDraft with closed client', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetDraftRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetDraftRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDraft(request), expectedError); + }); + }); + + describe('listPrebuiltProcessors', () => { + it('invokes listPrebuiltProcessors without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListPrebuiltProcessorsResponse(), + ); + client.innerApiCalls.listPrebuiltProcessors = + stubSimpleCall(expectedResponse); + const [response] = await client.listPrebuiltProcessors(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPrebuiltProcessors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPrebuiltProcessors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateApplicationProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateApplicationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes listPrebuiltProcessors without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListPrebuiltProcessorsResponse(), + ); + client.innerApiCalls.listPrebuiltProcessors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPrebuiltProcessors( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IListPrebuiltProcessorsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPrebuiltProcessors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPrebuiltProcessors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateApplicationProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateApplicationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listPrebuiltProcessors with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPrebuiltProcessors = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listPrebuiltProcessors(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listPrebuiltProcessors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPrebuiltProcessors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteApplication', () => { - it('invokes deleteApplication without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteApplication = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteApplication(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPrebuiltProcessors with closed client', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListPrebuiltProcessorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.listPrebuiltProcessors(request), + expectedError, + ); + }); + }); + + describe('getProcessor', () => { + it('invokes getProcessor without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetProcessorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetProcessorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Processor(), + ); + client.innerApiCalls.getProcessor = stubSimpleCall(expectedResponse); + const [response] = await client.getProcessor(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteApplication without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteApplication = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteApplication( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getProcessor without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetProcessorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetProcessorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Processor(), + ); + client.innerApiCalls.getProcessor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProcessor( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IProcessor | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteApplication with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApplication = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteApplication(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getProcessor with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetProcessorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetProcessorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getProcessor = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getProcessor(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteApplication with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApplication = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteApplication(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getProcessor with closed client', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetProcessorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetProcessorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getProcessor(request), expectedError); + }); + }); + + describe('createApplication', () => { + it('invokes createApplication without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateApplicationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createApplication = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createApplication(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteApplicationProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteApplicationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createApplication without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateApplicationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createApplication = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createApplication( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteApplicationProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteApplicationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createApplication with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateApplicationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createApplication = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createApplication(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deployApplication', () => { - it('invokes deployApplication without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeployApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeployApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deployApplication = stubLongRunningCall(expectedResponse); - const [operation] = await client.deployApplication(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deployApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deployApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createApplication with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateApplicationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createApplication = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createApplication(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deployApplication without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeployApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeployApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deployApplication = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deployApplication( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deployApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deployApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateApplicationProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateApplicationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deployApplication with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeployApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeployApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deployApplication = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deployApplication(request), expectedError); - const actualRequest = (client.innerApiCalls.deployApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deployApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateApplicationProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateApplicationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateApplication', () => { + it('invokes updateApplication without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateApplicationRequest(), + ); + request.application ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateApplicationRequest', + ['application', 'name'], + ); + request.application.name = defaultValue1; + const expectedHeaderRequestParams = `application.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateApplication = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateApplication(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deployApplication with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeployApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeployApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deployApplication = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deployApplication(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deployApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deployApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateApplication without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateApplicationRequest(), + ); + request.application ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateApplicationRequest', + ['application', 'name'], + ); + request.application.name = defaultValue1; + const expectedHeaderRequestParams = `application.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateApplication = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateApplication( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IApplication, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeployApplicationProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeployApplicationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateApplication with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateApplicationRequest(), + ); + request.application ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateApplicationRequest', + ['application', 'name'], + ); + request.application.name = defaultValue1; + const expectedHeaderRequestParams = `application.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApplication = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateApplication(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeployApplicationProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeployApplicationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateApplication with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateApplicationRequest(), + ); + request.application ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateApplicationRequest', + ['application', 'name'], + ); + request.application.name = defaultValue1; + const expectedHeaderRequestParams = `application.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApplication = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateApplication(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('undeployApplication', () => { - it('invokes undeployApplication without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UndeployApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UndeployApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.undeployApplication = stubLongRunningCall(expectedResponse); - const [operation] = await client.undeployApplication(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeployApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeployApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateApplicationProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateApplicationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes undeployApplication without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UndeployApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UndeployApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.undeployApplication = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.undeployApplication( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeployApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeployApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateApplicationProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateApplicationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteApplication', () => { + it('invokes deleteApplication without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteApplication = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteApplication(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes undeployApplication with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UndeployApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UndeployApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeployApplication = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.undeployApplication(request), expectedError); - const actualRequest = (client.innerApiCalls.undeployApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeployApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteApplication without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteApplication = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApplication( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes undeployApplication with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UndeployApplicationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UndeployApplicationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeployApplication = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.undeployApplication(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.undeployApplication as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeployApplication as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteApplication with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApplication = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteApplication(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUndeployApplicationProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUndeployApplicationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteApplication with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApplication = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteApplication(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUndeployApplicationProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUndeployApplicationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteApplicationProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteApplicationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('addApplicationStreamInput', () => { - it('invokes addApplicationStreamInput without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AddApplicationStreamInputRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AddApplicationStreamInputRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addApplicationStreamInput = stubLongRunningCall(expectedResponse); - const [operation] = await client.addApplicationStreamInput(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addApplicationStreamInput as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addApplicationStreamInput as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteApplicationProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteApplicationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deployApplication', () => { + it('invokes deployApplication without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeployApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeployApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deployApplication = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deployApplication(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deployApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addApplicationStreamInput without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AddApplicationStreamInputRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AddApplicationStreamInputRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addApplicationStreamInput = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addApplicationStreamInput( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addApplicationStreamInput as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addApplicationStreamInput as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deployApplication without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeployApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeployApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deployApplication = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deployApplication( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IDeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IDeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deployApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addApplicationStreamInput with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AddApplicationStreamInputRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AddApplicationStreamInputRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addApplicationStreamInput = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.addApplicationStreamInput(request), expectedError); - const actualRequest = (client.innerApiCalls.addApplicationStreamInput as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addApplicationStreamInput as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deployApplication with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeployApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeployApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deployApplication = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deployApplication(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deployApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addApplicationStreamInput with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AddApplicationStreamInputRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AddApplicationStreamInputRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addApplicationStreamInput = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.addApplicationStreamInput(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.addApplicationStreamInput as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addApplicationStreamInput as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deployApplication with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeployApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeployApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deployApplication = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deployApplication(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deployApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkAddApplicationStreamInputProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAddApplicationStreamInputProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeployApplicationProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeployApplicationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkAddApplicationStreamInputProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAddApplicationStreamInputProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeployApplicationProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeployApplicationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('undeployApplication', () => { + it('invokes undeployApplication without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UndeployApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UndeployApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.undeployApplication = + stubLongRunningCall(expectedResponse); + const [operation] = await client.undeployApplication(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.undeployApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('removeApplicationStreamInput', () => { - it('invokes removeApplicationStreamInput without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeApplicationStreamInput = stubLongRunningCall(expectedResponse); - const [operation] = await client.removeApplicationStreamInput(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeApplicationStreamInput as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeApplicationStreamInput as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes undeployApplication without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UndeployApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UndeployApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.undeployApplication = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.undeployApplication( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IUndeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IUndeployApplicationResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.undeployApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes removeApplicationStreamInput without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeApplicationStreamInput = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeApplicationStreamInput( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeApplicationStreamInput as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeApplicationStreamInput as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes undeployApplication with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UndeployApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UndeployApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.undeployApplication = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.undeployApplication(request), expectedError); + const actualRequest = ( + client.innerApiCalls.undeployApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes removeApplicationStreamInput with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeApplicationStreamInput = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.removeApplicationStreamInput(request), expectedError); - const actualRequest = (client.innerApiCalls.removeApplicationStreamInput as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeApplicationStreamInput as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes undeployApplication with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UndeployApplicationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UndeployApplicationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.undeployApplication = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.undeployApplication(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.undeployApplication as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployApplication as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes removeApplicationStreamInput with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeApplicationStreamInput = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.removeApplicationStreamInput(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.removeApplicationStreamInput as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeApplicationStreamInput as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUndeployApplicationProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUndeployApplicationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkRemoveApplicationStreamInputProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRemoveApplicationStreamInputProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUndeployApplicationProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUndeployApplicationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('addApplicationStreamInput', () => { + it('invokes addApplicationStreamInput without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AddApplicationStreamInputRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AddApplicationStreamInputRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.addApplicationStreamInput = + stubLongRunningCall(expectedResponse); + const [operation] = await client.addApplicationStreamInput(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addApplicationStreamInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addApplicationStreamInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkRemoveApplicationStreamInputProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRemoveApplicationStreamInputProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes addApplicationStreamInput without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AddApplicationStreamInputRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AddApplicationStreamInputRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.addApplicationStreamInput = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addApplicationStreamInput( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IAddApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IAddApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addApplicationStreamInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addApplicationStreamInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateApplicationStreamInput', () => { - it('invokes updateApplicationStreamInput without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateApplicationStreamInput = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateApplicationStreamInput(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApplicationStreamInput as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApplicationStreamInput as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addApplicationStreamInput with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AddApplicationStreamInputRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AddApplicationStreamInputRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addApplicationStreamInput = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.addApplicationStreamInput(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.addApplicationStreamInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addApplicationStreamInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateApplicationStreamInput without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateApplicationStreamInput = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateApplicationStreamInput( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApplicationStreamInput as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApplicationStreamInput as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addApplicationStreamInput with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AddApplicationStreamInputRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AddApplicationStreamInputRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addApplicationStreamInput = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.addApplicationStreamInput(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.addApplicationStreamInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addApplicationStreamInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateApplicationStreamInput with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateApplicationStreamInput = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateApplicationStreamInput(request), expectedError); - const actualRequest = (client.innerApiCalls.updateApplicationStreamInput as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApplicationStreamInput as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkAddApplicationStreamInputProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkAddApplicationStreamInputProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateApplicationStreamInput with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateApplicationStreamInput = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateApplicationStreamInput(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateApplicationStreamInput as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApplicationStreamInput as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkAddApplicationStreamInputProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkAddApplicationStreamInputProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('removeApplicationStreamInput', () => { + it('invokes removeApplicationStreamInput without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.removeApplicationStreamInput = + stubLongRunningCall(expectedResponse); + const [operation] = await client.removeApplicationStreamInput(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.removeApplicationStreamInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeApplicationStreamInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateApplicationStreamInputProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateApplicationStreamInputProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes removeApplicationStreamInput without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.removeApplicationStreamInput = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeApplicationStreamInput( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IRemoveApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.removeApplicationStreamInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeApplicationStreamInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateApplicationStreamInputProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateApplicationStreamInputProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes removeApplicationStreamInput with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeApplicationStreamInput = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.removeApplicationStreamInput(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.removeApplicationStreamInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeApplicationStreamInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createApplicationInstances', () => { - it('invokes createApplicationInstances without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateApplicationInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateApplicationInstancesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createApplicationInstances = stubLongRunningCall(expectedResponse); - const [operation] = await client.createApplicationInstances(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApplicationInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApplicationInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes removeApplicationStreamInput with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RemoveApplicationStreamInputRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeApplicationStreamInput = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.removeApplicationStreamInput(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.removeApplicationStreamInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeApplicationStreamInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createApplicationInstances without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateApplicationInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateApplicationInstancesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createApplicationInstances = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createApplicationInstances( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createApplicationInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApplicationInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkRemoveApplicationStreamInputProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkRemoveApplicationStreamInputProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createApplicationInstances with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateApplicationInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateApplicationInstancesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createApplicationInstances = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createApplicationInstances(request), expectedError); - const actualRequest = (client.innerApiCalls.createApplicationInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApplicationInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkRemoveApplicationStreamInputProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkRemoveApplicationStreamInputProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateApplicationStreamInput', () => { + it('invokes updateApplicationStreamInput without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateApplicationStreamInput = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateApplicationStreamInput(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateApplicationStreamInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApplicationStreamInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createApplicationInstances with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateApplicationInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateApplicationInstancesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createApplicationInstances = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createApplicationInstances(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createApplicationInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createApplicationInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateApplicationStreamInput without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateApplicationStreamInput = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateApplicationStreamInput( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationStreamInputResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateApplicationStreamInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApplicationStreamInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateApplicationInstancesProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateApplicationInstancesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateApplicationStreamInput with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApplicationStreamInput = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateApplicationStreamInput(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateApplicationStreamInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApplicationStreamInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateApplicationInstancesProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateApplicationInstancesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateApplicationStreamInput with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateApplicationStreamInputRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApplicationStreamInput = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateApplicationStreamInput(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateApplicationStreamInput as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApplicationStreamInput as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteApplicationInstances', () => { - it('invokes deleteApplicationInstances without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteApplicationInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteApplicationInstancesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteApplicationInstances = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteApplicationInstances(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApplicationInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApplicationInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateApplicationStreamInputProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkUpdateApplicationStreamInputProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteApplicationInstances without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteApplicationInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteApplicationInstancesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteApplicationInstances = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteApplicationInstances( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteApplicationInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApplicationInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateApplicationStreamInputProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateApplicationStreamInputProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createApplicationInstances', () => { + it('invokes createApplicationInstances without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateApplicationInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateApplicationInstancesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createApplicationInstances = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createApplicationInstances(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createApplicationInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApplicationInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteApplicationInstances with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteApplicationInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteApplicationInstancesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApplicationInstances = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteApplicationInstances(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteApplicationInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApplicationInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createApplicationInstances without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateApplicationInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateApplicationInstancesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createApplicationInstances = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createApplicationInstances( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.ICreateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.ICreateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createApplicationInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApplicationInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteApplicationInstances with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteApplicationInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteApplicationInstancesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteApplicationInstances = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteApplicationInstances(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteApplicationInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteApplicationInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createApplicationInstances with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateApplicationInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateApplicationInstancesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createApplicationInstances = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createApplicationInstances(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createApplicationInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApplicationInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteApplicationInstancesProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteApplicationInstancesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createApplicationInstances with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateApplicationInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateApplicationInstancesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createApplicationInstances = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createApplicationInstances(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createApplicationInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createApplicationInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteApplicationInstancesProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteApplicationInstancesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateApplicationInstancesProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkCreateApplicationInstancesProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateApplicationInstances', () => { - it('invokes updateApplicationInstances without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateApplicationInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateApplicationInstancesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateApplicationInstances = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateApplicationInstances(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApplicationInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApplicationInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateApplicationInstancesProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateApplicationInstancesProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteApplicationInstances', () => { + it('invokes deleteApplicationInstances without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteApplicationInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteApplicationInstancesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteApplicationInstances = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteApplicationInstances(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteApplicationInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApplicationInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateApplicationInstances without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateApplicationInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateApplicationInstancesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateApplicationInstances = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateApplicationInstances( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateApplicationInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApplicationInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteApplicationInstances without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteApplicationInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteApplicationInstancesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteApplicationInstances = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteApplicationInstances( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IInstance, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteApplicationInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApplicationInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateApplicationInstances with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateApplicationInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateApplicationInstancesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateApplicationInstances = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateApplicationInstances(request), expectedError); - const actualRequest = (client.innerApiCalls.updateApplicationInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApplicationInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteApplicationInstances with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteApplicationInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteApplicationInstancesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApplicationInstances = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteApplicationInstances(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteApplicationInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApplicationInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateApplicationInstances with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateApplicationInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateApplicationInstancesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateApplicationInstances = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateApplicationInstances(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateApplicationInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateApplicationInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteApplicationInstances with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteApplicationInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteApplicationInstancesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteApplicationInstances = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteApplicationInstances(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteApplicationInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteApplicationInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateApplicationInstancesProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateApplicationInstancesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteApplicationInstancesProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkDeleteApplicationInstancesProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateApplicationInstancesProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateApplicationInstancesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteApplicationInstancesProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteApplicationInstancesProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateApplicationInstances', () => { + it('invokes updateApplicationInstances without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateApplicationInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateApplicationInstancesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateApplicationInstances = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateApplicationInstances(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateApplicationInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApplicationInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createDraft', () => { - it('invokes createDraft without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateDraftRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateDraftRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createDraft = stubLongRunningCall(expectedResponse); - const [operation] = await client.createDraft(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateApplicationInstances without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateApplicationInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateApplicationInstancesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateApplicationInstances = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateApplicationInstances( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IUpdateApplicationInstancesResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateApplicationInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApplicationInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDraft without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateDraftRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateDraftRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createDraft = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDraft( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateApplicationInstances with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateApplicationInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateApplicationInstancesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApplicationInstances = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateApplicationInstances(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateApplicationInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApplicationInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDraft with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateDraftRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateDraftRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDraft = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createDraft(request), expectedError); - const actualRequest = (client.innerApiCalls.createDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateApplicationInstances with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateApplicationInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateApplicationInstancesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateApplicationInstances = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateApplicationInstances(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateApplicationInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateApplicationInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDraft with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateDraftRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateDraftRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDraft = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createDraft(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateApplicationInstancesProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkUpdateApplicationInstancesProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateDraftProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateDraftProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateApplicationInstancesProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateApplicationInstancesProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createDraft', () => { + it('invokes createDraft without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateDraftRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateDraftRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createDraft = stubLongRunningCall(expectedResponse); + const [operation] = await client.createDraft(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateDraftProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateDraftProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createDraft without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateDraftRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateDraftRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createDraft = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDraft( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateDraft', () => { - it('invokes updateDraft without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateDraftRequest() - ); - request.draft ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateDraftRequest', ['draft', 'name']); - request.draft.name = defaultValue1; - const expectedHeaderRequestParams = `draft.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateDraft = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateDraft(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createDraft with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateDraftRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateDraftRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDraft = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createDraft(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDraft without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateDraftRequest() - ); - request.draft ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateDraftRequest', ['draft', 'name']); - request.draft.name = defaultValue1; - const expectedHeaderRequestParams = `draft.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateDraft = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDraft( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createDraft with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateDraftRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateDraftRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDraft = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createDraft(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDraft with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateDraftRequest() - ); - request.draft ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateDraftRequest', ['draft', 'name']); - request.draft.name = defaultValue1; - const expectedHeaderRequestParams = `draft.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDraft = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateDraft(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateDraftProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateDraftProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateDraft with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateDraftRequest() - ); - request.draft ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateDraftRequest', ['draft', 'name']); - request.draft.name = defaultValue1; - const expectedHeaderRequestParams = `draft.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDraft = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateDraft(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateDraftProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkCreateDraftProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateDraft', () => { + it('invokes updateDraft without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateDraftRequest(), + ); + request.draft ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateDraftRequest', + ['draft', 'name'], + ); + request.draft.name = defaultValue1; + const expectedHeaderRequestParams = `draft.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateDraft = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDraft(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateDraftProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateDraftProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateDraft without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateDraftRequest(), + ); + request.draft ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateDraftRequest', + ['draft', 'name'], + ); + request.draft.name = defaultValue1; + const expectedHeaderRequestParams = `draft.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateDraft = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDraft( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IDraft, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateDraftProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateDraftProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateDraft with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateDraftRequest(), + ); + request.draft ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateDraftRequest', + ['draft', 'name'], + ); + request.draft.name = defaultValue1; + const expectedHeaderRequestParams = `draft.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDraft = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateDraft(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteDraft', () => { - it('invokes deleteDraft without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteDraftRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteDraftRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteDraft = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteDraft(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateDraft with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateDraftRequest(), + ); + request.draft ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateDraftRequest', + ['draft', 'name'], + ); + request.draft.name = defaultValue1; + const expectedHeaderRequestParams = `draft.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDraft = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateDraft(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteDraft without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteDraftRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteDraftRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteDraft = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDraft( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateDraftProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateDraftProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteDraft with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteDraftRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteDraftRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDraft = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteDraft(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateDraftProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkUpdateDraftProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteDraft', () => { + it('invokes deleteDraft without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteDraftRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteDraftRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteDraft = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteDraft(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteDraft with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteDraftRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteDraftRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDraft = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteDraft(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteDraft as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDraft as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteDraft without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteDraftRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteDraftRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteDraft = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDraft( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteDraftProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteDraftProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteDraft with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteDraftRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteDraftRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDraft = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteDraft(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteDraftProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteDraftProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteDraft with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteDraftRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteDraftRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDraft = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteDraft(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteDraft as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDraft as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createProcessor', () => { - it('invokes createProcessor without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateProcessorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateProcessorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createProcessor = stubLongRunningCall(expectedResponse); - const [operation] = await client.createProcessor(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteDraftProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteDraftProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createProcessor without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateProcessorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateProcessorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createProcessor = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createProcessor( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteDraftProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkDeleteDraftProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createProcessor', () => { + it('invokes createProcessor without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateProcessorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateProcessorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createProcessor = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createProcessor(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createProcessor with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateProcessorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateProcessorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createProcessor = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createProcessor(request), expectedError); - const actualRequest = (client.innerApiCalls.createProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createProcessor without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateProcessorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateProcessorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createProcessor = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createProcessor( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createProcessor with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateProcessorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateProcessorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createProcessor = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createProcessor(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createProcessor with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateProcessorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateProcessorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createProcessor = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createProcessor(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateProcessorProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateProcessorProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createProcessor with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateProcessorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateProcessorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createProcessor = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createProcessor(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateProcessorProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateProcessorProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateProcessorProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateProcessorProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateProcessor', () => { - it('invokes updateProcessor without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateProcessorRequest() - ); - request.processor ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateProcessorRequest', ['processor', 'name']); - request.processor.name = defaultValue1; - const expectedHeaderRequestParams = `processor.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateProcessor = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateProcessor(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateProcessorProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateProcessorProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateProcessor', () => { + it('invokes updateProcessor without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateProcessorRequest(), + ); + request.processor ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateProcessorRequest', + ['processor', 'name'], + ); + request.processor.name = defaultValue1; + const expectedHeaderRequestParams = `processor.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateProcessor = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateProcessor(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateProcessor without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateProcessorRequest() - ); - request.processor ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateProcessorRequest', ['processor', 'name']); - request.processor.name = defaultValue1; - const expectedHeaderRequestParams = `processor.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateProcessor = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateProcessor( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateProcessor without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateProcessorRequest(), + ); + request.processor ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateProcessorRequest', + ['processor', 'name'], + ); + request.processor.name = defaultValue1; + const expectedHeaderRequestParams = `processor.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateProcessor = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateProcessor( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IProcessor, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateProcessor with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateProcessorRequest() - ); - request.processor ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateProcessorRequest', ['processor', 'name']); - request.processor.name = defaultValue1; - const expectedHeaderRequestParams = `processor.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProcessor = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateProcessor(request), expectedError); - const actualRequest = (client.innerApiCalls.updateProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateProcessor with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateProcessorRequest(), + ); + request.processor ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateProcessorRequest', + ['processor', 'name'], + ); + request.processor.name = defaultValue1; + const expectedHeaderRequestParams = `processor.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProcessor = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateProcessor(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateProcessor with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateProcessorRequest() - ); - request.processor ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateProcessorRequest', ['processor', 'name']); - request.processor.name = defaultValue1; - const expectedHeaderRequestParams = `processor.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProcessor = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateProcessor(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateProcessor with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateProcessorRequest(), + ); + request.processor ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateProcessorRequest', + ['processor', 'name'], + ); + request.processor.name = defaultValue1; + const expectedHeaderRequestParams = `processor.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProcessor = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateProcessor(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateProcessorProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateProcessorProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateProcessorProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateProcessorProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateProcessorProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateProcessorProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateProcessorProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateProcessorProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteProcessor', () => { + it('invokes deleteProcessor without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteProcessorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteProcessorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteProcessor = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteProcessor(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteProcessor', () => { - it('invokes deleteProcessor without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteProcessorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteProcessorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteProcessor = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteProcessor(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteProcessor without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteProcessorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteProcessorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteProcessor = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteProcessor( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteProcessor without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteProcessorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteProcessorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteProcessor = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteProcessor( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteProcessor with call error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteProcessorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteProcessorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProcessor = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteProcessor(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteProcessor with call error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteProcessorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteProcessorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteProcessor = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteProcessor(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteProcessor with LRO error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteProcessorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteProcessorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProcessor = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteProcessor(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcessor as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteProcessor with LRO error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteProcessorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteProcessorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteProcessor = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteProcessor(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteProcessor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteProcessorProgress without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteProcessorProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteProcessorProgress without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteProcessorProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteProcessorProgress with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteProcessorProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listApplications', () => { + it('invokes listApplications without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListApplicationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListApplicationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.Application(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.Application(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.Application(), + ), + ]; + client.innerApiCalls.listApplications = stubSimpleCall(expectedResponse); + const [response] = await client.listApplications(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listApplications as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApplications as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteProcessorProgress with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteProcessorProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listApplications without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListApplicationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListApplicationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.Application(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.Application(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.Application(), + ), + ]; + client.innerApiCalls.listApplications = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listApplications( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IApplication[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listApplications as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApplications as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listApplications', () => { - it('invokes listApplications without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListApplicationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListApplicationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Application()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Application()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Application()), - ]; - client.innerApiCalls.listApplications = stubSimpleCall(expectedResponse); - const [response] = await client.listApplications(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApplications as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApplications as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listApplications with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListApplicationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListApplicationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listApplications = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listApplications(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listApplications as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listApplications as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listApplications without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListApplicationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListApplicationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Application()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Application()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Application()), - ]; - client.innerApiCalls.listApplications = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listApplications( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IApplication[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listApplications as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApplications as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listApplicationsStream without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListApplicationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListApplicationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.Application(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.Application(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.Application(), + ), + ]; + client.descriptors.page.listApplications.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listApplicationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Application[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Application) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listApplications.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listApplications, request), + ); + assert( + (client.descriptors.page.listApplications.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listApplications with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListApplicationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListApplicationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listApplications = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listApplications(request), expectedError); - const actualRequest = (client.innerApiCalls.listApplications as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listApplications as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listApplicationsStream with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListApplicationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListApplicationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApplications.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listApplicationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Application[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Application) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listApplications.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listApplications, request), + ); + assert( + (client.descriptors.page.listApplications.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listApplicationsStream without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListApplicationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListApplicationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Application()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Application()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Application()), - ]; - client.descriptors.page.listApplications.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listApplicationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Application[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Application) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listApplications.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApplications, request)); - assert( - (client.descriptors.page.listApplications.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listApplications without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListApplicationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListApplicationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.Application(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.Application(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.Application(), + ), + ]; + client.descriptors.page.listApplications.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IApplication[] = []; + const iterable = client.listApplicationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listApplications.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listApplications.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listApplicationsStream with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListApplicationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListApplicationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listApplications.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listApplicationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Application[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Application) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listApplications.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listApplications, request)); - assert( - (client.descriptors.page.listApplications.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listApplications with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListApplicationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListApplicationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listApplications.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listApplicationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IApplication[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listApplications.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listApplications.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listInstances', () => { + it('invokes listInstances without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListInstancesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), + ]; + client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); + const [response] = await client.listInstances(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listApplications without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListApplicationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListApplicationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Application()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Application()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Application()), - ]; - client.descriptors.page.listApplications.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IApplication[] = []; - const iterable = client.listApplicationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listInstances without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListInstancesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), + ]; + client.innerApiCalls.listInstances = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listInstances( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IInstance[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listApplications.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApplications.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listApplications with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListApplicationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListApplicationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listApplications.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listApplicationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IApplication[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listApplications.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listApplications.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listInstances', () => { - it('invokes listInstances without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), - ]; - client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); - const [response] = await client.listInstances(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInstances with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListInstancesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listInstances = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listInstances(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listInstances as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listInstances as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listInstances without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), - ]; - client.innerApiCalls.listInstances = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInstances( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IInstance[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInstancesStream without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListInstancesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), + ]; + client.descriptors.page.listInstances.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listInstancesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Instance[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Instance) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listInstances, request), + ); + assert( + (client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listInstances with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInstances = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInstances(request), expectedError); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listInstancesStream with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListInstancesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInstances.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listInstancesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Instance[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Instance) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listInstances, request), + ); + assert( + (client.descriptors.page.listInstances.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listInstancesStream without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), - ]; - client.descriptors.page.listInstances.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInstancesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Instance[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Instance) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); - assert( - (client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInstances without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListInstancesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), + ]; + client.descriptors.page.listInstances.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IInstance[] = []; + const iterable = client.listInstancesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listInstances.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listInstancesStream with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInstances.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInstancesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Instance[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Instance) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); - assert( - (client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listInstances with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListInstancesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListInstancesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listInstances.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listInstancesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IInstance[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listInstances.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listInstances.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listDrafts', () => { + it('invokes listDrafts without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListDraftsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListDraftsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), + ]; + client.innerApiCalls.listDrafts = stubSimpleCall(expectedResponse); + const [response] = await client.listDrafts(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDrafts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDrafts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listInstances without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Instance()), - ]; - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IInstance[] = []; - const iterable = client.listInstancesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listDrafts without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListDraftsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListDraftsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), + ]; + client.innerApiCalls.listDrafts = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDrafts( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IDraft[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInstances with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInstancesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IInstance[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDrafts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDrafts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listDrafts', () => { - it('invokes listDrafts without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListDraftsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListDraftsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), - ]; - client.innerApiCalls.listDrafts = stubSimpleCall(expectedResponse); - const [response] = await client.listDrafts(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDrafts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDrafts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listDrafts with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListDraftsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListDraftsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDrafts = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listDrafts(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listDrafts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDrafts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listDrafts without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListDraftsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListDraftsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), - ]; - client.innerApiCalls.listDrafts = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDrafts( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IDraft[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDrafts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDrafts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listDraftsStream without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListDraftsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListDraftsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), + ]; + client.descriptors.page.listDrafts.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listDraftsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Draft[] = []; + stream.on('data', (response: protos.google.cloud.visionai.v1.Draft) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listDrafts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDrafts, request), + ); + assert( + (client.descriptors.page.listDrafts.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listDrafts with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListDraftsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListDraftsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDrafts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDrafts(request), expectedError); - const actualRequest = (client.innerApiCalls.listDrafts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDrafts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listDraftsStream with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListDraftsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListDraftsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDrafts.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listDraftsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Draft[] = []; + stream.on('data', (response: protos.google.cloud.visionai.v1.Draft) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listDrafts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDrafts, request), + ); + assert( + (client.descriptors.page.listDrafts.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listDraftsStream without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListDraftsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListDraftsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), - ]; - client.descriptors.page.listDrafts.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDraftsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Draft[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Draft) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listDrafts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDrafts, request)); - assert( - (client.descriptors.page.listDrafts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listDrafts without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListDraftsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListDraftsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), + ]; + client.descriptors.page.listDrafts.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IDraft[] = []; + const iterable = client.listDraftsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listDrafts.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listDrafts.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listDraftsStream with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListDraftsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListDraftsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDrafts.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDraftsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Draft[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Draft) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDrafts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDrafts, request)); - assert( - (client.descriptors.page.listDrafts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listDrafts with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListDraftsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListDraftsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDrafts.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listDraftsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IDraft[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listDrafts.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listDrafts.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listProcessors', () => { + it('invokes listProcessors without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListProcessorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListProcessorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), + ]; + client.innerApiCalls.listProcessors = stubSimpleCall(expectedResponse); + const [response] = await client.listProcessors(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listDrafts without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListDraftsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListDraftsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Draft()), - ]; - client.descriptors.page.listDrafts.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IDraft[] = []; - const iterable = client.listDraftsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listProcessors without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListProcessorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListProcessorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), + ]; + client.innerApiCalls.listProcessors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProcessors( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IProcessor[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDrafts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDrafts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDrafts with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListDraftsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListDraftsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDrafts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDraftsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IDraft[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDrafts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDrafts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listProcessors', () => { - it('invokes listProcessors without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListProcessorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListProcessorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), - ]; - client.innerApiCalls.listProcessors = stubSimpleCall(expectedResponse); - const [response] = await client.listProcessors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listProcessors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listProcessors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProcessors without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListProcessorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListProcessorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), - ]; - client.innerApiCalls.listProcessors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listProcessors( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IProcessor[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listProcessors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listProcessors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProcessors with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListProcessorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListProcessorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listProcessors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listProcessors(request), expectedError); - const actualRequest = (client.innerApiCalls.listProcessors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listProcessors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listProcessors with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListProcessorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListProcessorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listProcessors = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listProcessors(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listProcessorsStream without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListProcessorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListProcessorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), - ]; - client.descriptors.page.listProcessors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listProcessorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Processor[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Processor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listProcessors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listProcessors, request)); - assert( - (client.descriptors.page.listProcessors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listProcessorsStream without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListProcessorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListProcessorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), + ]; + client.descriptors.page.listProcessors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProcessorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Processor[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Processor) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessors, request), + ); + assert( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listProcessorsStream with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListProcessorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListProcessorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listProcessors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listProcessorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Processor[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Processor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listProcessors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listProcessors, request)); - assert( - (client.descriptors.page.listProcessors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listProcessorsStream with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListProcessorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListProcessorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listProcessorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Processor[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Processor) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessors, request), + ); + assert( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listProcessors without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListProcessorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListProcessorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), - ]; - client.descriptors.page.listProcessors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IProcessor[] = []; - const iterable = client.listProcessorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listProcessors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listProcessors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listProcessors without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListProcessorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListProcessorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Processor()), + ]; + client.descriptors.page.listProcessors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IProcessor[] = []; + const iterable = client.listProcessorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listProcessors.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listProcessors with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListProcessorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListProcessorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listProcessors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProcessorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IProcessor[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listProcessors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listProcessors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listProcessors with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListProcessorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListProcessorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProcessorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IProcessor[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listProcessors.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.getIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .getIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getIamPolicy(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.setIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .setIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('invokes setIamPolicy with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.setIamPolicy(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse(), + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions( + request, + expectedOptions, + ); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse(), + ); + client.iamClient.testIamPermissions = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .testIamPermissions( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.TestIamPermissionsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes testIamPermissions with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.testIamPermissions(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.IOperation[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.IOperation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + }); + + describe('Path templates', () => { + describe('analysis', async () => { + const fakePath = '/rendered/path/analysis'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + analysis: 'analysisValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.analysisPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.analysisPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('analysisPath', () => { + const result = client.analysisPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'analysisValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.analysisPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAnalysisName', () => { + const result = client.matchProjectFromAnalysisName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAnalysisName', () => { + const result = client.matchLocationFromAnalysisName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromAnalysisName', () => { + const result = client.matchClusterFromAnalysisName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAnalysisFromAnalysisName', () => { + const result = client.matchAnalysisFromAnalysisName(fakePath); + assert.strictEqual(result, 'analysisValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('analysis', async () => { - const fakePath = "/rendered/path/analysis"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - analysis: "analysisValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.analysisPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.analysisPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('analysisPath', () => { - const result = client.analysisPath("projectValue", "locationValue", "clusterValue", "analysisValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.analysisPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAnalysisName', () => { - const result = client.matchProjectFromAnalysisName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAnalysisName', () => { - const result = client.matchLocationFromAnalysisName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromAnalysisName', () => { - const result = client.matchClusterFromAnalysisName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnalysisFromAnalysisName', () => { - const result = client.matchAnalysisFromAnalysisName(fakePath); - assert.strictEqual(result, "analysisValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('annotation', async () => { - const fakePath = "/rendered/path/annotation"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - asset: "assetValue", - annotation: "annotationValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.annotationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.annotationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('annotationPath', () => { - const result = client.annotationPath("projectNumberValue", "locationValue", "corpusValue", "assetValue", "annotationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.annotationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromAnnotationName', () => { - const result = client.matchProjectNumberFromAnnotationName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAnnotationName', () => { - const result = client.matchLocationFromAnnotationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromAnnotationName', () => { - const result = client.matchCorpusFromAnnotationName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAnnotationName', () => { - const result = client.matchAssetFromAnnotationName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnnotationFromAnnotationName', () => { - const result = client.matchAnnotationFromAnnotationName(fakePath); - assert.strictEqual(result, "annotationValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('annotation', async () => { + const fakePath = '/rendered/path/annotation'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + asset: 'assetValue', + annotation: 'annotationValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.annotationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.annotationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('annotationPath', () => { + const result = client.annotationPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'assetValue', + 'annotationValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.annotationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromAnnotationName', () => { + const result = client.matchProjectNumberFromAnnotationName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAnnotationName', () => { + const result = client.matchLocationFromAnnotationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromAnnotationName', () => { + const result = client.matchCorpusFromAnnotationName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAssetFromAnnotationName', () => { + const result = client.matchAssetFromAnnotationName(fakePath); + assert.strictEqual(result, 'assetValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAnnotationFromAnnotationName', () => { + const result = client.matchAnnotationFromAnnotationName(fakePath); + assert.strictEqual(result, 'annotationValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('application', async () => { - const fakePath = "/rendered/path/application"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.applicationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.applicationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('applicationPath', () => { - const result = client.applicationPath("projectValue", "locationValue", "applicationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.applicationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApplicationName', () => { - const result = client.matchProjectFromApplicationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApplicationName', () => { - const result = client.matchLocationFromApplicationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromApplicationName', () => { - const result = client.matchApplicationFromApplicationName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('application', async () => { + const fakePath = '/rendered/path/application'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.applicationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.applicationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('applicationPath', () => { + const result = client.applicationPath( + 'projectValue', + 'locationValue', + 'applicationValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.applicationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromApplicationName', () => { + const result = client.matchProjectFromApplicationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromApplicationName', () => { + const result = client.matchLocationFromApplicationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromApplicationName', () => { + const result = client.matchApplicationFromApplicationName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('asset', async () => { - const fakePath = "/rendered/path/asset"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - asset: "assetValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.assetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.assetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('assetPath', () => { - const result = client.assetPath("projectNumberValue", "locationValue", "corpusValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.assetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromAssetName', () => { - const result = client.matchProjectNumberFromAssetName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAssetName', () => { - const result = client.matchLocationFromAssetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromAssetName', () => { - const result = client.matchCorpusFromAssetName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAssetName', () => { - const result = client.matchAssetFromAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('asset', async () => { + const fakePath = '/rendered/path/asset'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + asset: 'assetValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.assetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.assetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('assetPath', () => { + const result = client.assetPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'assetValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.assetPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromAssetName', () => { + const result = client.matchProjectNumberFromAssetName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAssetName', () => { + const result = client.matchLocationFromAssetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromAssetName', () => { + const result = client.matchCorpusFromAssetName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAssetFromAssetName', () => { + const result = client.matchAssetFromAssetName(fakePath); + assert.strictEqual(result, 'assetValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('channel', async () => { - const fakePath = "/rendered/path/channel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - channel: "channelValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.channelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.channelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('channelPath', () => { - const result = client.channelPath("projectValue", "locationValue", "clusterValue", "channelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.channelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromChannelName', () => { - const result = client.matchProjectFromChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromChannelName', () => { - const result = client.matchLocationFromChannelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromChannelName', () => { - const result = client.matchClusterFromChannelName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelFromChannelName', () => { - const result = client.matchChannelFromChannelName(fakePath); - assert.strictEqual(result, "channelValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('channel', async () => { + const fakePath = '/rendered/path/channel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + channel: 'channelValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.channelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.channelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('channelPath', () => { + const result = client.channelPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'channelValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.channelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromChannelName', () => { + const result = client.matchProjectFromChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromChannelName', () => { + const result = client.matchLocationFromChannelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromChannelName', () => { + const result = client.matchClusterFromChannelName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, 'channelValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('cluster', async () => { - const fakePath = "/rendered/path/cluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clusterPath', () => { - const result = client.clusterPath("projectValue", "locationValue", "clusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClusterName', () => { - const result = client.matchProjectFromClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClusterName', () => { - const result = client.matchLocationFromClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromClusterName', () => { - const result = client.matchClusterFromClusterName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('cluster', async () => { + const fakePath = '/rendered/path/cluster'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clusterPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clusterPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clusterPath', () => { + const result = client.clusterPath( + 'projectValue', + 'locationValue', + 'clusterValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clusterPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClusterName', () => { + const result = client.matchProjectFromClusterName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClusterName', () => { + const result = client.matchLocationFromClusterName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromClusterName', () => { + const result = client.matchClusterFromClusterName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('collection', async () => { - const fakePath = "/rendered/path/collection"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - collection: "collectionValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.collectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.collectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('collectionPath', () => { - const result = client.collectionPath("projectNumberValue", "locationValue", "corpusValue", "collectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.collectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromCollectionName', () => { - const result = client.matchProjectNumberFromCollectionName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCollectionName', () => { - const result = client.matchLocationFromCollectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromCollectionName', () => { - const result = client.matchCorpusFromCollectionName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCollectionFromCollectionName', () => { - const result = client.matchCollectionFromCollectionName(fakePath); - assert.strictEqual(result, "collectionValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('collection', async () => { + const fakePath = '/rendered/path/collection'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + collection: 'collectionValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.collectionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.collectionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('collectionPath', () => { + const result = client.collectionPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'collectionValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.collectionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromCollectionName', () => { + const result = client.matchProjectNumberFromCollectionName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCollectionName', () => { + const result = client.matchLocationFromCollectionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromCollectionName', () => { + const result = client.matchCorpusFromCollectionName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCollectionFromCollectionName', () => { + const result = client.matchCollectionFromCollectionName(fakePath); + assert.strictEqual(result, 'collectionValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('corpus', async () => { - const fakePath = "/rendered/path/corpus"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.corpusPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.corpusPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('corpusPath', () => { - const result = client.corpusPath("projectNumberValue", "locationValue", "corpusValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.corpusPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromCorpusName', () => { - const result = client.matchProjectNumberFromCorpusName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCorpusName', () => { - const result = client.matchLocationFromCorpusName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromCorpusName', () => { - const result = client.matchCorpusFromCorpusName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('corpus', async () => { + const fakePath = '/rendered/path/corpus'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.corpusPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.corpusPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('corpusPath', () => { + const result = client.corpusPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.corpusPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromCorpusName', () => { + const result = client.matchProjectNumberFromCorpusName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCorpusName', () => { + const result = client.matchLocationFromCorpusName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromCorpusName', () => { + const result = client.matchCorpusFromCorpusName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dataSchema', async () => { - const fakePath = "/rendered/path/dataSchema"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - data_schema: "dataSchemaValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dataSchemaPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dataSchemaPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dataSchemaPath', () => { - const result = client.dataSchemaPath("projectNumberValue", "locationValue", "corpusValue", "dataSchemaValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dataSchemaPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromDataSchemaName', () => { - const result = client.matchProjectNumberFromDataSchemaName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDataSchemaName', () => { - const result = client.matchLocationFromDataSchemaName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromDataSchemaName', () => { - const result = client.matchCorpusFromDataSchemaName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDataSchemaFromDataSchemaName', () => { - const result = client.matchDataSchemaFromDataSchemaName(fakePath); - assert.strictEqual(result, "dataSchemaValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dataSchema', async () => { + const fakePath = '/rendered/path/dataSchema'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + data_schema: 'dataSchemaValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dataSchemaPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dataSchemaPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dataSchemaPath', () => { + const result = client.dataSchemaPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'dataSchemaValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.dataSchemaPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromDataSchemaName', () => { + const result = client.matchProjectNumberFromDataSchemaName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDataSchemaName', () => { + const result = client.matchLocationFromDataSchemaName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromDataSchemaName', () => { + const result = client.matchCorpusFromDataSchemaName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataSchemaFromDataSchemaName', () => { + const result = client.matchDataSchemaFromDataSchemaName(fakePath); + assert.strictEqual(result, 'dataSchemaValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('draft', async () => { - const fakePath = "/rendered/path/draft"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - draft: "draftValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.draftPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.draftPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('draftPath', () => { - const result = client.draftPath("projectValue", "locationValue", "applicationValue", "draftValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.draftPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDraftName', () => { - const result = client.matchProjectFromDraftName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDraftName', () => { - const result = client.matchLocationFromDraftName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromDraftName', () => { - const result = client.matchApplicationFromDraftName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDraftFromDraftName', () => { - const result = client.matchDraftFromDraftName(fakePath); - assert.strictEqual(result, "draftValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('draft', async () => { + const fakePath = '/rendered/path/draft'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + draft: 'draftValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.draftPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.draftPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('draftPath', () => { + const result = client.draftPath( + 'projectValue', + 'locationValue', + 'applicationValue', + 'draftValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.draftPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDraftName', () => { + const result = client.matchProjectFromDraftName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDraftName', () => { + const result = client.matchLocationFromDraftName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromDraftName', () => { + const result = client.matchApplicationFromDraftName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDraftFromDraftName', () => { + const result = client.matchDraftFromDraftName(fakePath); + assert.strictEqual(result, 'draftValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('event', async () => { - const fakePath = "/rendered/path/event"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - event: "eventValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.eventPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.eventPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('eventPath', () => { - const result = client.eventPath("projectValue", "locationValue", "clusterValue", "eventValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.eventPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromEventName', () => { - const result = client.matchProjectFromEventName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromEventName', () => { - const result = client.matchLocationFromEventName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromEventName', () => { - const result = client.matchClusterFromEventName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEventFromEventName', () => { - const result = client.matchEventFromEventName(fakePath); - assert.strictEqual(result, "eventValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('event', async () => { + const fakePath = '/rendered/path/event'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + event: 'eventValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.eventPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.eventPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('eventPath', () => { + const result = client.eventPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'eventValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.eventPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromEventName', () => { + const result = client.matchProjectFromEventName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromEventName', () => { + const result = client.matchLocationFromEventName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromEventName', () => { + const result = client.matchClusterFromEventName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchEventFromEventName', () => { + const result = client.matchEventFromEventName(fakePath); + assert.strictEqual(result, 'eventValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('index', async () => { - const fakePath = "/rendered/path/index"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - index: "indexValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.indexPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.indexPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('indexPath', () => { - const result = client.indexPath("projectNumberValue", "locationValue", "corpusValue", "indexValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.indexPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromIndexName', () => { - const result = client.matchProjectNumberFromIndexName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromIndexName', () => { - const result = client.matchLocationFromIndexName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromIndexName', () => { - const result = client.matchCorpusFromIndexName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIndexFromIndexName', () => { - const result = client.matchIndexFromIndexName(fakePath); - assert.strictEqual(result, "indexValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('index', async () => { + const fakePath = '/rendered/path/index'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + index: 'indexValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.indexPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.indexPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('indexPath', () => { + const result = client.indexPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'indexValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.indexPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromIndexName', () => { + const result = client.matchProjectNumberFromIndexName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromIndexName', () => { + const result = client.matchLocationFromIndexName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromIndexName', () => { + const result = client.matchCorpusFromIndexName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchIndexFromIndexName', () => { + const result = client.matchIndexFromIndexName(fakePath); + assert.strictEqual(result, 'indexValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('indexEndpoint', async () => { - const fakePath = "/rendered/path/indexEndpoint"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - index_endpoint: "indexEndpointValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.indexEndpointPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.indexEndpointPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('indexEndpointPath', () => { - const result = client.indexEndpointPath("projectValue", "locationValue", "indexEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.indexEndpointPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromIndexEndpointName', () => { - const result = client.matchProjectFromIndexEndpointName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromIndexEndpointName', () => { - const result = client.matchLocationFromIndexEndpointName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIndexEndpointFromIndexEndpointName', () => { - const result = client.matchIndexEndpointFromIndexEndpointName(fakePath); - assert.strictEqual(result, "indexEndpointValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('indexEndpoint', async () => { + const fakePath = '/rendered/path/indexEndpoint'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + index_endpoint: 'indexEndpointValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.indexEndpointPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.indexEndpointPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('indexEndpointPath', () => { + const result = client.indexEndpointPath( + 'projectValue', + 'locationValue', + 'indexEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.indexEndpointPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromIndexEndpointName', () => { + const result = client.matchProjectFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromIndexEndpointName', () => { + const result = client.matchLocationFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchIndexEndpointFromIndexEndpointName', () => { + const result = client.matchIndexEndpointFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'indexEndpointValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('instance', async () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - instance: "instanceValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "applicationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromInstanceName', () => { - const result = client.matchApplicationFromInstanceName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('instance', async () => { + const fakePath = '/rendered/path/instance'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + instance: 'instanceValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.instancePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.instancePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath( + 'projectValue', + 'locationValue', + 'applicationValue', + 'instanceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInstanceName', () => { + const result = client.matchLocationFromInstanceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromInstanceName', () => { + const result = client.matchApplicationFromInstanceName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, 'instanceValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('operator', async () => { - const fakePath = "/rendered/path/operator"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - operator: "operatorValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.operatorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.operatorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('operatorPath', () => { - const result = client.operatorPath("projectValue", "locationValue", "operatorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.operatorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromOperatorName', () => { - const result = client.matchProjectFromOperatorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOperatorName', () => { - const result = client.matchLocationFromOperatorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchOperatorFromOperatorName', () => { - const result = client.matchOperatorFromOperatorName(fakePath); - assert.strictEqual(result, "operatorValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('operator', async () => { + const fakePath = '/rendered/path/operator'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + operator: 'operatorValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.operatorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.operatorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('operatorPath', () => { + const result = client.operatorPath( + 'projectValue', + 'locationValue', + 'operatorValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.operatorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromOperatorName', () => { + const result = client.matchProjectFromOperatorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOperatorName', () => { + const result = client.matchLocationFromOperatorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchOperatorFromOperatorName', () => { + const result = client.matchOperatorFromOperatorName(fakePath); + assert.strictEqual(result, 'operatorValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('process', async () => { - const fakePath = "/rendered/path/process"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - process: "processValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.processPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.processPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('processPath', () => { - const result = client.processPath("projectValue", "locationValue", "clusterValue", "processValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.processPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProcessName', () => { - const result = client.matchProjectFromProcessName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProcessName', () => { - const result = client.matchLocationFromProcessName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromProcessName', () => { - const result = client.matchClusterFromProcessName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProcessFromProcessName', () => { - const result = client.matchProcessFromProcessName(fakePath); - assert.strictEqual(result, "processValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('process', async () => { + const fakePath = '/rendered/path/process'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + process: 'processValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.processPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processPath', () => { + const result = client.processPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'processValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProcessName', () => { + const result = client.matchProjectFromProcessName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProcessName', () => { + const result = client.matchLocationFromProcessName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromProcessName', () => { + const result = client.matchClusterFromProcessName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchProcessFromProcessName', () => { + const result = client.matchProcessFromProcessName(fakePath); + assert.strictEqual(result, 'processValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('processor', async () => { - const fakePath = "/rendered/path/processor"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - processor: "processorValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.processorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.processorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('processorPath', () => { - const result = client.processorPath("projectValue", "locationValue", "processorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.processorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProcessorName', () => { - const result = client.matchProjectFromProcessorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProcessorName', () => { - const result = client.matchLocationFromProcessorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProcessorFromProcessorName', () => { - const result = client.matchProcessorFromProcessorName(fakePath); - assert.strictEqual(result, "processorValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('processor', async () => { + const fakePath = '/rendered/path/processor'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor: 'processorValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.processorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processorPath', () => { + const result = client.processorPath( + 'projectValue', + 'locationValue', + 'processorValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProcessorName', () => { + const result = client.matchProjectFromProcessorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProcessorName', () => { + const result = client.matchLocationFromProcessorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchProcessorFromProcessorName', () => { + const result = client.matchProcessorFromProcessorName(fakePath); + assert.strictEqual(result, 'processorValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('searchConfig', async () => { - const fakePath = "/rendered/path/searchConfig"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - search_config: "searchConfigValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.searchConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.searchConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('searchConfigPath', () => { - const result = client.searchConfigPath("projectNumberValue", "locationValue", "corpusValue", "searchConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.searchConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromSearchConfigName', () => { - const result = client.matchProjectNumberFromSearchConfigName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSearchConfigName', () => { - const result = client.matchLocationFromSearchConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromSearchConfigName', () => { - const result = client.matchCorpusFromSearchConfigName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSearchConfigFromSearchConfigName', () => { - const result = client.matchSearchConfigFromSearchConfigName(fakePath); - assert.strictEqual(result, "searchConfigValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('searchConfig', async () => { + const fakePath = '/rendered/path/searchConfig'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + search_config: 'searchConfigValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.searchConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.searchConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('searchConfigPath', () => { + const result = client.searchConfigPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'searchConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.searchConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromSearchConfigName', () => { + const result = client.matchProjectNumberFromSearchConfigName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSearchConfigName', () => { + const result = client.matchLocationFromSearchConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromSearchConfigName', () => { + const result = client.matchCorpusFromSearchConfigName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSearchConfigFromSearchConfigName', () => { + const result = client.matchSearchConfigFromSearchConfigName(fakePath); + assert.strictEqual(result, 'searchConfigValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('searchHypernym', async () => { - const fakePath = "/rendered/path/searchHypernym"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - search_hypernym: "searchHypernymValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.searchHypernymPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.searchHypernymPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('searchHypernymPath', () => { - const result = client.searchHypernymPath("projectNumberValue", "locationValue", "corpusValue", "searchHypernymValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.searchHypernymPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromSearchHypernymName', () => { - const result = client.matchProjectNumberFromSearchHypernymName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSearchHypernymName', () => { - const result = client.matchLocationFromSearchHypernymName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromSearchHypernymName', () => { - const result = client.matchCorpusFromSearchHypernymName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSearchHypernymFromSearchHypernymName', () => { - const result = client.matchSearchHypernymFromSearchHypernymName(fakePath); - assert.strictEqual(result, "searchHypernymValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('searchHypernym', async () => { + const fakePath = '/rendered/path/searchHypernym'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + search_hypernym: 'searchHypernymValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.searchHypernymPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.searchHypernymPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('searchHypernymPath', () => { + const result = client.searchHypernymPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'searchHypernymValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.searchHypernymPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromSearchHypernymName', () => { + const result = + client.matchProjectNumberFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSearchHypernymName', () => { + const result = client.matchLocationFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromSearchHypernymName', () => { + const result = client.matchCorpusFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSearchHypernymFromSearchHypernymName', () => { + const result = + client.matchSearchHypernymFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'searchHypernymValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('series', async () => { - const fakePath = "/rendered/path/series"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - series: "seriesValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.seriesPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.seriesPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('seriesPath', () => { - const result = client.seriesPath("projectValue", "locationValue", "clusterValue", "seriesValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.seriesPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSeriesName', () => { - const result = client.matchProjectFromSeriesName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSeriesName', () => { - const result = client.matchLocationFromSeriesName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromSeriesName', () => { - const result = client.matchClusterFromSeriesName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSeriesFromSeriesName', () => { - const result = client.matchSeriesFromSeriesName(fakePath); - assert.strictEqual(result, "seriesValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('series', async () => { + const fakePath = '/rendered/path/series'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + series: 'seriesValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.seriesPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.seriesPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('seriesPath', () => { + const result = client.seriesPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'seriesValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.seriesPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSeriesName', () => { + const result = client.matchProjectFromSeriesName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSeriesName', () => { + const result = client.matchLocationFromSeriesName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromSeriesName', () => { + const result = client.matchClusterFromSeriesName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSeriesFromSeriesName', () => { + const result = client.matchSeriesFromSeriesName(fakePath); + assert.strictEqual(result, 'seriesValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('stream', async () => { - const fakePath = "/rendered/path/stream"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - stream: "streamValue", - }; - const client = new appplatformModule.v1.AppPlatformClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.streamPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.streamPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('streamPath', () => { - const result = client.streamPath("projectValue", "locationValue", "clusterValue", "streamValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.streamPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromStreamName', () => { - const result = client.matchProjectFromStreamName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromStreamName', () => { - const result = client.matchLocationFromStreamName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromStreamName', () => { - const result = client.matchClusterFromStreamName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStreamFromStreamName', () => { - const result = client.matchStreamFromStreamName(fakePath); - assert.strictEqual(result, "streamValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('stream', async () => { + const fakePath = '/rendered/path/stream'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + stream: 'streamValue', + }; + const client = new appplatformModule.v1.AppPlatformClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.streamPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.streamPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('streamPath', () => { + const result = client.streamPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'streamValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.streamPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromStreamName', () => { + const result = client.matchProjectFromStreamName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromStreamName', () => { + const result = client.matchLocationFromStreamName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromStreamName', () => { + const result = client.matchClusterFromStreamName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchStreamFromStreamName', () => { + const result = client.matchStreamFromStreamName(fakePath); + assert.strictEqual(result, 'streamValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-visionai/test/gapic_health_check_service_v1.ts b/packages/google-cloud-visionai/test/gapic_health_check_service_v1.ts index 9debaab6bbb0..0c8af6ff902d 100644 --- a/packages/google-cloud-visionai/test/gapic_health_check_service_v1.ts +++ b/packages/google-cloud-visionai/test/gapic_health_check_service_v1.ts @@ -19,1863 +19,2472 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as healthcheckserviceModule from '../src'; -import {protobuf, IamProtos, LocationProtos} from 'google-gax'; +import { protobuf, IamProtos, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.HealthCheckServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = healthcheckserviceModule.v1.HealthCheckServiceClient.servicePath; - assert.strictEqual(servicePath, 'warehouse-visionai.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + healthcheckserviceModule.v1.HealthCheckServiceClient.servicePath; + assert.strictEqual(servicePath, 'warehouse-visionai.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + healthcheckserviceModule.v1.HealthCheckServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = healthcheckserviceModule.v1.HealthCheckServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new healthcheckserviceModule.v1.HealthCheckServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new healthcheckserviceModule.v1.HealthCheckServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new healthcheckserviceModule.v1.HealthCheckServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'warehouse-visionai.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has port', () => { - const port = healthcheckserviceModule.v1.HealthCheckServiceClient.port; - assert(port); - assert(typeof port === 'number'); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new healthcheckserviceModule.v1.HealthCheckServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with no option', () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient(); - assert(client); - }); + it('has port', () => { + const port = healthcheckserviceModule.v1.HealthCheckServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with gRPC fallback', () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with no option', () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient(); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.healthCheckServiceStub, undefined); - await client.initialize(); - assert(client.healthCheckServiceStub); - }); + it('should create a client with gRPC fallback', () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.healthCheckServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.healthCheckServiceStub, undefined); + await client.initialize(); + assert(client.healthCheckServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.healthCheckServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.healthCheckServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the non-initialized client', (done) => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.healthCheckServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('healthCheck', () => { - it('invokes healthCheck without error', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.HealthCheckRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.HealthCheckRequest', ['cluster']); - request.cluster = defaultValue1; - const expectedHeaderRequestParams = `cluster=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.HealthCheckResponse() - ); - client.innerApiCalls.healthCheck = stubSimpleCall(expectedResponse); - const [response] = await client.healthCheck(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.healthCheck as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.healthCheck as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('healthCheck', () => { + it('invokes healthCheck without error', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.HealthCheckRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.HealthCheckRequest', + ['cluster'], + ); + request.cluster = defaultValue1; + const expectedHeaderRequestParams = `cluster=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.HealthCheckResponse(), + ); + client.innerApiCalls.healthCheck = stubSimpleCall(expectedResponse); + const [response] = await client.healthCheck(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.healthCheck as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.healthCheck as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes healthCheck without error using callback', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.HealthCheckRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.HealthCheckRequest', ['cluster']); - request.cluster = defaultValue1; - const expectedHeaderRequestParams = `cluster=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.HealthCheckResponse() - ); - client.innerApiCalls.healthCheck = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.healthCheck( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IHealthCheckResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.healthCheck as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.healthCheck as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes healthCheck without error using callback', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.HealthCheckRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.HealthCheckRequest', + ['cluster'], + ); + request.cluster = defaultValue1; + const expectedHeaderRequestParams = `cluster=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.HealthCheckResponse(), + ); + client.innerApiCalls.healthCheck = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.healthCheck( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IHealthCheckResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.healthCheck as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.healthCheck as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes healthCheck with error', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.HealthCheckRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.HealthCheckRequest', ['cluster']); - request.cluster = defaultValue1; - const expectedHeaderRequestParams = `cluster=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.healthCheck = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.healthCheck(request), expectedError); - const actualRequest = (client.innerApiCalls.healthCheck as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.healthCheck as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes healthCheck with error', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.HealthCheckRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.HealthCheckRequest', + ['cluster'], + ); + request.cluster = defaultValue1; + const expectedHeaderRequestParams = `cluster=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.healthCheck = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.healthCheck(request), expectedError); + const actualRequest = ( + client.innerApiCalls.healthCheck as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.healthCheck as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes healthCheck with closed client', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.HealthCheckRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.HealthCheckRequest', ['cluster']); - request.cluster = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.healthCheck(request), expectedError); - }); + it('invokes healthCheck with closed client', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.HealthCheckRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.HealthCheckRequest', + ['cluster'], + ); + request.cluster = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.healthCheck(request), expectedError); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.getIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .getIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getIamPolicy(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes setIamPolicy without error using callback', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.setIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .setIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.setIamPolicy(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse(), + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions( + request, + expectedOptions, + ); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse(), + ); + client.iamClient.testIamPermissions = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .testIamPermissions( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.TestIamPermissionsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.testIamPermissions(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('analysis', async () => { + const fakePath = '/rendered/path/analysis'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + analysis: 'analysisValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.analysisPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.analysisPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('analysisPath', () => { + const result = client.analysisPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'analysisValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.analysisPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAnalysisName', () => { + const result = client.matchProjectFromAnalysisName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAnalysisName', () => { + const result = client.matchLocationFromAnalysisName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromAnalysisName', () => { + const result = client.matchClusterFromAnalysisName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAnalysisFromAnalysisName', () => { + const result = client.matchAnalysisFromAnalysisName(fakePath); + assert.strictEqual(result, 'analysisValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('analysis', async () => { - const fakePath = "/rendered/path/analysis"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - analysis: "analysisValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.analysisPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.analysisPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('analysisPath', () => { - const result = client.analysisPath("projectValue", "locationValue", "clusterValue", "analysisValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.analysisPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAnalysisName', () => { - const result = client.matchProjectFromAnalysisName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAnalysisName', () => { - const result = client.matchLocationFromAnalysisName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromAnalysisName', () => { - const result = client.matchClusterFromAnalysisName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnalysisFromAnalysisName', () => { - const result = client.matchAnalysisFromAnalysisName(fakePath); - assert.strictEqual(result, "analysisValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('annotation', async () => { - const fakePath = "/rendered/path/annotation"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - asset: "assetValue", - annotation: "annotationValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.annotationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.annotationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('annotationPath', () => { - const result = client.annotationPath("projectNumberValue", "locationValue", "corpusValue", "assetValue", "annotationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.annotationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromAnnotationName', () => { - const result = client.matchProjectNumberFromAnnotationName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAnnotationName', () => { - const result = client.matchLocationFromAnnotationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromAnnotationName', () => { - const result = client.matchCorpusFromAnnotationName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAnnotationName', () => { - const result = client.matchAssetFromAnnotationName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnnotationFromAnnotationName', () => { - const result = client.matchAnnotationFromAnnotationName(fakePath); - assert.strictEqual(result, "annotationValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('application', async () => { - const fakePath = "/rendered/path/application"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.applicationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.applicationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('applicationPath', () => { - const result = client.applicationPath("projectValue", "locationValue", "applicationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.applicationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApplicationName', () => { - const result = client.matchProjectFromApplicationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApplicationName', () => { - const result = client.matchLocationFromApplicationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromApplicationName', () => { - const result = client.matchApplicationFromApplicationName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('asset', async () => { - const fakePath = "/rendered/path/asset"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - asset: "assetValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.assetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.assetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('assetPath', () => { - const result = client.assetPath("projectNumberValue", "locationValue", "corpusValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.assetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromAssetName', () => { - const result = client.matchProjectNumberFromAssetName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAssetName', () => { - const result = client.matchLocationFromAssetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromAssetName', () => { - const result = client.matchCorpusFromAssetName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAssetName', () => { - const result = client.matchAssetFromAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('channel', async () => { - const fakePath = "/rendered/path/channel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - channel: "channelValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.channelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.channelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('channelPath', () => { - const result = client.channelPath("projectValue", "locationValue", "clusterValue", "channelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.channelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromChannelName', () => { - const result = client.matchProjectFromChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromChannelName', () => { - const result = client.matchLocationFromChannelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromChannelName', () => { - const result = client.matchClusterFromChannelName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelFromChannelName', () => { - const result = client.matchChannelFromChannelName(fakePath); - assert.strictEqual(result, "channelValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('cluster', async () => { - const fakePath = "/rendered/path/cluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clusterPath', () => { - const result = client.clusterPath("projectValue", "locationValue", "clusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClusterName', () => { - const result = client.matchProjectFromClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClusterName', () => { - const result = client.matchLocationFromClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromClusterName', () => { - const result = client.matchClusterFromClusterName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('collection', async () => { - const fakePath = "/rendered/path/collection"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - collection: "collectionValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.collectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.collectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('collectionPath', () => { - const result = client.collectionPath("projectNumberValue", "locationValue", "corpusValue", "collectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.collectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromCollectionName', () => { - const result = client.matchProjectNumberFromCollectionName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCollectionName', () => { - const result = client.matchLocationFromCollectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromCollectionName', () => { - const result = client.matchCorpusFromCollectionName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCollectionFromCollectionName', () => { - const result = client.matchCollectionFromCollectionName(fakePath); - assert.strictEqual(result, "collectionValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('corpus', async () => { - const fakePath = "/rendered/path/corpus"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.corpusPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.corpusPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('corpusPath', () => { - const result = client.corpusPath("projectNumberValue", "locationValue", "corpusValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.corpusPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromCorpusName', () => { - const result = client.matchProjectNumberFromCorpusName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCorpusName', () => { - const result = client.matchLocationFromCorpusName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromCorpusName', () => { - const result = client.matchCorpusFromCorpusName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('dataSchema', async () => { - const fakePath = "/rendered/path/dataSchema"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - data_schema: "dataSchemaValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dataSchemaPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dataSchemaPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dataSchemaPath', () => { - const result = client.dataSchemaPath("projectNumberValue", "locationValue", "corpusValue", "dataSchemaValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dataSchemaPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromDataSchemaName', () => { - const result = client.matchProjectNumberFromDataSchemaName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDataSchemaName', () => { - const result = client.matchLocationFromDataSchemaName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromDataSchemaName', () => { - const result = client.matchCorpusFromDataSchemaName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDataSchemaFromDataSchemaName', () => { - const result = client.matchDataSchemaFromDataSchemaName(fakePath); - assert.strictEqual(result, "dataSchemaValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('draft', async () => { - const fakePath = "/rendered/path/draft"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - draft: "draftValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.draftPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.draftPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('draftPath', () => { - const result = client.draftPath("projectValue", "locationValue", "applicationValue", "draftValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.draftPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDraftName', () => { - const result = client.matchProjectFromDraftName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDraftName', () => { - const result = client.matchLocationFromDraftName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromDraftName', () => { - const result = client.matchApplicationFromDraftName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDraftFromDraftName', () => { - const result = client.matchDraftFromDraftName(fakePath); - assert.strictEqual(result, "draftValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('event', async () => { - const fakePath = "/rendered/path/event"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - event: "eventValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.eventPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.eventPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('eventPath', () => { - const result = client.eventPath("projectValue", "locationValue", "clusterValue", "eventValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.eventPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromEventName', () => { - const result = client.matchProjectFromEventName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromEventName', () => { - const result = client.matchLocationFromEventName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromEventName', () => { - const result = client.matchClusterFromEventName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEventFromEventName', () => { - const result = client.matchEventFromEventName(fakePath); - assert.strictEqual(result, "eventValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('index', async () => { - const fakePath = "/rendered/path/index"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - index: "indexValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.indexPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.indexPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('indexPath', () => { - const result = client.indexPath("projectNumberValue", "locationValue", "corpusValue", "indexValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.indexPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromIndexName', () => { - const result = client.matchProjectNumberFromIndexName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromIndexName', () => { - const result = client.matchLocationFromIndexName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromIndexName', () => { - const result = client.matchCorpusFromIndexName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIndexFromIndexName', () => { - const result = client.matchIndexFromIndexName(fakePath); - assert.strictEqual(result, "indexValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('indexEndpoint', async () => { - const fakePath = "/rendered/path/indexEndpoint"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - index_endpoint: "indexEndpointValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.indexEndpointPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.indexEndpointPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('indexEndpointPath', () => { - const result = client.indexEndpointPath("projectValue", "locationValue", "indexEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.indexEndpointPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromIndexEndpointName', () => { - const result = client.matchProjectFromIndexEndpointName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromIndexEndpointName', () => { - const result = client.matchLocationFromIndexEndpointName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIndexEndpointFromIndexEndpointName', () => { - const result = client.matchIndexEndpointFromIndexEndpointName(fakePath); - assert.strictEqual(result, "indexEndpointValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('instance', async () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - instance: "instanceValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "applicationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromInstanceName', () => { - const result = client.matchApplicationFromInstanceName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('operator', async () => { - const fakePath = "/rendered/path/operator"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - operator: "operatorValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.operatorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.operatorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('operatorPath', () => { - const result = client.operatorPath("projectValue", "locationValue", "operatorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.operatorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromOperatorName', () => { - const result = client.matchProjectFromOperatorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOperatorName', () => { - const result = client.matchLocationFromOperatorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchOperatorFromOperatorName', () => { - const result = client.matchOperatorFromOperatorName(fakePath); - assert.strictEqual(result, "operatorValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('process', async () => { - const fakePath = "/rendered/path/process"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - process: "processValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.processPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.processPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('processPath', () => { - const result = client.processPath("projectValue", "locationValue", "clusterValue", "processValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.processPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProcessName', () => { - const result = client.matchProjectFromProcessName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProcessName', () => { - const result = client.matchLocationFromProcessName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromProcessName', () => { - const result = client.matchClusterFromProcessName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProcessFromProcessName', () => { - const result = client.matchProcessFromProcessName(fakePath); - assert.strictEqual(result, "processValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('processor', async () => { - const fakePath = "/rendered/path/processor"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - processor: "processorValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.processorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.processorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('processorPath', () => { - const result = client.processorPath("projectValue", "locationValue", "processorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.processorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProcessorName', () => { - const result = client.matchProjectFromProcessorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProcessorName', () => { - const result = client.matchLocationFromProcessorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProcessorFromProcessorName', () => { - const result = client.matchProcessorFromProcessorName(fakePath); - assert.strictEqual(result, "processorValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('searchConfig', async () => { - const fakePath = "/rendered/path/searchConfig"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - search_config: "searchConfigValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.searchConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.searchConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('searchConfigPath', () => { - const result = client.searchConfigPath("projectNumberValue", "locationValue", "corpusValue", "searchConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.searchConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('annotation', async () => { + const fakePath = '/rendered/path/annotation'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + asset: 'assetValue', + annotation: 'annotationValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.annotationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.annotationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('annotationPath', () => { + const result = client.annotationPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'assetValue', + 'annotationValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.annotationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromAnnotationName', () => { + const result = client.matchProjectNumberFromAnnotationName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAnnotationName', () => { + const result = client.matchLocationFromAnnotationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromAnnotationName', () => { + const result = client.matchCorpusFromAnnotationName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAssetFromAnnotationName', () => { + const result = client.matchAssetFromAnnotationName(fakePath); + assert.strictEqual(result, 'assetValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAnnotationFromAnnotationName', () => { + const result = client.matchAnnotationFromAnnotationName(fakePath); + assert.strictEqual(result, 'annotationValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectNumberFromSearchConfigName', () => { - const result = client.matchProjectNumberFromSearchConfigName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('application', async () => { + const fakePath = '/rendered/path/application'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.applicationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.applicationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('applicationPath', () => { + const result = client.applicationPath( + 'projectValue', + 'locationValue', + 'applicationValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.applicationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromApplicationName', () => { + const result = client.matchProjectFromApplicationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromApplicationName', () => { + const result = client.matchLocationFromApplicationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromApplicationName', () => { + const result = client.matchApplicationFromApplicationName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSearchConfigName', () => { - const result = client.matchLocationFromSearchConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('asset', async () => { + const fakePath = '/rendered/path/asset'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + asset: 'assetValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.assetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.assetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('assetPath', () => { + const result = client.assetPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'assetValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.assetPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromAssetName', () => { + const result = client.matchProjectNumberFromAssetName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAssetName', () => { + const result = client.matchLocationFromAssetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromAssetName', () => { + const result = client.matchCorpusFromAssetName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAssetFromAssetName', () => { + const result = client.matchAssetFromAssetName(fakePath); + assert.strictEqual(result, 'assetValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchCorpusFromSearchConfigName', () => { - const result = client.matchCorpusFromSearchConfigName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('channel', async () => { + const fakePath = '/rendered/path/channel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + channel: 'channelValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.channelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.channelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('channelPath', () => { + const result = client.channelPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'channelValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.channelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromChannelName', () => { + const result = client.matchProjectFromChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromChannelName', () => { + const result = client.matchLocationFromChannelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromChannelName', () => { + const result = client.matchClusterFromChannelName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, 'channelValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSearchConfigFromSearchConfigName', () => { - const result = client.matchSearchConfigFromSearchConfigName(fakePath); - assert.strictEqual(result, "searchConfigValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('cluster', async () => { + const fakePath = '/rendered/path/cluster'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clusterPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clusterPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clusterPath', () => { + const result = client.clusterPath( + 'projectValue', + 'locationValue', + 'clusterValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clusterPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClusterName', () => { + const result = client.matchProjectFromClusterName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClusterName', () => { + const result = client.matchLocationFromClusterName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromClusterName', () => { + const result = client.matchClusterFromClusterName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('searchHypernym', async () => { - const fakePath = "/rendered/path/searchHypernym"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - search_hypernym: "searchHypernymValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.searchHypernymPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.searchHypernymPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('searchHypernymPath', () => { - const result = client.searchHypernymPath("projectNumberValue", "locationValue", "corpusValue", "searchHypernymValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.searchHypernymPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('collection', async () => { + const fakePath = '/rendered/path/collection'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + collection: 'collectionValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.collectionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.collectionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('collectionPath', () => { + const result = client.collectionPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'collectionValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.collectionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromCollectionName', () => { + const result = client.matchProjectNumberFromCollectionName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCollectionName', () => { + const result = client.matchLocationFromCollectionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromCollectionName', () => { + const result = client.matchCorpusFromCollectionName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCollectionFromCollectionName', () => { + const result = client.matchCollectionFromCollectionName(fakePath); + assert.strictEqual(result, 'collectionValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectNumberFromSearchHypernymName', () => { - const result = client.matchProjectNumberFromSearchHypernymName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('corpus', async () => { + const fakePath = '/rendered/path/corpus'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.corpusPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.corpusPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('corpusPath', () => { + const result = client.corpusPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.corpusPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromCorpusName', () => { + const result = client.matchProjectNumberFromCorpusName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCorpusName', () => { + const result = client.matchLocationFromCorpusName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromCorpusName', () => { + const result = client.matchCorpusFromCorpusName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSearchHypernymName', () => { - const result = client.matchLocationFromSearchHypernymName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('dataSchema', async () => { + const fakePath = '/rendered/path/dataSchema'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + data_schema: 'dataSchemaValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dataSchemaPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dataSchemaPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dataSchemaPath', () => { + const result = client.dataSchemaPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'dataSchemaValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.dataSchemaPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromDataSchemaName', () => { + const result = client.matchProjectNumberFromDataSchemaName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDataSchemaName', () => { + const result = client.matchLocationFromDataSchemaName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromDataSchemaName', () => { + const result = client.matchCorpusFromDataSchemaName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataSchemaFromDataSchemaName', () => { + const result = client.matchDataSchemaFromDataSchemaName(fakePath); + assert.strictEqual(result, 'dataSchemaValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchCorpusFromSearchHypernymName', () => { - const result = client.matchCorpusFromSearchHypernymName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('draft', async () => { + const fakePath = '/rendered/path/draft'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + draft: 'draftValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.draftPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.draftPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('draftPath', () => { + const result = client.draftPath( + 'projectValue', + 'locationValue', + 'applicationValue', + 'draftValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.draftPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDraftName', () => { + const result = client.matchProjectFromDraftName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDraftName', () => { + const result = client.matchLocationFromDraftName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromDraftName', () => { + const result = client.matchApplicationFromDraftName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDraftFromDraftName', () => { + const result = client.matchDraftFromDraftName(fakePath); + assert.strictEqual(result, 'draftValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSearchHypernymFromSearchHypernymName', () => { - const result = client.matchSearchHypernymFromSearchHypernymName(fakePath); - assert.strictEqual(result, "searchHypernymValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('event', async () => { + const fakePath = '/rendered/path/event'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + event: 'eventValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.eventPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.eventPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('eventPath', () => { + const result = client.eventPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'eventValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.eventPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromEventName', () => { + const result = client.matchProjectFromEventName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromEventName', () => { + const result = client.matchLocationFromEventName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromEventName', () => { + const result = client.matchClusterFromEventName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchEventFromEventName', () => { + const result = client.matchEventFromEventName(fakePath); + assert.strictEqual(result, 'eventValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('series', async () => { - const fakePath = "/rendered/path/series"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - series: "seriesValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.seriesPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.seriesPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('seriesPath', () => { - const result = client.seriesPath("projectValue", "locationValue", "clusterValue", "seriesValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.seriesPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('index', async () => { + const fakePath = '/rendered/path/index'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + index: 'indexValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.indexPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.indexPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('indexPath', () => { + const result = client.indexPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'indexValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.indexPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromIndexName', () => { + const result = client.matchProjectNumberFromIndexName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromIndexName', () => { + const result = client.matchLocationFromIndexName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromIndexName', () => { + const result = client.matchCorpusFromIndexName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchIndexFromIndexName', () => { + const result = client.matchIndexFromIndexName(fakePath); + assert.strictEqual(result, 'indexValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromSeriesName', () => { - const result = client.matchProjectFromSeriesName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('indexEndpoint', async () => { + const fakePath = '/rendered/path/indexEndpoint'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + index_endpoint: 'indexEndpointValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.indexEndpointPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.indexEndpointPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('indexEndpointPath', () => { + const result = client.indexEndpointPath( + 'projectValue', + 'locationValue', + 'indexEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.indexEndpointPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromIndexEndpointName', () => { + const result = client.matchProjectFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromIndexEndpointName', () => { + const result = client.matchLocationFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchIndexEndpointFromIndexEndpointName', () => { + const result = client.matchIndexEndpointFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'indexEndpointValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSeriesName', () => { - const result = client.matchLocationFromSeriesName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('instance', async () => { + const fakePath = '/rendered/path/instance'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + instance: 'instanceValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.instancePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.instancePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath( + 'projectValue', + 'locationValue', + 'applicationValue', + 'instanceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInstanceName', () => { + const result = client.matchLocationFromInstanceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromInstanceName', () => { + const result = client.matchApplicationFromInstanceName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, 'instanceValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchClusterFromSeriesName', () => { - const result = client.matchClusterFromSeriesName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('operator', async () => { + const fakePath = '/rendered/path/operator'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + operator: 'operatorValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.operatorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.operatorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('operatorPath', () => { + const result = client.operatorPath( + 'projectValue', + 'locationValue', + 'operatorValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.operatorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromOperatorName', () => { + const result = client.matchProjectFromOperatorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOperatorName', () => { + const result = client.matchLocationFromOperatorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchOperatorFromOperatorName', () => { + const result = client.matchOperatorFromOperatorName(fakePath); + assert.strictEqual(result, 'operatorValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSeriesFromSeriesName', () => { - const result = client.matchSeriesFromSeriesName(fakePath); - assert.strictEqual(result, "seriesValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('process', async () => { + const fakePath = '/rendered/path/process'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + process: 'processValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.processPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processPath', () => { + const result = client.processPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'processValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProcessName', () => { + const result = client.matchProjectFromProcessName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProcessName', () => { + const result = client.matchLocationFromProcessName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromProcessName', () => { + const result = client.matchClusterFromProcessName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchProcessFromProcessName', () => { + const result = client.matchProcessFromProcessName(fakePath); + assert.strictEqual(result, 'processValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('stream', async () => { - const fakePath = "/rendered/path/stream"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - stream: "streamValue", - }; - const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.streamPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.streamPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('streamPath', () => { - const result = client.streamPath("projectValue", "locationValue", "clusterValue", "streamValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.streamPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('processor', async () => { + const fakePath = '/rendered/path/processor'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor: 'processorValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.processorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processorPath', () => { + const result = client.processorPath( + 'projectValue', + 'locationValue', + 'processorValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProcessorName', () => { + const result = client.matchProjectFromProcessorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProcessorName', () => { + const result = client.matchLocationFromProcessorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchProcessorFromProcessorName', () => { + const result = client.matchProcessorFromProcessorName(fakePath); + assert.strictEqual(result, 'processorValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromStreamName', () => { - const result = client.matchProjectFromStreamName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('searchConfig', async () => { + const fakePath = '/rendered/path/searchConfig'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + search_config: 'searchConfigValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.searchConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.searchConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('searchConfigPath', () => { + const result = client.searchConfigPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'searchConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.searchConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromSearchConfigName', () => { + const result = client.matchProjectNumberFromSearchConfigName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSearchConfigName', () => { + const result = client.matchLocationFromSearchConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromSearchConfigName', () => { + const result = client.matchCorpusFromSearchConfigName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSearchConfigFromSearchConfigName', () => { + const result = client.matchSearchConfigFromSearchConfigName(fakePath); + assert.strictEqual(result, 'searchConfigValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromStreamName', () => { - const result = client.matchLocationFromStreamName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('searchHypernym', async () => { + const fakePath = '/rendered/path/searchHypernym'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + search_hypernym: 'searchHypernymValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.searchHypernymPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.searchHypernymPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('searchHypernymPath', () => { + const result = client.searchHypernymPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'searchHypernymValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.searchHypernymPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromSearchHypernymName', () => { + const result = + client.matchProjectNumberFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSearchHypernymName', () => { + const result = client.matchLocationFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromSearchHypernymName', () => { + const result = client.matchCorpusFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSearchHypernymFromSearchHypernymName', () => { + const result = + client.matchSearchHypernymFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'searchHypernymValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchClusterFromStreamName', () => { - const result = client.matchClusterFromStreamName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('series', async () => { + const fakePath = '/rendered/path/series'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + series: 'seriesValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.seriesPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.seriesPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('seriesPath', () => { + const result = client.seriesPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'seriesValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.seriesPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSeriesName', () => { + const result = client.matchProjectFromSeriesName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSeriesName', () => { + const result = client.matchLocationFromSeriesName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromSeriesName', () => { + const result = client.matchClusterFromSeriesName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSeriesFromSeriesName', () => { + const result = client.matchSeriesFromSeriesName(fakePath); + assert.strictEqual(result, 'seriesValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchStreamFromStreamName', () => { - const result = client.matchStreamFromStreamName(fakePath); - assert.strictEqual(result, "streamValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('stream', async () => { + const fakePath = '/rendered/path/stream'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + stream: 'streamValue', + }; + const client = new healthcheckserviceModule.v1.HealthCheckServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.streamPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.streamPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('streamPath', () => { + const result = client.streamPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'streamValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.streamPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromStreamName', () => { + const result = client.matchProjectFromStreamName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromStreamName', () => { + const result = client.matchLocationFromStreamName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromStreamName', () => { + const result = client.matchClusterFromStreamName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchStreamFromStreamName', () => { + const result = client.matchStreamFromStreamName(fakePath); + assert.strictEqual(result, 'streamValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-visionai/test/gapic_live_video_analytics_v1.ts b/packages/google-cloud-visionai/test/gapic_live_video_analytics_v1.ts index 1dbf587643a5..e8e2c5cc80fd 100644 --- a/packages/google-cloud-visionai/test/gapic_live_video_analytics_v1.ts +++ b/packages/google-cloud-visionai/test/gapic_live_video_analytics_v1.ts @@ -19,5055 +19,6470 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as livevideoanalyticsModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + IamProtos, + LocationProtos, +} from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); } -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.LiveVideoAnalyticsClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = livevideoanalyticsModule.v1.LiveVideoAnalyticsClient.servicePath; - assert.strictEqual(servicePath, 'warehouse-visionai.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + livevideoanalyticsModule.v1.LiveVideoAnalyticsClient.servicePath; + assert.strictEqual(servicePath, 'warehouse-visionai.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + livevideoanalyticsModule.v1.LiveVideoAnalyticsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = livevideoanalyticsModule.v1.LiveVideoAnalyticsClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'warehouse-visionai.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + it('has port', () => { + const port = livevideoanalyticsModule.v1.LiveVideoAnalyticsClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has port', () => { - const port = livevideoanalyticsModule.v1.LiveVideoAnalyticsClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('should create a client with no option', () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient(); + assert(client); + }); - it('should create a client with no option', () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient(); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + fallback: true, + }); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - fallback: true, - }); - assert(client); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.liveVideoAnalyticsStub, undefined); + await client.initialize(); + assert(client.liveVideoAnalyticsStub); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.liveVideoAnalyticsStub, undefined); - await client.initialize(); - assert(client.liveVideoAnalyticsStub); + it('has close method for the initialized client', (done) => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.liveVideoAnalyticsStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has close method for the initialized client', done => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.liveVideoAnalyticsStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the non-initialized client', (done) => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.liveVideoAnalyticsStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has close method for the non-initialized client', done => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.liveVideoAnalyticsStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('resolveOperatorInfo', () => { + it('invokes resolveOperatorInfo without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ResolveOperatorInfoRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ResolveOperatorInfoRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.ResolveOperatorInfoResponse(), + ); + client.innerApiCalls.resolveOperatorInfo = + stubSimpleCall(expectedResponse); + const [response] = await client.resolveOperatorInfo(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resolveOperatorInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resolveOperatorInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('invokes resolveOperatorInfo without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ResolveOperatorInfoRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ResolveOperatorInfoRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.ResolveOperatorInfoResponse(), + ); + client.innerApiCalls.resolveOperatorInfo = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resolveOperatorInfo( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resolveOperatorInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resolveOperatorInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('resolveOperatorInfo', () => { - it('invokes resolveOperatorInfo without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ResolveOperatorInfoRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ResolveOperatorInfoRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.ResolveOperatorInfoResponse() - ); - client.innerApiCalls.resolveOperatorInfo = stubSimpleCall(expectedResponse); - const [response] = await client.resolveOperatorInfo(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resolveOperatorInfo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resolveOperatorInfo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes resolveOperatorInfo with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ResolveOperatorInfoRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ResolveOperatorInfoRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resolveOperatorInfo = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.resolveOperatorInfo(request), expectedError); + const actualRequest = ( + client.innerApiCalls.resolveOperatorInfo as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resolveOperatorInfo as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes resolveOperatorInfo without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ResolveOperatorInfoRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ResolveOperatorInfoRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.ResolveOperatorInfoResponse() - ); - client.innerApiCalls.resolveOperatorInfo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resolveOperatorInfo( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IResolveOperatorInfoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resolveOperatorInfo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resolveOperatorInfo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes resolveOperatorInfo with closed client', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ResolveOperatorInfoRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ResolveOperatorInfoRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.resolveOperatorInfo(request), expectedError); + }); + }); + + describe('getOperator', () => { + it('invokes getOperator without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetOperatorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetOperatorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Operator(), + ); + client.innerApiCalls.getOperator = stubSimpleCall(expectedResponse); + const [response] = await client.getOperator(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes resolveOperatorInfo with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ResolveOperatorInfoRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ResolveOperatorInfoRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resolveOperatorInfo = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resolveOperatorInfo(request), expectedError); - const actualRequest = (client.innerApiCalls.resolveOperatorInfo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resolveOperatorInfo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getOperator without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetOperatorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetOperatorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Operator(), + ); + client.innerApiCalls.getOperator = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getOperator( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IOperator | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes resolveOperatorInfo with closed client', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ResolveOperatorInfoRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ResolveOperatorInfoRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.resolveOperatorInfo(request), expectedError); - }); + it('invokes getOperator with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetOperatorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetOperatorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getOperator = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getOperator(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getOperator', () => { - it('invokes getOperator without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetOperatorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetOperatorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Operator() - ); - client.innerApiCalls.getOperator = stubSimpleCall(expectedResponse); - const [response] = await client.getOperator(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getOperator with closed client', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetOperatorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetOperatorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getOperator(request), expectedError); + }); + }); + + describe('getAnalysis', () => { + it('invokes getAnalysis without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetAnalysisRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetAnalysisRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Analysis(), + ); + client.innerApiCalls.getAnalysis = stubSimpleCall(expectedResponse); + const [response] = await client.getAnalysis(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getOperator without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetOperatorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetOperatorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Operator() - ); - client.innerApiCalls.getOperator = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getOperator( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IOperator|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAnalysis without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetAnalysisRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetAnalysisRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Analysis(), + ); + client.innerApiCalls.getAnalysis = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAnalysis( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IAnalysis | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getOperator with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetOperatorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetOperatorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getOperator = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getOperator(request), expectedError); - const actualRequest = (client.innerApiCalls.getOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAnalysis with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetAnalysisRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetAnalysisRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAnalysis = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getAnalysis(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getOperator with closed client', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetOperatorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetOperatorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getOperator(request), expectedError); - }); + it('invokes getAnalysis with closed client', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetAnalysisRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetAnalysisRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getAnalysis(request), expectedError); + }); + }); + + describe('getProcess', () => { + it('invokes getProcess without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetProcessRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Process(), + ); + client.innerApiCalls.getProcess = stubSimpleCall(expectedResponse); + const [response] = await client.getProcess(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getAnalysis', () => { - it('invokes getAnalysis without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetAnalysisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetAnalysisRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Analysis() - ); - client.innerApiCalls.getAnalysis = stubSimpleCall(expectedResponse); - const [response] = await client.getAnalysis(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getProcess without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetProcessRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Process(), + ); + client.innerApiCalls.getProcess = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProcess( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IProcess | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAnalysis without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetAnalysisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetAnalysisRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Analysis() - ); - client.innerApiCalls.getAnalysis = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAnalysis( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IAnalysis|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getProcess with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetProcessRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getProcess = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getProcess(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAnalysis with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetAnalysisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetAnalysisRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAnalysis = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAnalysis(request), expectedError); - const actualRequest = (client.innerApiCalls.getAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getProcess with closed client', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetProcessRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getProcess(request), expectedError); + }); + }); + + describe('createOperator', () => { + it('invokes createOperator without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateOperatorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateOperatorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createOperator = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createOperator(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAnalysis with closed client', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetAnalysisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetAnalysisRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAnalysis(request), expectedError); - }); + it('invokes createOperator without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateOperatorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateOperatorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createOperator = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createOperator( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getProcess', () => { - it('invokes getProcess without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetProcessRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Process() - ); - client.innerApiCalls.getProcess = stubSimpleCall(expectedResponse); - const [response] = await client.getProcess(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createOperator with call error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateOperatorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateOperatorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createOperator = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createOperator(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getProcess without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetProcessRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Process() - ); - client.innerApiCalls.getProcess = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProcess( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IProcess|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createOperator with LRO error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateOperatorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateOperatorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createOperator = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createOperator(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getProcess with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetProcessRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProcess = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getProcess(request), expectedError); - const actualRequest = (client.innerApiCalls.getProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateOperatorProgress without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateOperatorProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes getProcess with closed client', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetProcessRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getProcess(request), expectedError); - }); + it('invokes checkCreateOperatorProgress with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateOperatorProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateOperator', () => { + it('invokes updateOperator without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateOperatorRequest(), + ); + request.operator ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateOperatorRequest', + ['operator', 'name'], + ); + request.operator.name = defaultValue1; + const expectedHeaderRequestParams = `operator.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateOperator = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateOperator(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createOperator', () => { - it('invokes createOperator without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateOperatorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateOperatorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createOperator = stubLongRunningCall(expectedResponse); - const [operation] = await client.createOperator(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateOperator without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateOperatorRequest(), + ); + request.operator ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateOperatorRequest', + ['operator', 'name'], + ); + request.operator.name = defaultValue1; + const expectedHeaderRequestParams = `operator.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateOperator = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateOperator( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IOperator, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createOperator without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateOperatorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateOperatorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createOperator = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createOperator( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateOperator with call error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateOperatorRequest(), + ); + request.operator ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateOperatorRequest', + ['operator', 'name'], + ); + request.operator.name = defaultValue1; + const expectedHeaderRequestParams = `operator.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateOperator = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateOperator(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createOperator with call error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateOperatorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateOperatorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createOperator = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createOperator(request), expectedError); - const actualRequest = (client.innerApiCalls.createOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateOperator with LRO error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateOperatorRequest(), + ); + request.operator ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateOperatorRequest', + ['operator', 'name'], + ); + request.operator.name = defaultValue1; + const expectedHeaderRequestParams = `operator.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateOperator = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateOperator(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createOperator with LRO error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateOperatorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateOperatorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createOperator = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createOperator(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateOperatorProgress without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateOperatorProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateOperatorProgress without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateOperatorProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateOperatorProgress with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateOperatorProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteOperator', () => { + it('invokes deleteOperator without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteOperatorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteOperatorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteOperator = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteOperator(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateOperatorProgress with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes deleteOperator without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteOperatorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteOperatorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteOperator = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteOperator( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateOperatorProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteOperator with call error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteOperatorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteOperatorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteOperator = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteOperator(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateOperator', () => { - it('invokes updateOperator without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateOperatorRequest() - ); - request.operator ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateOperatorRequest', ['operator', 'name']); - request.operator.name = defaultValue1; - const expectedHeaderRequestParams = `operator.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateOperator = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateOperator(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteOperator with LRO error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteOperatorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteOperatorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteOperator = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteOperator(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteOperator as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteOperator as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateOperator without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateOperatorRequest() - ); - request.operator ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateOperatorRequest', ['operator', 'name']); - request.operator.name = defaultValue1; - const expectedHeaderRequestParams = `operator.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateOperator = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateOperator( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteOperatorProgress without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteOperatorProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateOperator with call error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateOperatorRequest() - ); - request.operator ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateOperatorRequest', ['operator', 'name']); - request.operator.name = defaultValue1; - const expectedHeaderRequestParams = `operator.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateOperator = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateOperator(request), expectedError); - const actualRequest = (client.innerApiCalls.updateOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteOperatorProgress with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteOperatorProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createAnalysis', () => { + it('invokes createAnalysis without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateAnalysisRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateAnalysisRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAnalysis = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createAnalysis(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateOperator with LRO error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateOperatorRequest() - ); - request.operator ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateOperatorRequest', ['operator', 'name']); - request.operator.name = defaultValue1; - const expectedHeaderRequestParams = `operator.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateOperator = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateOperator(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAnalysis without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateAnalysisRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateAnalysisRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createAnalysis = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAnalysis( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateOperatorProgress without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateOperatorProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createAnalysis with call error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateAnalysisRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateAnalysisRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAnalysis = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createAnalysis(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateOperatorProgress with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes createAnalysis with LRO error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateAnalysisRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateAnalysisRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAnalysis = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createAnalysis(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateOperatorProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateAnalysisProgress without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateAnalysisProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteOperator', () => { - it('invokes deleteOperator without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteOperatorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteOperatorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteOperator = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteOperator(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateAnalysisProgress with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateAnalysisProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateAnalysis', () => { + it('invokes updateAnalysis without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateAnalysisRequest(), + ); + request.analysis ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateAnalysisRequest', + ['analysis', 'name'], + ); + request.analysis.name = defaultValue1; + const expectedHeaderRequestParams = `analysis.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAnalysis = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateAnalysis(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteOperator without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteOperatorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteOperatorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteOperator = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteOperator( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAnalysis without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateAnalysisRequest(), + ); + request.analysis ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateAnalysisRequest', + ['analysis', 'name'], + ); + request.analysis.name = defaultValue1; + const expectedHeaderRequestParams = `analysis.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateAnalysis = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAnalysis( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IAnalysis, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteOperator with call error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteOperatorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteOperatorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteOperator = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteOperator(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAnalysis with call error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateAnalysisRequest(), + ); + request.analysis ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateAnalysisRequest', + ['analysis', 'name'], + ); + request.analysis.name = defaultValue1; + const expectedHeaderRequestParams = `analysis.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAnalysis = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateAnalysis(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteOperator with LRO error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteOperatorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteOperatorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteOperator = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteOperator(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteOperator as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteOperator as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAnalysis with LRO error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateAnalysisRequest(), + ); + request.analysis ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateAnalysisRequest', + ['analysis', 'name'], + ); + request.analysis.name = defaultValue1; + const expectedHeaderRequestParams = `analysis.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAnalysis = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateAnalysis(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteOperatorProgress without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteOperatorProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateAnalysisProgress without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateAnalysisProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteOperatorProgress with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkUpdateAnalysisProgress with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateAnalysisProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteAnalysis', () => { + it('invokes deleteAnalysis without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteAnalysisRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteAnalysisRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAnalysis = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAnalysis(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteOperatorProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteAnalysis without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteAnalysisRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteAnalysisRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAnalysis = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAnalysis( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createAnalysis', () => { - it('invokes createAnalysis without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateAnalysisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateAnalysisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAnalysis = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAnalysis(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAnalysis with call error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteAnalysisRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteAnalysisRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAnalysis = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteAnalysis(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAnalysis without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateAnalysisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateAnalysisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createAnalysis = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAnalysis( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAnalysis with LRO error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteAnalysisRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteAnalysisRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAnalysis = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteAnalysis(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAnalysis as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAnalysis as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAnalysis with call error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateAnalysisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateAnalysisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAnalysis = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAnalysis(request), expectedError); - const actualRequest = (client.innerApiCalls.createAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteAnalysisProgress without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteAnalysisProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createAnalysis with LRO error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateAnalysisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateAnalysisRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAnalysis = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAnalysis(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteAnalysisProgress with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteAnalysisProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createProcess', () => { + it('invokes createProcess without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateProcessRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createProcess = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createProcess(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateAnalysisProgress without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateAnalysisProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createProcess without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateProcessRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createProcess = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createProcess( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateAnalysisProgress with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes createProcess with call error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateProcessRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createProcess = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createProcess(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateAnalysisProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createProcess with LRO error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateProcessRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createProcess = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createProcess(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateAnalysis', () => { - it('invokes updateAnalysis without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateAnalysisRequest() - ); - request.analysis ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateAnalysisRequest', ['analysis', 'name']); - request.analysis.name = defaultValue1; - const expectedHeaderRequestParams = `analysis.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAnalysis = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateAnalysis(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateProcessProgress without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateProcessProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateAnalysis without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateAnalysisRequest() - ); - request.analysis ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateAnalysisRequest', ['analysis', 'name']); - request.analysis.name = defaultValue1; - const expectedHeaderRequestParams = `analysis.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateAnalysis = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAnalysis( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateProcessProgress with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateProcessProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateProcess', () => { + it('invokes updateProcess without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateProcessRequest(), + ); + request.process ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateProcessRequest', + ['process', 'name'], + ); + request.process.name = defaultValue1; + const expectedHeaderRequestParams = `process.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateProcess = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateProcess(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAnalysis with call error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateAnalysisRequest() - ); - request.analysis ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateAnalysisRequest', ['analysis', 'name']); - request.analysis.name = defaultValue1; - const expectedHeaderRequestParams = `analysis.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAnalysis = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateAnalysis(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateProcess without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateProcessRequest(), + ); + request.process ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateProcessRequest', + ['process', 'name'], + ); + request.process.name = defaultValue1; + const expectedHeaderRequestParams = `process.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateProcess = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateProcess( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IProcess, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAnalysis with LRO error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateAnalysisRequest() - ); - request.analysis ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateAnalysisRequest', ['analysis', 'name']); - request.analysis.name = defaultValue1; - const expectedHeaderRequestParams = `analysis.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAnalysis = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateAnalysis(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateProcess with call error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateProcessRequest(), + ); + request.process ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateProcessRequest', + ['process', 'name'], + ); + request.process.name = defaultValue1; + const expectedHeaderRequestParams = `process.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProcess = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateProcess(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateAnalysisProgress without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateAnalysisProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateProcess with LRO error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateProcessRequest(), + ); + request.process ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateProcessRequest', + ['process', 'name'], + ); + request.process.name = defaultValue1; + const expectedHeaderRequestParams = `process.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProcess = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateProcess(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateAnalysisProgress with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkUpdateProcessProgress without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateProcessProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateAnalysisProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateProcessProgress with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateProcessProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteProcess', () => { + it('invokes deleteProcess without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteProcessRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteProcess = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteProcess(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteAnalysis', () => { - it('invokes deleteAnalysis without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteAnalysisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteAnalysisRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAnalysis = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAnalysis(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteProcess without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteProcessRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteProcess = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteProcess( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAnalysis without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteAnalysisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteAnalysisRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAnalysis = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAnalysis( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteProcess with call error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteProcessRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProcess = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteProcess(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAnalysis with call error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteAnalysisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteAnalysisRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAnalysis = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAnalysis(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteProcess with LRO error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteProcessRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProcess = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteProcess(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAnalysis with LRO error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteAnalysisRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteAnalysisRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAnalysis = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAnalysis(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAnalysis as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAnalysis as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteProcessProgress without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteProcessProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteAnalysisProgress without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteAnalysisProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteProcessProgress with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteProcessProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('batchRunProcess', () => { + it('invokes batchRunProcess without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.BatchRunProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.BatchRunProcessRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.batchRunProcess = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchRunProcess(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchRunProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchRunProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteAnalysisProgress with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes batchRunProcess without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.BatchRunProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.BatchRunProcessRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.batchRunProcess = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchRunProcess( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IBatchRunProcessResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IBatchRunProcessResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchRunProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchRunProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAnalysisProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes batchRunProcess with call error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.BatchRunProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.BatchRunProcessRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchRunProcess = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.batchRunProcess(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchRunProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchRunProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createProcess', () => { - it('invokes createProcess without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateProcessRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createProcess = stubLongRunningCall(expectedResponse); - const [operation] = await client.createProcess(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes batchRunProcess with LRO error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.BatchRunProcessRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.BatchRunProcessRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchRunProcess = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.batchRunProcess(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchRunProcess as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchRunProcess as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createProcess without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateProcessRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createProcess = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createProcess( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkBatchRunProcessProgress without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchRunProcessProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createProcess with call error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateProcessRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createProcess = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createProcess(request), expectedError); - const actualRequest = (client.innerApiCalls.createProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkBatchRunProcessProgress with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkBatchRunProcessProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listPublicOperators', () => { + it('invokes listPublicOperators without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListPublicOperatorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListPublicOperatorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + ]; + client.innerApiCalls.listPublicOperators = + stubSimpleCall(expectedResponse); + const [response] = await client.listPublicOperators(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPublicOperators as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPublicOperators as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createProcess with LRO error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateProcessRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createProcess = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createProcess(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPublicOperators without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListPublicOperatorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListPublicOperatorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + ]; + client.innerApiCalls.listPublicOperators = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPublicOperators( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IOperator[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPublicOperators as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPublicOperators as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateProcessProgress without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateProcessProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes listPublicOperators with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListPublicOperatorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListPublicOperatorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPublicOperators = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listPublicOperators(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listPublicOperators as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPublicOperators as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateProcessProgress with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes listPublicOperatorsStream without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListPublicOperatorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListPublicOperatorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + ]; + client.descriptors.page.listPublicOperators.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listPublicOperatorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Operator[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Operator) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listPublicOperators.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listPublicOperators, request), + ); + assert( + (client.descriptors.page.listPublicOperators.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateProcessProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listPublicOperatorsStream with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListPublicOperatorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListPublicOperatorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPublicOperators.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listPublicOperatorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Operator[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Operator) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listPublicOperators.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listPublicOperators, request), + ); + assert( + (client.descriptors.page.listPublicOperators.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('updateProcess', () => { - it('invokes updateProcess without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateProcessRequest() - ); - request.process ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateProcessRequest', ['process', 'name']); - request.process.name = defaultValue1; - const expectedHeaderRequestParams = `process.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateProcess = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateProcess(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProcess without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateProcessRequest() - ); - request.process ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateProcessRequest', ['process', 'name']); - request.process.name = defaultValue1; - const expectedHeaderRequestParams = `process.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateProcess = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateProcess( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProcess with call error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateProcessRequest() - ); - request.process ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateProcessRequest', ['process', 'name']); - request.process.name = defaultValue1; - const expectedHeaderRequestParams = `process.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProcess = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateProcess(request), expectedError); - const actualRequest = (client.innerApiCalls.updateProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProcess with LRO error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateProcessRequest() - ); - request.process ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateProcessRequest', ['process', 'name']); - request.process.name = defaultValue1; - const expectedHeaderRequestParams = `process.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProcess = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateProcess(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateProcessProgress without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateProcessProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateProcessProgress with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateProcessProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with listPublicOperators without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListPublicOperatorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListPublicOperatorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + ]; + client.descriptors.page.listPublicOperators.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IOperator[] = []; + const iterable = client.listPublicOperatorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listPublicOperators.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listPublicOperators.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('deleteProcess', () => { - it('invokes deleteProcess without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteProcessRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteProcess = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteProcess(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProcess without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteProcessRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteProcess = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteProcess( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProcess with call error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteProcessRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteProcess = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteProcess(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProcess with LRO error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteProcessRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteProcess = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteProcess(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteProcessProgress without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteProcessProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteProcessProgress with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteProcessProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with listPublicOperators with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListPublicOperatorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListPublicOperatorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPublicOperators.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPublicOperatorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IOperator[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listPublicOperators.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listPublicOperators.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - - describe('batchRunProcess', () => { - it('invokes batchRunProcess without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.BatchRunProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.BatchRunProcessRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.batchRunProcess = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchRunProcess(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchRunProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchRunProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchRunProcess without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.BatchRunProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.BatchRunProcessRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.batchRunProcess = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchRunProcess( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchRunProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchRunProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchRunProcess with call error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.BatchRunProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.BatchRunProcessRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchRunProcess = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchRunProcess(request), expectedError); - const actualRequest = (client.innerApiCalls.batchRunProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchRunProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchRunProcess with LRO error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.BatchRunProcessRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.BatchRunProcessRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchRunProcess = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchRunProcess(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchRunProcess as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchRunProcess as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkBatchRunProcessProgress without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchRunProcessProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchRunProcessProgress with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchRunProcessProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + }); + + describe('listOperators', () => { + it('invokes listOperators without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListOperatorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListOperatorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + ]; + client.innerApiCalls.listOperators = stubSimpleCall(expectedResponse); + const [response] = await client.listOperators(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listOperators as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listOperators as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listPublicOperators', () => { - it('invokes listPublicOperators without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListPublicOperatorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListPublicOperatorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - ]; - client.innerApiCalls.listPublicOperators = stubSimpleCall(expectedResponse); - const [response] = await client.listPublicOperators(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPublicOperators as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPublicOperators as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPublicOperators without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListPublicOperatorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListPublicOperatorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - ]; - client.innerApiCalls.listPublicOperators = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPublicOperators( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IOperator[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPublicOperators as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPublicOperators as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPublicOperators with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListPublicOperatorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListPublicOperatorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPublicOperators = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPublicOperators(request), expectedError); - const actualRequest = (client.innerApiCalls.listPublicOperators as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPublicOperators as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPublicOperatorsStream without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListPublicOperatorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListPublicOperatorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - ]; - client.descriptors.page.listPublicOperators.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPublicOperatorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Operator[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Operator) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listPublicOperators.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPublicOperators, request)); - assert( - (client.descriptors.page.listPublicOperators.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPublicOperatorsStream with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListPublicOperatorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListPublicOperatorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listPublicOperators.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPublicOperatorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Operator[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Operator) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPublicOperators.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPublicOperators, request)); - assert( - (client.descriptors.page.listPublicOperators.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPublicOperators without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListPublicOperatorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListPublicOperatorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - ]; - client.descriptors.page.listPublicOperators.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IOperator[] = []; - const iterable = client.listPublicOperatorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listOperators without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListOperatorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListOperatorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + ]; + client.innerApiCalls.listOperators = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listOperators( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IOperator[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPublicOperators.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPublicOperators.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPublicOperators with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListPublicOperatorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListPublicOperatorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listPublicOperators.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPublicOperatorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IOperator[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPublicOperators.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPublicOperators.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listOperators as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listOperators as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listOperators', () => { - it('invokes listOperators without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListOperatorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListOperatorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - ]; - client.innerApiCalls.listOperators = stubSimpleCall(expectedResponse); - const [response] = await client.listOperators(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listOperators as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOperators as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listOperators with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListOperatorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListOperatorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listOperators = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listOperators(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listOperators as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listOperators as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listOperators without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListOperatorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListOperatorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - ]; - client.innerApiCalls.listOperators = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listOperators( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IOperator[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listOperators as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOperators as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listOperatorsStream without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListOperatorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListOperatorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + ]; + client.descriptors.page.listOperators.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listOperatorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Operator[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Operator) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listOperators.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listOperators, request), + ); + assert( + (client.descriptors.page.listOperators.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listOperators with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListOperatorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListOperatorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listOperators = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listOperators(request), expectedError); - const actualRequest = (client.innerApiCalls.listOperators as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listOperators as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listOperatorsStream with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListOperatorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListOperatorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listOperators.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listOperatorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Operator[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Operator) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listOperators.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listOperators, request), + ); + assert( + (client.descriptors.page.listOperators.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listOperatorsStream without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListOperatorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListOperatorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - ]; - client.descriptors.page.listOperators.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listOperatorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Operator[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Operator) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listOperators.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listOperators, request)); - assert( - (client.descriptors.page.listOperators.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listOperators without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListOperatorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListOperatorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), + ]; + client.descriptors.page.listOperators.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IOperator[] = []; + const iterable = client.listOperatorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listOperators.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listOperators.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listOperatorsStream with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListOperatorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListOperatorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listOperators.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listOperatorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Operator[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Operator) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listOperators.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listOperators, request)); - assert( - (client.descriptors.page.listOperators.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listOperators with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListOperatorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListOperatorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listOperators.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listOperatorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IOperator[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listOperators.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listOperators.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listAnalyses', () => { + it('invokes listAnalyses without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAnalysesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAnalysesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), + ]; + client.innerApiCalls.listAnalyses = stubSimpleCall(expectedResponse); + const [response] = await client.listAnalyses(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAnalyses as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAnalyses as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listOperators without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListOperatorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListOperatorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Operator()), - ]; - client.descriptors.page.listOperators.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IOperator[] = []; - const iterable = client.listOperatorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listAnalyses without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAnalysesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAnalysesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), + ]; + client.innerApiCalls.listAnalyses = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAnalyses( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IAnalysis[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listOperators.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listOperators.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listOperators with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListOperatorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListOperatorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listOperators.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listOperatorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IOperator[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listOperators.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listOperators.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAnalyses as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAnalyses as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listAnalyses', () => { - it('invokes listAnalyses without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAnalysesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAnalysesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), - ]; - client.innerApiCalls.listAnalyses = stubSimpleCall(expectedResponse); - const [response] = await client.listAnalyses(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAnalyses as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAnalyses as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAnalyses with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAnalysesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAnalysesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAnalyses = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listAnalyses(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listAnalyses as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAnalyses as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listAnalyses without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAnalysesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAnalysesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), - ]; - client.innerApiCalls.listAnalyses = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAnalyses( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IAnalysis[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAnalyses as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAnalyses as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAnalysesStream without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAnalysesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAnalysesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), + ]; + client.descriptors.page.listAnalyses.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAnalysesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Analysis[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Analysis) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listAnalyses.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAnalyses, request), + ); + assert( + (client.descriptors.page.listAnalyses.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listAnalyses with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAnalysesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAnalysesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAnalyses = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAnalyses(request), expectedError); - const actualRequest = (client.innerApiCalls.listAnalyses as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAnalyses as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAnalysesStream with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAnalysesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAnalysesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAnalyses.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listAnalysesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Analysis[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Analysis) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAnalyses.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAnalyses, request), + ); + assert( + (client.descriptors.page.listAnalyses.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listAnalysesStream without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAnalysesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAnalysesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), - ]; - client.descriptors.page.listAnalyses.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAnalysesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Analysis[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Analysis) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAnalyses.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAnalyses, request)); - assert( - (client.descriptors.page.listAnalyses.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAnalyses without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAnalysesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAnalysesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), + ]; + client.descriptors.page.listAnalyses.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IAnalysis[] = []; + const iterable = client.listAnalysesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAnalyses.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listAnalyses.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listAnalysesStream with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAnalysesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAnalysesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAnalyses.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAnalysesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Analysis[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Analysis) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAnalyses.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAnalyses, request)); - assert( - (client.descriptors.page.listAnalyses.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAnalyses with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAnalysesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAnalysesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAnalyses.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAnalysesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IAnalysis[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAnalyses.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listAnalyses.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listProcesses', () => { + it('invokes listProcesses without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListProcessesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListProcessesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), + ]; + client.innerApiCalls.listProcesses = stubSimpleCall(expectedResponse); + const [response] = await client.listProcesses(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listProcesses as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcesses as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listAnalyses without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAnalysesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAnalysesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Analysis()), - ]; - client.descriptors.page.listAnalyses.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IAnalysis[] = []; - const iterable = client.listAnalysesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listProcesses without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListProcessesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListProcessesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), + ]; + client.innerApiCalls.listProcesses = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProcesses( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IProcess[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAnalyses.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAnalyses.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAnalyses with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAnalysesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAnalysesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAnalyses.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAnalysesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IAnalysis[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAnalyses.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAnalyses.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listProcesses as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcesses as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listProcesses', () => { - it('invokes listProcesses without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListProcessesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListProcessesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), - ]; - client.innerApiCalls.listProcesses = stubSimpleCall(expectedResponse); - const [response] = await client.listProcesses(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listProcesses as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listProcesses as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProcesses without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListProcessesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListProcessesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), - ]; - client.innerApiCalls.listProcesses = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listProcesses( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IProcess[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listProcesses as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listProcesses as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProcesses with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListProcessesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListProcessesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listProcesses = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listProcesses(request), expectedError); - const actualRequest = (client.innerApiCalls.listProcesses as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listProcesses as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listProcesses with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListProcessesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListProcessesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listProcesses = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listProcesses(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listProcesses as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcesses as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listProcessesStream without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListProcessesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListProcessesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), - ]; - client.descriptors.page.listProcesses.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listProcessesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Process[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Process) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listProcesses.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listProcesses, request)); - assert( - (client.descriptors.page.listProcesses.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listProcessesStream without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListProcessesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListProcessesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), + ]; + client.descriptors.page.listProcesses.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProcessesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Process[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Process) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listProcesses.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcesses, request), + ); + assert( + (client.descriptors.page.listProcesses.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listProcessesStream with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListProcessesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListProcessesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listProcesses.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listProcessesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Process[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Process) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listProcesses.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listProcesses, request)); - assert( - (client.descriptors.page.listProcesses.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listProcessesStream with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListProcessesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListProcessesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listProcesses.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listProcessesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Process[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Process) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listProcesses.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcesses, request), + ); + assert( + (client.descriptors.page.listProcesses.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listProcesses without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListProcessesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListProcessesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), - ]; - client.descriptors.page.listProcesses.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IProcess[] = []; - const iterable = client.listProcessesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listProcesses.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listProcesses.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listProcesses without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListProcessesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListProcessesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Process()), + ]; + client.descriptors.page.listProcesses.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IProcess[] = []; + const iterable = client.listProcessesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcesses.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listProcesses.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listProcesses with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListProcessesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListProcessesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listProcesses.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProcessesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IProcess[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listProcesses.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listProcesses.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listProcesses with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListProcessesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListProcessesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listProcesses.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProcessesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IProcess[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcesses.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listProcesses.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.getIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .getIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getIamPolicy(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.setIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .setIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('invokes setIamPolicy with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.setIamPolicy(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse(), + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions( + request, + expectedOptions, + ); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse(), + ); + client.iamClient.testIamPermissions = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .testIamPermissions( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.TestIamPermissionsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes testIamPermissions with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.testIamPermissions(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.IOperation[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.IOperation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + }); + + describe('Path templates', () => { + describe('analysis', async () => { + const fakePath = '/rendered/path/analysis'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + analysis: 'analysisValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.analysisPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.analysisPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('analysisPath', () => { + const result = client.analysisPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'analysisValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.analysisPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAnalysisName', () => { + const result = client.matchProjectFromAnalysisName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAnalysisName', () => { + const result = client.matchLocationFromAnalysisName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromAnalysisName', () => { + const result = client.matchClusterFromAnalysisName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAnalysisFromAnalysisName', () => { + const result = client.matchAnalysisFromAnalysisName(fakePath); + assert.strictEqual(result, 'analysisValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('analysis', async () => { - const fakePath = "/rendered/path/analysis"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - analysis: "analysisValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.analysisPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.analysisPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('analysisPath', () => { - const result = client.analysisPath("projectValue", "locationValue", "clusterValue", "analysisValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.analysisPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAnalysisName', () => { - const result = client.matchProjectFromAnalysisName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAnalysisName', () => { - const result = client.matchLocationFromAnalysisName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromAnalysisName', () => { - const result = client.matchClusterFromAnalysisName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnalysisFromAnalysisName', () => { - const result = client.matchAnalysisFromAnalysisName(fakePath); - assert.strictEqual(result, "analysisValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('annotation', async () => { - const fakePath = "/rendered/path/annotation"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - asset: "assetValue", - annotation: "annotationValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.annotationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.annotationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('annotationPath', () => { - const result = client.annotationPath("projectNumberValue", "locationValue", "corpusValue", "assetValue", "annotationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.annotationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromAnnotationName', () => { - const result = client.matchProjectNumberFromAnnotationName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAnnotationName', () => { - const result = client.matchLocationFromAnnotationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromAnnotationName', () => { - const result = client.matchCorpusFromAnnotationName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAnnotationName', () => { - const result = client.matchAssetFromAnnotationName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnnotationFromAnnotationName', () => { - const result = client.matchAnnotationFromAnnotationName(fakePath); - assert.strictEqual(result, "annotationValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('application', async () => { - const fakePath = "/rendered/path/application"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.applicationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.applicationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('applicationPath', () => { - const result = client.applicationPath("projectValue", "locationValue", "applicationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.applicationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApplicationName', () => { - const result = client.matchProjectFromApplicationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApplicationName', () => { - const result = client.matchLocationFromApplicationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromApplicationName', () => { - const result = client.matchApplicationFromApplicationName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('asset', async () => { - const fakePath = "/rendered/path/asset"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - asset: "assetValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.assetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.assetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('assetPath', () => { - const result = client.assetPath("projectNumberValue", "locationValue", "corpusValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.assetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromAssetName', () => { - const result = client.matchProjectNumberFromAssetName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAssetName', () => { - const result = client.matchLocationFromAssetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromAssetName', () => { - const result = client.matchCorpusFromAssetName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAssetName', () => { - const result = client.matchAssetFromAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('channel', async () => { - const fakePath = "/rendered/path/channel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - channel: "channelValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.channelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.channelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('channelPath', () => { - const result = client.channelPath("projectValue", "locationValue", "clusterValue", "channelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.channelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromChannelName', () => { - const result = client.matchProjectFromChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromChannelName', () => { - const result = client.matchLocationFromChannelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromChannelName', () => { - const result = client.matchClusterFromChannelName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelFromChannelName', () => { - const result = client.matchChannelFromChannelName(fakePath); - assert.strictEqual(result, "channelValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('cluster', async () => { - const fakePath = "/rendered/path/cluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clusterPath', () => { - const result = client.clusterPath("projectValue", "locationValue", "clusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClusterName', () => { - const result = client.matchProjectFromClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClusterName', () => { - const result = client.matchLocationFromClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromClusterName', () => { - const result = client.matchClusterFromClusterName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('collection', async () => { - const fakePath = "/rendered/path/collection"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - collection: "collectionValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.collectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.collectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('collectionPath', () => { - const result = client.collectionPath("projectNumberValue", "locationValue", "corpusValue", "collectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.collectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromCollectionName', () => { - const result = client.matchProjectNumberFromCollectionName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCollectionName', () => { - const result = client.matchLocationFromCollectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromCollectionName', () => { - const result = client.matchCorpusFromCollectionName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCollectionFromCollectionName', () => { - const result = client.matchCollectionFromCollectionName(fakePath); - assert.strictEqual(result, "collectionValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('corpus', async () => { - const fakePath = "/rendered/path/corpus"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.corpusPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.corpusPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('corpusPath', () => { - const result = client.corpusPath("projectNumberValue", "locationValue", "corpusValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.corpusPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromCorpusName', () => { - const result = client.matchProjectNumberFromCorpusName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCorpusName', () => { - const result = client.matchLocationFromCorpusName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromCorpusName', () => { - const result = client.matchCorpusFromCorpusName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('dataSchema', async () => { - const fakePath = "/rendered/path/dataSchema"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - data_schema: "dataSchemaValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dataSchemaPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dataSchemaPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dataSchemaPath', () => { - const result = client.dataSchemaPath("projectNumberValue", "locationValue", "corpusValue", "dataSchemaValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dataSchemaPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromDataSchemaName', () => { - const result = client.matchProjectNumberFromDataSchemaName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDataSchemaName', () => { - const result = client.matchLocationFromDataSchemaName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromDataSchemaName', () => { - const result = client.matchCorpusFromDataSchemaName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDataSchemaFromDataSchemaName', () => { - const result = client.matchDataSchemaFromDataSchemaName(fakePath); - assert.strictEqual(result, "dataSchemaValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('draft', async () => { - const fakePath = "/rendered/path/draft"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - draft: "draftValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.draftPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.draftPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('draftPath', () => { - const result = client.draftPath("projectValue", "locationValue", "applicationValue", "draftValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.draftPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDraftName', () => { - const result = client.matchProjectFromDraftName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDraftName', () => { - const result = client.matchLocationFromDraftName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromDraftName', () => { - const result = client.matchApplicationFromDraftName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDraftFromDraftName', () => { - const result = client.matchDraftFromDraftName(fakePath); - assert.strictEqual(result, "draftValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('event', async () => { - const fakePath = "/rendered/path/event"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - event: "eventValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.eventPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.eventPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('eventPath', () => { - const result = client.eventPath("projectValue", "locationValue", "clusterValue", "eventValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.eventPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromEventName', () => { - const result = client.matchProjectFromEventName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromEventName', () => { - const result = client.matchLocationFromEventName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromEventName', () => { - const result = client.matchClusterFromEventName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEventFromEventName', () => { - const result = client.matchEventFromEventName(fakePath); - assert.strictEqual(result, "eventValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('index', async () => { - const fakePath = "/rendered/path/index"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - index: "indexValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.indexPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.indexPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('indexPath', () => { - const result = client.indexPath("projectNumberValue", "locationValue", "corpusValue", "indexValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.indexPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromIndexName', () => { - const result = client.matchProjectNumberFromIndexName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromIndexName', () => { - const result = client.matchLocationFromIndexName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromIndexName', () => { - const result = client.matchCorpusFromIndexName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIndexFromIndexName', () => { - const result = client.matchIndexFromIndexName(fakePath); - assert.strictEqual(result, "indexValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('indexEndpoint', async () => { - const fakePath = "/rendered/path/indexEndpoint"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - index_endpoint: "indexEndpointValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.indexEndpointPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.indexEndpointPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('indexEndpointPath', () => { - const result = client.indexEndpointPath("projectValue", "locationValue", "indexEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.indexEndpointPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromIndexEndpointName', () => { - const result = client.matchProjectFromIndexEndpointName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromIndexEndpointName', () => { - const result = client.matchLocationFromIndexEndpointName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIndexEndpointFromIndexEndpointName', () => { - const result = client.matchIndexEndpointFromIndexEndpointName(fakePath); - assert.strictEqual(result, "indexEndpointValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('instance', async () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - instance: "instanceValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "applicationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromInstanceName', () => { - const result = client.matchApplicationFromInstanceName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('operator', async () => { - const fakePath = "/rendered/path/operator"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - operator: "operatorValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.operatorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.operatorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('operatorPath', () => { - const result = client.operatorPath("projectValue", "locationValue", "operatorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.operatorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromOperatorName', () => { - const result = client.matchProjectFromOperatorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOperatorName', () => { - const result = client.matchLocationFromOperatorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchOperatorFromOperatorName', () => { - const result = client.matchOperatorFromOperatorName(fakePath); - assert.strictEqual(result, "operatorValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('process', async () => { - const fakePath = "/rendered/path/process"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - process: "processValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.processPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.processPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('processPath', () => { - const result = client.processPath("projectValue", "locationValue", "clusterValue", "processValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.processPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProcessName', () => { - const result = client.matchProjectFromProcessName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProcessName', () => { - const result = client.matchLocationFromProcessName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromProcessName', () => { - const result = client.matchClusterFromProcessName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProcessFromProcessName', () => { - const result = client.matchProcessFromProcessName(fakePath); - assert.strictEqual(result, "processValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('processor', async () => { - const fakePath = "/rendered/path/processor"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - processor: "processorValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.processorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.processorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('processorPath', () => { - const result = client.processorPath("projectValue", "locationValue", "processorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.processorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProcessorName', () => { - const result = client.matchProjectFromProcessorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProcessorName', () => { - const result = client.matchLocationFromProcessorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProcessorFromProcessorName', () => { - const result = client.matchProcessorFromProcessorName(fakePath); - assert.strictEqual(result, "processorValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('annotation', async () => { + const fakePath = '/rendered/path/annotation'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + asset: 'assetValue', + annotation: 'annotationValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.annotationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.annotationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('annotationPath', () => { + const result = client.annotationPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'assetValue', + 'annotationValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.annotationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromAnnotationName', () => { + const result = client.matchProjectNumberFromAnnotationName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAnnotationName', () => { + const result = client.matchLocationFromAnnotationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromAnnotationName', () => { + const result = client.matchCorpusFromAnnotationName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAssetFromAnnotationName', () => { + const result = client.matchAssetFromAnnotationName(fakePath); + assert.strictEqual(result, 'assetValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAnnotationFromAnnotationName', () => { + const result = client.matchAnnotationFromAnnotationName(fakePath); + assert.strictEqual(result, 'annotationValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('searchConfig', async () => { - const fakePath = "/rendered/path/searchConfig"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - search_config: "searchConfigValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.searchConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.searchConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('searchConfigPath', () => { - const result = client.searchConfigPath("projectNumberValue", "locationValue", "corpusValue", "searchConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.searchConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('application', async () => { + const fakePath = '/rendered/path/application'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.applicationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.applicationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('applicationPath', () => { + const result = client.applicationPath( + 'projectValue', + 'locationValue', + 'applicationValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.applicationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromApplicationName', () => { + const result = client.matchProjectFromApplicationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromApplicationName', () => { + const result = client.matchLocationFromApplicationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromApplicationName', () => { + const result = client.matchApplicationFromApplicationName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectNumberFromSearchConfigName', () => { - const result = client.matchProjectNumberFromSearchConfigName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('asset', async () => { + const fakePath = '/rendered/path/asset'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + asset: 'assetValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.assetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.assetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('assetPath', () => { + const result = client.assetPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'assetValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.assetPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromAssetName', () => { + const result = client.matchProjectNumberFromAssetName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAssetName', () => { + const result = client.matchLocationFromAssetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromAssetName', () => { + const result = client.matchCorpusFromAssetName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAssetFromAssetName', () => { + const result = client.matchAssetFromAssetName(fakePath); + assert.strictEqual(result, 'assetValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSearchConfigName', () => { - const result = client.matchLocationFromSearchConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('channel', async () => { + const fakePath = '/rendered/path/channel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + channel: 'channelValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.channelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.channelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('channelPath', () => { + const result = client.channelPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'channelValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.channelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromChannelName', () => { + const result = client.matchProjectFromChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromChannelName', () => { + const result = client.matchLocationFromChannelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromChannelName', () => { + const result = client.matchClusterFromChannelName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, 'channelValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchCorpusFromSearchConfigName', () => { - const result = client.matchCorpusFromSearchConfigName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('cluster', async () => { + const fakePath = '/rendered/path/cluster'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clusterPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clusterPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clusterPath', () => { + const result = client.clusterPath( + 'projectValue', + 'locationValue', + 'clusterValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clusterPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClusterName', () => { + const result = client.matchProjectFromClusterName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClusterName', () => { + const result = client.matchLocationFromClusterName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromClusterName', () => { + const result = client.matchClusterFromClusterName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSearchConfigFromSearchConfigName', () => { - const result = client.matchSearchConfigFromSearchConfigName(fakePath); - assert.strictEqual(result, "searchConfigValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('collection', async () => { + const fakePath = '/rendered/path/collection'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + collection: 'collectionValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.collectionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.collectionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('collectionPath', () => { + const result = client.collectionPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'collectionValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.collectionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromCollectionName', () => { + const result = client.matchProjectNumberFromCollectionName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCollectionName', () => { + const result = client.matchLocationFromCollectionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromCollectionName', () => { + const result = client.matchCorpusFromCollectionName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCollectionFromCollectionName', () => { + const result = client.matchCollectionFromCollectionName(fakePath); + assert.strictEqual(result, 'collectionValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('searchHypernym', async () => { - const fakePath = "/rendered/path/searchHypernym"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - search_hypernym: "searchHypernymValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.searchHypernymPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.searchHypernymPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('searchHypernymPath', () => { - const result = client.searchHypernymPath("projectNumberValue", "locationValue", "corpusValue", "searchHypernymValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.searchHypernymPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('corpus', async () => { + const fakePath = '/rendered/path/corpus'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.corpusPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.corpusPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('corpusPath', () => { + const result = client.corpusPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.corpusPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromCorpusName', () => { + const result = client.matchProjectNumberFromCorpusName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCorpusName', () => { + const result = client.matchLocationFromCorpusName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromCorpusName', () => { + const result = client.matchCorpusFromCorpusName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectNumberFromSearchHypernymName', () => { - const result = client.matchProjectNumberFromSearchHypernymName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('dataSchema', async () => { + const fakePath = '/rendered/path/dataSchema'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + data_schema: 'dataSchemaValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dataSchemaPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dataSchemaPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dataSchemaPath', () => { + const result = client.dataSchemaPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'dataSchemaValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.dataSchemaPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromDataSchemaName', () => { + const result = client.matchProjectNumberFromDataSchemaName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDataSchemaName', () => { + const result = client.matchLocationFromDataSchemaName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromDataSchemaName', () => { + const result = client.matchCorpusFromDataSchemaName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataSchemaFromDataSchemaName', () => { + const result = client.matchDataSchemaFromDataSchemaName(fakePath); + assert.strictEqual(result, 'dataSchemaValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSearchHypernymName', () => { - const result = client.matchLocationFromSearchHypernymName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('draft', async () => { + const fakePath = '/rendered/path/draft'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + draft: 'draftValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.draftPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.draftPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('draftPath', () => { + const result = client.draftPath( + 'projectValue', + 'locationValue', + 'applicationValue', + 'draftValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.draftPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDraftName', () => { + const result = client.matchProjectFromDraftName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDraftName', () => { + const result = client.matchLocationFromDraftName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromDraftName', () => { + const result = client.matchApplicationFromDraftName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDraftFromDraftName', () => { + const result = client.matchDraftFromDraftName(fakePath); + assert.strictEqual(result, 'draftValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchCorpusFromSearchHypernymName', () => { - const result = client.matchCorpusFromSearchHypernymName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('event', async () => { + const fakePath = '/rendered/path/event'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + event: 'eventValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.eventPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.eventPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('eventPath', () => { + const result = client.eventPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'eventValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.eventPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromEventName', () => { + const result = client.matchProjectFromEventName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromEventName', () => { + const result = client.matchLocationFromEventName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromEventName', () => { + const result = client.matchClusterFromEventName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchEventFromEventName', () => { + const result = client.matchEventFromEventName(fakePath); + assert.strictEqual(result, 'eventValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSearchHypernymFromSearchHypernymName', () => { - const result = client.matchSearchHypernymFromSearchHypernymName(fakePath); - assert.strictEqual(result, "searchHypernymValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('index', async () => { + const fakePath = '/rendered/path/index'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + index: 'indexValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.indexPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.indexPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('indexPath', () => { + const result = client.indexPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'indexValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.indexPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromIndexName', () => { + const result = client.matchProjectNumberFromIndexName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromIndexName', () => { + const result = client.matchLocationFromIndexName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromIndexName', () => { + const result = client.matchCorpusFromIndexName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchIndexFromIndexName', () => { + const result = client.matchIndexFromIndexName(fakePath); + assert.strictEqual(result, 'indexValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('series', async () => { - const fakePath = "/rendered/path/series"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - series: "seriesValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.seriesPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.seriesPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('seriesPath', () => { - const result = client.seriesPath("projectValue", "locationValue", "clusterValue", "seriesValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.seriesPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('indexEndpoint', async () => { + const fakePath = '/rendered/path/indexEndpoint'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + index_endpoint: 'indexEndpointValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.indexEndpointPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.indexEndpointPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('indexEndpointPath', () => { + const result = client.indexEndpointPath( + 'projectValue', + 'locationValue', + 'indexEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.indexEndpointPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromIndexEndpointName', () => { + const result = client.matchProjectFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromIndexEndpointName', () => { + const result = client.matchLocationFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchIndexEndpointFromIndexEndpointName', () => { + const result = client.matchIndexEndpointFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'indexEndpointValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromSeriesName', () => { - const result = client.matchProjectFromSeriesName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('instance', async () => { + const fakePath = '/rendered/path/instance'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + instance: 'instanceValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.instancePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.instancePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath( + 'projectValue', + 'locationValue', + 'applicationValue', + 'instanceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInstanceName', () => { + const result = client.matchLocationFromInstanceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromInstanceName', () => { + const result = client.matchApplicationFromInstanceName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, 'instanceValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromSeriesName', () => { - const result = client.matchLocationFromSeriesName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchClusterFromSeriesName', () => { - const result = client.matchClusterFromSeriesName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('operator', async () => { + const fakePath = '/rendered/path/operator'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + operator: 'operatorValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.operatorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.operatorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('operatorPath', () => { + const result = client.operatorPath( + 'projectValue', + 'locationValue', + 'operatorValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.operatorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromOperatorName', () => { + const result = client.matchProjectFromOperatorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOperatorName', () => { + const result = client.matchLocationFromOperatorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchOperatorFromOperatorName', () => { + const result = client.matchOperatorFromOperatorName(fakePath); + assert.strictEqual(result, 'operatorValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchSeriesFromSeriesName', () => { - const result = client.matchSeriesFromSeriesName(fakePath); - assert.strictEqual(result, "seriesValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('process', async () => { + const fakePath = '/rendered/path/process'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + process: 'processValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.processPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processPath', () => { + const result = client.processPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'processValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProcessName', () => { + const result = client.matchProjectFromProcessName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProcessName', () => { + const result = client.matchLocationFromProcessName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromProcessName', () => { + const result = client.matchClusterFromProcessName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchProcessFromProcessName', () => { + const result = client.matchProcessFromProcessName(fakePath); + assert.strictEqual(result, 'processValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('stream', async () => { - const fakePath = "/rendered/path/stream"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - stream: "streamValue", - }; - const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.streamPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.streamPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('streamPath', () => { - const result = client.streamPath("projectValue", "locationValue", "clusterValue", "streamValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.streamPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('processor', async () => { + const fakePath = '/rendered/path/processor'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor: 'processorValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.processorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processorPath', () => { + const result = client.processorPath( + 'projectValue', + 'locationValue', + 'processorValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProcessorName', () => { + const result = client.matchProjectFromProcessorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProcessorName', () => { + const result = client.matchLocationFromProcessorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchProcessorFromProcessorName', () => { + const result = client.matchProcessorFromProcessorName(fakePath); + assert.strictEqual(result, 'processorValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchProjectFromStreamName', () => { - const result = client.matchProjectFromStreamName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('searchConfig', async () => { + const fakePath = '/rendered/path/searchConfig'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + search_config: 'searchConfigValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.searchConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.searchConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('searchConfigPath', () => { + const result = client.searchConfigPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'searchConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.searchConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromSearchConfigName', () => { + const result = client.matchProjectNumberFromSearchConfigName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSearchConfigName', () => { + const result = client.matchLocationFromSearchConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromSearchConfigName', () => { + const result = client.matchCorpusFromSearchConfigName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSearchConfigFromSearchConfigName', () => { + const result = client.matchSearchConfigFromSearchConfigName(fakePath); + assert.strictEqual(result, 'searchConfigValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchLocationFromStreamName', () => { - const result = client.matchLocationFromStreamName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('searchHypernym', async () => { + const fakePath = '/rendered/path/searchHypernym'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + search_hypernym: 'searchHypernymValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.searchHypernymPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.searchHypernymPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('searchHypernymPath', () => { + const result = client.searchHypernymPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'searchHypernymValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.searchHypernymPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromSearchHypernymName', () => { + const result = + client.matchProjectNumberFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSearchHypernymName', () => { + const result = client.matchLocationFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromSearchHypernymName', () => { + const result = client.matchCorpusFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSearchHypernymFromSearchHypernymName', () => { + const result = + client.matchSearchHypernymFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'searchHypernymValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchClusterFromStreamName', () => { - const result = client.matchClusterFromStreamName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('series', async () => { + const fakePath = '/rendered/path/series'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + series: 'seriesValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.seriesPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.seriesPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('seriesPath', () => { + const result = client.seriesPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'seriesValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.seriesPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSeriesName', () => { + const result = client.matchProjectFromSeriesName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSeriesName', () => { + const result = client.matchLocationFromSeriesName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromSeriesName', () => { + const result = client.matchClusterFromSeriesName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSeriesFromSeriesName', () => { + const result = client.matchSeriesFromSeriesName(fakePath); + assert.strictEqual(result, 'seriesValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchStreamFromStreamName', () => { - const result = client.matchStreamFromStreamName(fakePath); - assert.strictEqual(result, "streamValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('stream', async () => { + const fakePath = '/rendered/path/stream'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + stream: 'streamValue', + }; + const client = new livevideoanalyticsModule.v1.LiveVideoAnalyticsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.streamPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.streamPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('streamPath', () => { + const result = client.streamPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'streamValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.streamPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromStreamName', () => { + const result = client.matchProjectFromStreamName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromStreamName', () => { + const result = client.matchLocationFromStreamName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromStreamName', () => { + const result = client.matchClusterFromStreamName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchStreamFromStreamName', () => { + const result = client.matchStreamFromStreamName(fakePath); + assert.strictEqual(result, 'streamValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-visionai/test/gapic_streaming_service_v1.ts b/packages/google-cloud-visionai/test/gapic_streaming_service_v1.ts index c9cfc17ccd8c..a7fdea59eb4a 100644 --- a/packages/google-cloud-visionai/test/gapic_streaming_service_v1.ts +++ b/packages/google-cloud-visionai/test/gapic_streaming_service_v1.ts @@ -19,2282 +19,3012 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as streamingserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, IamProtos, LocationProtos} from 'google-gax'; +import { protobuf, IamProtos, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); +function stubBidiStreamingCall( + response?: ResponseType, + error?: Error, +) { + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.StreamingServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new streamingserviceModule.v1.StreamingServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new streamingserviceModule.v1.StreamingServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = streamingserviceModule.v1.StreamingServiceClient.servicePath; - assert.strictEqual(servicePath, 'warehouse-visionai.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = streamingserviceModule.v1.StreamingServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new streamingserviceModule.v1.StreamingServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new streamingserviceModule.v1.StreamingServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new streamingserviceModule.v1.StreamingServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = streamingserviceModule.v1.StreamingServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new streamingserviceModule.v1.StreamingServiceClient(); - assert(client); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new streamingserviceModule.v1.StreamingServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); + }); - it('should create a client with gRPC fallback', () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - fallback: true, - }); - assert(client); - }); + it('has universeDomain', () => { + const client = new streamingserviceModule.v1.StreamingServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.streamingServiceStub, undefined); - await client.initialize(); - assert(client.streamingServiceStub); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + streamingserviceModule.v1.StreamingServiceClient.servicePath; + assert.strictEqual(servicePath, 'warehouse-visionai.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + streamingserviceModule.v1.StreamingServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + }); - it('has close method for the initialized client', done => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.streamingServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + }); - it('has close method for the non-initialized client', done => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.streamingServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new streamingserviceModule.v1.StreamingServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'warehouse-visionai.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new streamingserviceModule.v1.StreamingServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + it('has port', () => { + const port = streamingserviceModule.v1.StreamingServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('should create a client with no option', () => { + const client = new streamingserviceModule.v1.StreamingServiceClient(); + assert(client); }); - describe('acquireLease', () => { - it('invokes acquireLease without error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AcquireLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AcquireLeaseRequest', ['series']); - request.series = defaultValue1; - const expectedHeaderRequestParams = `series=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Lease() - ); - client.innerApiCalls.acquireLease = stubSimpleCall(expectedResponse); - const [response] = await client.acquireLease(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.acquireLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acquireLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + fallback: true, + }); + assert(client); + }); - it('invokes acquireLease without error using callback', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AcquireLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AcquireLeaseRequest', ['series']); - request.series = defaultValue1; - const expectedHeaderRequestParams = `series=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Lease() - ); - client.innerApiCalls.acquireLease = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.acquireLease( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ILease|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.acquireLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acquireLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.streamingServiceStub, undefined); + await client.initialize(); + assert(client.streamingServiceStub); + }); - it('invokes acquireLease with error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AcquireLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AcquireLeaseRequest', ['series']); - request.series = defaultValue1; - const expectedHeaderRequestParams = `series=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.acquireLease = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.acquireLease(request), expectedError); - const actualRequest = (client.innerApiCalls.acquireLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acquireLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.streamingServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes acquireLease with closed client', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AcquireLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AcquireLeaseRequest', ['series']); - request.series = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.acquireLease(request), expectedError); + it('has close method for the non-initialized client', (done) => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.streamingServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('renewLease', () => { - it('invokes renewLease without error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RenewLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RenewLeaseRequest', ['series']); - request.series = defaultValue1; - const expectedHeaderRequestParams = `series=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Lease() - ); - client.innerApiCalls.renewLease = stubSimpleCall(expectedResponse); - const [response] = await client.renewLease(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.renewLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.renewLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes renewLease without error using callback', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RenewLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RenewLeaseRequest', ['series']); - request.series = defaultValue1; - const expectedHeaderRequestParams = `series=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Lease() - ); - client.innerApiCalls.renewLease = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.renewLease( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ILease|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.renewLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.renewLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('acquireLease', () => { + it('invokes acquireLease without error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AcquireLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AcquireLeaseRequest', + ['series'], + ); + request.series = defaultValue1; + const expectedHeaderRequestParams = `series=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Lease(), + ); + client.innerApiCalls.acquireLease = stubSimpleCall(expectedResponse); + const [response] = await client.acquireLease(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.acquireLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes renewLease with error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RenewLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RenewLeaseRequest', ['series']); - request.series = defaultValue1; - const expectedHeaderRequestParams = `series=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.renewLease = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.renewLease(request), expectedError); - const actualRequest = (client.innerApiCalls.renewLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.renewLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes acquireLease without error using callback', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AcquireLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AcquireLeaseRequest', + ['series'], + ); + request.series = defaultValue1; + const expectedHeaderRequestParams = `series=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Lease(), + ); + client.innerApiCalls.acquireLease = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.acquireLease( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ILease | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.acquireLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes renewLease with closed client', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RenewLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RenewLeaseRequest', ['series']); - request.series = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.renewLease(request), expectedError); - }); + it('invokes acquireLease with error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AcquireLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AcquireLeaseRequest', + ['series'], + ); + request.series = defaultValue1; + const expectedHeaderRequestParams = `series=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.acquireLease = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.acquireLease(request), expectedError); + const actualRequest = ( + client.innerApiCalls.acquireLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('releaseLease', () => { - it('invokes releaseLease without error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ReleaseLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ReleaseLeaseRequest', ['series']); - request.series = defaultValue1; - const expectedHeaderRequestParams = `series=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.ReleaseLeaseResponse() - ); - client.innerApiCalls.releaseLease = stubSimpleCall(expectedResponse); - const [response] = await client.releaseLease(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.releaseLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.releaseLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes acquireLease with closed client', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AcquireLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AcquireLeaseRequest', + ['series'], + ); + request.series = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.acquireLease(request), expectedError); + }); + }); + + describe('renewLease', () => { + it('invokes renewLease without error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RenewLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RenewLeaseRequest', + ['series'], + ); + request.series = defaultValue1; + const expectedHeaderRequestParams = `series=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Lease(), + ); + client.innerApiCalls.renewLease = stubSimpleCall(expectedResponse); + const [response] = await client.renewLease(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.renewLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.renewLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes releaseLease without error using callback', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ReleaseLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ReleaseLeaseRequest', ['series']); - request.series = defaultValue1; - const expectedHeaderRequestParams = `series=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.ReleaseLeaseResponse() - ); - client.innerApiCalls.releaseLease = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.releaseLease( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IReleaseLeaseResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.releaseLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.releaseLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes renewLease without error using callback', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RenewLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RenewLeaseRequest', + ['series'], + ); + request.series = defaultValue1; + const expectedHeaderRequestParams = `series=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Lease(), + ); + client.innerApiCalls.renewLease = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.renewLease( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ILease | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.renewLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.renewLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes releaseLease with error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ReleaseLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ReleaseLeaseRequest', ['series']); - request.series = defaultValue1; - const expectedHeaderRequestParams = `series=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.releaseLease = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.releaseLease(request), expectedError); - const actualRequest = (client.innerApiCalls.releaseLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.releaseLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes renewLease with error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RenewLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RenewLeaseRequest', + ['series'], + ); + request.series = defaultValue1; + const expectedHeaderRequestParams = `series=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.renewLease = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.renewLease(request), expectedError); + const actualRequest = ( + client.innerApiCalls.renewLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.renewLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes releaseLease with closed client', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ReleaseLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ReleaseLeaseRequest', ['series']); - request.series = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.releaseLease(request), expectedError); - }); + it('invokes renewLease with closed client', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RenewLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RenewLeaseRequest', + ['series'], + ); + request.series = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.renewLease(request), expectedError); + }); + }); + + describe('releaseLease', () => { + it('invokes releaseLease without error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ReleaseLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ReleaseLeaseRequest', + ['series'], + ); + request.series = defaultValue1; + const expectedHeaderRequestParams = `series=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.ReleaseLeaseResponse(), + ); + client.innerApiCalls.releaseLease = stubSimpleCall(expectedResponse); + const [response] = await client.releaseLease(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.releaseLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('sendPackets', () => { - it('invokes sendPackets without error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SendPacketsRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.SendPacketsResponse() - ); - client.innerApiCalls.sendPackets = stubBidiStreamingCall(expectedResponse); - const stream = client.sendPackets(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.visionai.v1.SendPacketsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.sendPackets as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); + it('invokes releaseLease without error using callback', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ReleaseLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ReleaseLeaseRequest', + ['series'], + ); + request.series = defaultValue1; + const expectedHeaderRequestParams = `series=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.ReleaseLeaseResponse(), + ); + client.innerApiCalls.releaseLease = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.releaseLease( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IReleaseLeaseResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.releaseLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes sendPackets with error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SendPacketsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.sendPackets = stubBidiStreamingCall(undefined, expectedError); - const stream = client.sendPackets(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.visionai.v1.SendPacketsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.sendPackets as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); + it('invokes releaseLease with error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ReleaseLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ReleaseLeaseRequest', + ['series'], + ); + request.series = defaultValue1; + const expectedHeaderRequestParams = `series=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.releaseLease = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.releaseLease(request), expectedError); + const actualRequest = ( + client.innerApiCalls.releaseLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('receivePackets', () => { - it('invokes receivePackets without error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ReceivePacketsRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.ReceivePacketsResponse() - ); - client.innerApiCalls.receivePackets = stubBidiStreamingCall(expectedResponse); - const stream = client.receivePackets(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.visionai.v1.ReceivePacketsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.receivePackets as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); + it('invokes releaseLease with closed client', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ReleaseLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ReleaseLeaseRequest', + ['series'], + ); + request.series = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.releaseLease(request), expectedError); + }); + }); + + describe('sendPackets', () => { + it('invokes sendPackets without error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SendPacketsRequest(), + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.SendPacketsResponse(), + ); + client.innerApiCalls.sendPackets = + stubBidiStreamingCall(expectedResponse); + const stream = client.sendPackets(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.SendPacketsResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.sendPackets as SinonStub) + .getCall(0) + .calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); + }); - it('invokes receivePackets with error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ReceivePacketsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.receivePackets = stubBidiStreamingCall(undefined, expectedError); - const stream = client.receivePackets(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.visionai.v1.ReceivePacketsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.receivePackets as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); + it('invokes sendPackets with error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SendPacketsRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.sendPackets = stubBidiStreamingCall( + undefined, + expectedError, + ); + const stream = client.sendPackets(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.SendPacketsResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.sendPackets as SinonStub) + .getCall(0) + .calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); + }); + }); + + describe('receivePackets', () => { + it('invokes receivePackets without error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ReceivePacketsRequest(), + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.ReceivePacketsResponse(), + ); + client.innerApiCalls.receivePackets = + stubBidiStreamingCall(expectedResponse); + const stream = client.receivePackets(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.visionai.v1.ReceivePacketsResponse, + ) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.receivePackets as SinonStub) + .getCall(0) + .calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); }); - describe('receiveEvents', () => { - it('invokes receiveEvents without error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ReceiveEventsRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.ReceiveEventsResponse() - ); - client.innerApiCalls.receiveEvents = stubBidiStreamingCall(expectedResponse); - const stream = client.receiveEvents(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.visionai.v1.ReceiveEventsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.receiveEvents as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); + it('invokes receivePackets with error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ReceivePacketsRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.receivePackets = stubBidiStreamingCall( + undefined, + expectedError, + ); + const stream = client.receivePackets(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.visionai.v1.ReceivePacketsResponse, + ) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.receivePackets as SinonStub) + .getCall(0) + .calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); + }); + }); + + describe('receiveEvents', () => { + it('invokes receiveEvents without error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ReceiveEventsRequest(), + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.ReceiveEventsResponse(), + ); + client.innerApiCalls.receiveEvents = + stubBidiStreamingCall(expectedResponse); + const stream = client.receiveEvents(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.ReceiveEventsResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.receiveEvents as SinonStub) + .getCall(0) + .calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); + }); - it('invokes receiveEvents with error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ReceiveEventsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.receiveEvents = stubBidiStreamingCall(undefined, expectedError); - const stream = client.receiveEvents(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.visionai.v1.ReceiveEventsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.receiveEvents as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); + it('invokes receiveEvents with error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ReceiveEventsRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.receiveEvents = stubBidiStreamingCall( + undefined, + expectedError, + ); + const stream = client.receiveEvents(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.ReceiveEventsResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.receiveEvents as SinonStub) + .getCall(0) + .calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.getIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .getIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getIamPolicy(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.setIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .setIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.setIamPolicy(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse(), + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions( + request, + expectedOptions, + ); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse(), + ); + client.iamClient.testIamPermissions = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .testIamPermissions( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.TestIamPermissionsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes testIamPermissions with error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.testIamPermissions(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('analysis', async () => { + const fakePath = '/rendered/path/analysis'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + analysis: 'analysisValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.analysisPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.analysisPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('analysisPath', () => { + const result = client.analysisPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'analysisValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.analysisPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAnalysisName', () => { + const result = client.matchProjectFromAnalysisName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAnalysisName', () => { + const result = client.matchLocationFromAnalysisName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromAnalysisName', () => { + const result = client.matchClusterFromAnalysisName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAnalysisFromAnalysisName', () => { + const result = client.matchAnalysisFromAnalysisName(fakePath); + assert.strictEqual(result, 'analysisValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('analysis', async () => { - const fakePath = "/rendered/path/analysis"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - analysis: "analysisValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.analysisPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.analysisPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('analysisPath', () => { - const result = client.analysisPath("projectValue", "locationValue", "clusterValue", "analysisValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.analysisPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAnalysisName', () => { - const result = client.matchProjectFromAnalysisName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAnalysisName', () => { - const result = client.matchLocationFromAnalysisName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromAnalysisName', () => { - const result = client.matchClusterFromAnalysisName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnalysisFromAnalysisName', () => { - const result = client.matchAnalysisFromAnalysisName(fakePath); - assert.strictEqual(result, "analysisValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('annotation', async () => { - const fakePath = "/rendered/path/annotation"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - asset: "assetValue", - annotation: "annotationValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.annotationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.annotationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('annotationPath', () => { - const result = client.annotationPath("projectNumberValue", "locationValue", "corpusValue", "assetValue", "annotationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.annotationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromAnnotationName', () => { - const result = client.matchProjectNumberFromAnnotationName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAnnotationName', () => { - const result = client.matchLocationFromAnnotationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromAnnotationName', () => { - const result = client.matchCorpusFromAnnotationName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAnnotationName', () => { - const result = client.matchAssetFromAnnotationName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnnotationFromAnnotationName', () => { - const result = client.matchAnnotationFromAnnotationName(fakePath); - assert.strictEqual(result, "annotationValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('annotation', async () => { + const fakePath = '/rendered/path/annotation'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + asset: 'assetValue', + annotation: 'annotationValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.annotationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.annotationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('annotationPath', () => { + const result = client.annotationPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'assetValue', + 'annotationValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.annotationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromAnnotationName', () => { + const result = client.matchProjectNumberFromAnnotationName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAnnotationName', () => { + const result = client.matchLocationFromAnnotationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromAnnotationName', () => { + const result = client.matchCorpusFromAnnotationName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAssetFromAnnotationName', () => { + const result = client.matchAssetFromAnnotationName(fakePath); + assert.strictEqual(result, 'assetValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAnnotationFromAnnotationName', () => { + const result = client.matchAnnotationFromAnnotationName(fakePath); + assert.strictEqual(result, 'annotationValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('application', async () => { - const fakePath = "/rendered/path/application"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.applicationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.applicationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('applicationPath', () => { - const result = client.applicationPath("projectValue", "locationValue", "applicationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.applicationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApplicationName', () => { - const result = client.matchProjectFromApplicationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApplicationName', () => { - const result = client.matchLocationFromApplicationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromApplicationName', () => { - const result = client.matchApplicationFromApplicationName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('application', async () => { + const fakePath = '/rendered/path/application'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.applicationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.applicationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('applicationPath', () => { + const result = client.applicationPath( + 'projectValue', + 'locationValue', + 'applicationValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.applicationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromApplicationName', () => { + const result = client.matchProjectFromApplicationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromApplicationName', () => { + const result = client.matchLocationFromApplicationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromApplicationName', () => { + const result = client.matchApplicationFromApplicationName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('asset', async () => { - const fakePath = "/rendered/path/asset"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - asset: "assetValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.assetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.assetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('assetPath', () => { - const result = client.assetPath("projectNumberValue", "locationValue", "corpusValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.assetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromAssetName', () => { - const result = client.matchProjectNumberFromAssetName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAssetName', () => { - const result = client.matchLocationFromAssetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromAssetName', () => { - const result = client.matchCorpusFromAssetName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAssetName', () => { - const result = client.matchAssetFromAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('asset', async () => { + const fakePath = '/rendered/path/asset'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + asset: 'assetValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.assetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.assetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('assetPath', () => { + const result = client.assetPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'assetValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.assetPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromAssetName', () => { + const result = client.matchProjectNumberFromAssetName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAssetName', () => { + const result = client.matchLocationFromAssetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromAssetName', () => { + const result = client.matchCorpusFromAssetName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAssetFromAssetName', () => { + const result = client.matchAssetFromAssetName(fakePath); + assert.strictEqual(result, 'assetValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('channel', async () => { - const fakePath = "/rendered/path/channel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - channel: "channelValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.channelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.channelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('channelPath', () => { - const result = client.channelPath("projectValue", "locationValue", "clusterValue", "channelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.channelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromChannelName', () => { - const result = client.matchProjectFromChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromChannelName', () => { - const result = client.matchLocationFromChannelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromChannelName', () => { - const result = client.matchClusterFromChannelName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelFromChannelName', () => { - const result = client.matchChannelFromChannelName(fakePath); - assert.strictEqual(result, "channelValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('channel', async () => { + const fakePath = '/rendered/path/channel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + channel: 'channelValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.channelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.channelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('channelPath', () => { + const result = client.channelPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'channelValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.channelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromChannelName', () => { + const result = client.matchProjectFromChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromChannelName', () => { + const result = client.matchLocationFromChannelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromChannelName', () => { + const result = client.matchClusterFromChannelName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, 'channelValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('cluster', async () => { - const fakePath = "/rendered/path/cluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clusterPath', () => { - const result = client.clusterPath("projectValue", "locationValue", "clusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClusterName', () => { - const result = client.matchProjectFromClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClusterName', () => { - const result = client.matchLocationFromClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromClusterName', () => { - const result = client.matchClusterFromClusterName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('cluster', async () => { + const fakePath = '/rendered/path/cluster'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clusterPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clusterPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clusterPath', () => { + const result = client.clusterPath( + 'projectValue', + 'locationValue', + 'clusterValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clusterPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClusterName', () => { + const result = client.matchProjectFromClusterName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClusterName', () => { + const result = client.matchLocationFromClusterName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromClusterName', () => { + const result = client.matchClusterFromClusterName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('collection', async () => { - const fakePath = "/rendered/path/collection"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - collection: "collectionValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.collectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.collectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('collectionPath', () => { - const result = client.collectionPath("projectNumberValue", "locationValue", "corpusValue", "collectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.collectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromCollectionName', () => { - const result = client.matchProjectNumberFromCollectionName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCollectionName', () => { - const result = client.matchLocationFromCollectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromCollectionName', () => { - const result = client.matchCorpusFromCollectionName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCollectionFromCollectionName', () => { - const result = client.matchCollectionFromCollectionName(fakePath); - assert.strictEqual(result, "collectionValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('collection', async () => { + const fakePath = '/rendered/path/collection'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + collection: 'collectionValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.collectionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.collectionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('collectionPath', () => { + const result = client.collectionPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'collectionValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.collectionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromCollectionName', () => { + const result = client.matchProjectNumberFromCollectionName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCollectionName', () => { + const result = client.matchLocationFromCollectionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromCollectionName', () => { + const result = client.matchCorpusFromCollectionName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCollectionFromCollectionName', () => { + const result = client.matchCollectionFromCollectionName(fakePath); + assert.strictEqual(result, 'collectionValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('corpus', async () => { - const fakePath = "/rendered/path/corpus"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.corpusPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.corpusPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('corpusPath', () => { - const result = client.corpusPath("projectNumberValue", "locationValue", "corpusValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.corpusPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromCorpusName', () => { - const result = client.matchProjectNumberFromCorpusName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCorpusName', () => { - const result = client.matchLocationFromCorpusName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromCorpusName', () => { - const result = client.matchCorpusFromCorpusName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('corpus', async () => { + const fakePath = '/rendered/path/corpus'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.corpusPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.corpusPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('corpusPath', () => { + const result = client.corpusPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.corpusPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromCorpusName', () => { + const result = client.matchProjectNumberFromCorpusName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCorpusName', () => { + const result = client.matchLocationFromCorpusName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromCorpusName', () => { + const result = client.matchCorpusFromCorpusName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dataSchema', async () => { - const fakePath = "/rendered/path/dataSchema"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - data_schema: "dataSchemaValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dataSchemaPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dataSchemaPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dataSchemaPath', () => { - const result = client.dataSchemaPath("projectNumberValue", "locationValue", "corpusValue", "dataSchemaValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dataSchemaPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromDataSchemaName', () => { - const result = client.matchProjectNumberFromDataSchemaName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDataSchemaName', () => { - const result = client.matchLocationFromDataSchemaName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromDataSchemaName', () => { - const result = client.matchCorpusFromDataSchemaName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDataSchemaFromDataSchemaName', () => { - const result = client.matchDataSchemaFromDataSchemaName(fakePath); - assert.strictEqual(result, "dataSchemaValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dataSchema', async () => { + const fakePath = '/rendered/path/dataSchema'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + data_schema: 'dataSchemaValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dataSchemaPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dataSchemaPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dataSchemaPath', () => { + const result = client.dataSchemaPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'dataSchemaValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.dataSchemaPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromDataSchemaName', () => { + const result = client.matchProjectNumberFromDataSchemaName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDataSchemaName', () => { + const result = client.matchLocationFromDataSchemaName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromDataSchemaName', () => { + const result = client.matchCorpusFromDataSchemaName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataSchemaFromDataSchemaName', () => { + const result = client.matchDataSchemaFromDataSchemaName(fakePath); + assert.strictEqual(result, 'dataSchemaValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('draft', async () => { - const fakePath = "/rendered/path/draft"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - draft: "draftValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.draftPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.draftPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('draftPath', () => { - const result = client.draftPath("projectValue", "locationValue", "applicationValue", "draftValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.draftPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDraftName', () => { - const result = client.matchProjectFromDraftName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDraftName', () => { - const result = client.matchLocationFromDraftName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromDraftName', () => { - const result = client.matchApplicationFromDraftName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDraftFromDraftName', () => { - const result = client.matchDraftFromDraftName(fakePath); - assert.strictEqual(result, "draftValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('draft', async () => { + const fakePath = '/rendered/path/draft'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + draft: 'draftValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.draftPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.draftPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('draftPath', () => { + const result = client.draftPath( + 'projectValue', + 'locationValue', + 'applicationValue', + 'draftValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.draftPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDraftName', () => { + const result = client.matchProjectFromDraftName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDraftName', () => { + const result = client.matchLocationFromDraftName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromDraftName', () => { + const result = client.matchApplicationFromDraftName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDraftFromDraftName', () => { + const result = client.matchDraftFromDraftName(fakePath); + assert.strictEqual(result, 'draftValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('event', async () => { - const fakePath = "/rendered/path/event"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - event: "eventValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.eventPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.eventPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('eventPath', () => { - const result = client.eventPath("projectValue", "locationValue", "clusterValue", "eventValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.eventPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromEventName', () => { - const result = client.matchProjectFromEventName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromEventName', () => { - const result = client.matchLocationFromEventName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromEventName', () => { - const result = client.matchClusterFromEventName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEventFromEventName', () => { - const result = client.matchEventFromEventName(fakePath); - assert.strictEqual(result, "eventValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('event', async () => { + const fakePath = '/rendered/path/event'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + event: 'eventValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.eventPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.eventPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('eventPath', () => { + const result = client.eventPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'eventValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.eventPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromEventName', () => { + const result = client.matchProjectFromEventName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromEventName', () => { + const result = client.matchLocationFromEventName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromEventName', () => { + const result = client.matchClusterFromEventName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchEventFromEventName', () => { + const result = client.matchEventFromEventName(fakePath); + assert.strictEqual(result, 'eventValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('index', async () => { - const fakePath = "/rendered/path/index"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - index: "indexValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.indexPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.indexPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('indexPath', () => { - const result = client.indexPath("projectNumberValue", "locationValue", "corpusValue", "indexValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.indexPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromIndexName', () => { - const result = client.matchProjectNumberFromIndexName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromIndexName', () => { - const result = client.matchLocationFromIndexName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromIndexName', () => { - const result = client.matchCorpusFromIndexName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIndexFromIndexName', () => { - const result = client.matchIndexFromIndexName(fakePath); - assert.strictEqual(result, "indexValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('index', async () => { + const fakePath = '/rendered/path/index'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + index: 'indexValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.indexPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.indexPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('indexPath', () => { + const result = client.indexPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'indexValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.indexPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromIndexName', () => { + const result = client.matchProjectNumberFromIndexName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromIndexName', () => { + const result = client.matchLocationFromIndexName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromIndexName', () => { + const result = client.matchCorpusFromIndexName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchIndexFromIndexName', () => { + const result = client.matchIndexFromIndexName(fakePath); + assert.strictEqual(result, 'indexValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('indexEndpoint', async () => { - const fakePath = "/rendered/path/indexEndpoint"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - index_endpoint: "indexEndpointValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.indexEndpointPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.indexEndpointPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('indexEndpointPath', () => { - const result = client.indexEndpointPath("projectValue", "locationValue", "indexEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.indexEndpointPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromIndexEndpointName', () => { - const result = client.matchProjectFromIndexEndpointName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromIndexEndpointName', () => { - const result = client.matchLocationFromIndexEndpointName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIndexEndpointFromIndexEndpointName', () => { - const result = client.matchIndexEndpointFromIndexEndpointName(fakePath); - assert.strictEqual(result, "indexEndpointValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('indexEndpoint', async () => { + const fakePath = '/rendered/path/indexEndpoint'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + index_endpoint: 'indexEndpointValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.indexEndpointPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.indexEndpointPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('indexEndpointPath', () => { + const result = client.indexEndpointPath( + 'projectValue', + 'locationValue', + 'indexEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.indexEndpointPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromIndexEndpointName', () => { + const result = client.matchProjectFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromIndexEndpointName', () => { + const result = client.matchLocationFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchIndexEndpointFromIndexEndpointName', () => { + const result = client.matchIndexEndpointFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'indexEndpointValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('instance', async () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - instance: "instanceValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "applicationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromInstanceName', () => { - const result = client.matchApplicationFromInstanceName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('instance', async () => { + const fakePath = '/rendered/path/instance'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + instance: 'instanceValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.instancePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.instancePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath( + 'projectValue', + 'locationValue', + 'applicationValue', + 'instanceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInstanceName', () => { + const result = client.matchLocationFromInstanceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromInstanceName', () => { + const result = client.matchApplicationFromInstanceName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, 'instanceValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('operator', async () => { - const fakePath = "/rendered/path/operator"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - operator: "operatorValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.operatorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.operatorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('operatorPath', () => { - const result = client.operatorPath("projectValue", "locationValue", "operatorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.operatorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromOperatorName', () => { - const result = client.matchProjectFromOperatorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOperatorName', () => { - const result = client.matchLocationFromOperatorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchOperatorFromOperatorName', () => { - const result = client.matchOperatorFromOperatorName(fakePath); - assert.strictEqual(result, "operatorValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('operator', async () => { + const fakePath = '/rendered/path/operator'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + operator: 'operatorValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.operatorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.operatorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('operatorPath', () => { + const result = client.operatorPath( + 'projectValue', + 'locationValue', + 'operatorValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.operatorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromOperatorName', () => { + const result = client.matchProjectFromOperatorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOperatorName', () => { + const result = client.matchLocationFromOperatorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchOperatorFromOperatorName', () => { + const result = client.matchOperatorFromOperatorName(fakePath); + assert.strictEqual(result, 'operatorValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('process', async () => { - const fakePath = "/rendered/path/process"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - process: "processValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.processPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.processPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('processPath', () => { - const result = client.processPath("projectValue", "locationValue", "clusterValue", "processValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.processPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProcessName', () => { - const result = client.matchProjectFromProcessName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProcessName', () => { - const result = client.matchLocationFromProcessName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromProcessName', () => { - const result = client.matchClusterFromProcessName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProcessFromProcessName', () => { - const result = client.matchProcessFromProcessName(fakePath); - assert.strictEqual(result, "processValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('process', async () => { + const fakePath = '/rendered/path/process'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + process: 'processValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.processPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processPath', () => { + const result = client.processPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'processValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProcessName', () => { + const result = client.matchProjectFromProcessName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProcessName', () => { + const result = client.matchLocationFromProcessName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromProcessName', () => { + const result = client.matchClusterFromProcessName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchProcessFromProcessName', () => { + const result = client.matchProcessFromProcessName(fakePath); + assert.strictEqual(result, 'processValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('processor', async () => { - const fakePath = "/rendered/path/processor"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - processor: "processorValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.processorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.processorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('processorPath', () => { - const result = client.processorPath("projectValue", "locationValue", "processorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.processorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProcessorName', () => { - const result = client.matchProjectFromProcessorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProcessorName', () => { - const result = client.matchLocationFromProcessorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProcessorFromProcessorName', () => { - const result = client.matchProcessorFromProcessorName(fakePath); - assert.strictEqual(result, "processorValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('processor', async () => { + const fakePath = '/rendered/path/processor'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor: 'processorValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.processorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processorPath', () => { + const result = client.processorPath( + 'projectValue', + 'locationValue', + 'processorValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProcessorName', () => { + const result = client.matchProjectFromProcessorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProcessorName', () => { + const result = client.matchLocationFromProcessorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchProcessorFromProcessorName', () => { + const result = client.matchProcessorFromProcessorName(fakePath); + assert.strictEqual(result, 'processorValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('searchConfig', async () => { - const fakePath = "/rendered/path/searchConfig"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - search_config: "searchConfigValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.searchConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.searchConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('searchConfigPath', () => { - const result = client.searchConfigPath("projectNumberValue", "locationValue", "corpusValue", "searchConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.searchConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromSearchConfigName', () => { - const result = client.matchProjectNumberFromSearchConfigName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSearchConfigName', () => { - const result = client.matchLocationFromSearchConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromSearchConfigName', () => { - const result = client.matchCorpusFromSearchConfigName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSearchConfigFromSearchConfigName', () => { - const result = client.matchSearchConfigFromSearchConfigName(fakePath); - assert.strictEqual(result, "searchConfigValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('searchConfig', async () => { + const fakePath = '/rendered/path/searchConfig'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + search_config: 'searchConfigValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.searchConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.searchConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('searchConfigPath', () => { + const result = client.searchConfigPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'searchConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.searchConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromSearchConfigName', () => { + const result = client.matchProjectNumberFromSearchConfigName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSearchConfigName', () => { + const result = client.matchLocationFromSearchConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromSearchConfigName', () => { + const result = client.matchCorpusFromSearchConfigName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSearchConfigFromSearchConfigName', () => { + const result = client.matchSearchConfigFromSearchConfigName(fakePath); + assert.strictEqual(result, 'searchConfigValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('searchHypernym', async () => { - const fakePath = "/rendered/path/searchHypernym"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - search_hypernym: "searchHypernymValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.searchHypernymPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.searchHypernymPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('searchHypernymPath', () => { - const result = client.searchHypernymPath("projectNumberValue", "locationValue", "corpusValue", "searchHypernymValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.searchHypernymPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromSearchHypernymName', () => { - const result = client.matchProjectNumberFromSearchHypernymName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSearchHypernymName', () => { - const result = client.matchLocationFromSearchHypernymName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromSearchHypernymName', () => { - const result = client.matchCorpusFromSearchHypernymName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSearchHypernymFromSearchHypernymName', () => { - const result = client.matchSearchHypernymFromSearchHypernymName(fakePath); - assert.strictEqual(result, "searchHypernymValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('searchHypernym', async () => { + const fakePath = '/rendered/path/searchHypernym'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + search_hypernym: 'searchHypernymValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.searchHypernymPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.searchHypernymPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('searchHypernymPath', () => { + const result = client.searchHypernymPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'searchHypernymValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.searchHypernymPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromSearchHypernymName', () => { + const result = + client.matchProjectNumberFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSearchHypernymName', () => { + const result = client.matchLocationFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromSearchHypernymName', () => { + const result = client.matchCorpusFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSearchHypernymFromSearchHypernymName', () => { + const result = + client.matchSearchHypernymFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'searchHypernymValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('series', async () => { - const fakePath = "/rendered/path/series"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - series: "seriesValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.seriesPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.seriesPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('seriesPath', () => { - const result = client.seriesPath("projectValue", "locationValue", "clusterValue", "seriesValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.seriesPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSeriesName', () => { - const result = client.matchProjectFromSeriesName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSeriesName', () => { - const result = client.matchLocationFromSeriesName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromSeriesName', () => { - const result = client.matchClusterFromSeriesName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSeriesFromSeriesName', () => { - const result = client.matchSeriesFromSeriesName(fakePath); - assert.strictEqual(result, "seriesValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('series', async () => { + const fakePath = '/rendered/path/series'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + series: 'seriesValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.seriesPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.seriesPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('seriesPath', () => { + const result = client.seriesPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'seriesValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.seriesPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSeriesName', () => { + const result = client.matchProjectFromSeriesName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSeriesName', () => { + const result = client.matchLocationFromSeriesName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromSeriesName', () => { + const result = client.matchClusterFromSeriesName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSeriesFromSeriesName', () => { + const result = client.matchSeriesFromSeriesName(fakePath); + assert.strictEqual(result, 'seriesValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('stream', async () => { - const fakePath = "/rendered/path/stream"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - stream: "streamValue", - }; - const client = new streamingserviceModule.v1.StreamingServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.streamPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.streamPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('streamPath', () => { - const result = client.streamPath("projectValue", "locationValue", "clusterValue", "streamValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.streamPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromStreamName', () => { - const result = client.matchProjectFromStreamName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromStreamName', () => { - const result = client.matchLocationFromStreamName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromStreamName', () => { - const result = client.matchClusterFromStreamName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStreamFromStreamName', () => { - const result = client.matchStreamFromStreamName(fakePath); - assert.strictEqual(result, "streamValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('stream', async () => { + const fakePath = '/rendered/path/stream'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + stream: 'streamValue', + }; + const client = new streamingserviceModule.v1.StreamingServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.streamPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.streamPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('streamPath', () => { + const result = client.streamPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'streamValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.streamPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromStreamName', () => { + const result = client.matchProjectFromStreamName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromStreamName', () => { + const result = client.matchLocationFromStreamName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromStreamName', () => { + const result = client.matchClusterFromStreamName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchStreamFromStreamName', () => { + const result = client.matchStreamFromStreamName(fakePath); + assert.strictEqual(result, 'streamValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-visionai/test/gapic_streams_service_v1.ts b/packages/google-cloud-visionai/test/gapic_streams_service_v1.ts index 667e25284220..9c9e0efa191e 100644 --- a/packages/google-cloud-visionai/test/gapic_streams_service_v1.ts +++ b/packages/google-cloud-visionai/test/gapic_streams_service_v1.ts @@ -19,5813 +19,7384 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as streamsserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + IamProtos, + LocationProtos, +} from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); } -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.StreamsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new streamsserviceModule.v1.StreamsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new streamsserviceModule.v1.StreamsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = streamsserviceModule.v1.StreamsServiceClient.servicePath; - assert.strictEqual(servicePath, 'warehouse-visionai.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = streamsserviceModule.v1.StreamsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new streamsserviceModule.v1.StreamsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new streamsserviceModule.v1.StreamsServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new streamsserviceModule.v1.StreamsServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = streamsserviceModule.v1.StreamsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new streamsserviceModule.v1.StreamsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.streamsServiceStub, undefined); - await client.initialize(); - assert(client.streamsServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.streamsServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.streamsServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new streamsserviceModule.v1.StreamsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); }); - describe('getCluster', () => { - it('invokes getCluster without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Cluster() - ); - client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); - const [response] = await client.getCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Cluster() - ); - client.innerApiCalls.getCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCluster( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ICluster|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCluster with closed client', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getCluster(request), expectedError); - }); + it('has universeDomain', () => { + const client = new streamsserviceModule.v1.StreamsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); }); - describe('getStream', () => { - it('invokes getStream without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Stream() - ); - client.innerApiCalls.getStream = stubSimpleCall(expectedResponse); - const [response] = await client.getStream(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStream without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Stream() - ); - client.innerApiCalls.getStream = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getStream( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IStream|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStream with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getStream = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getStream(request), expectedError); - const actualRequest = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStream with closed client', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetStreamRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getStream(request), expectedError); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + streamsserviceModule.v1.StreamsServiceClient.servicePath; + assert.strictEqual(servicePath, 'warehouse-visionai.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + streamsserviceModule.v1.StreamsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); }); - describe('generateStreamHlsToken', () => { - it('invokes generateStreamHlsToken without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest', ['stream']); - request.stream = defaultValue1; - const expectedHeaderRequestParams = `stream=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateStreamHlsTokenResponse() - ); - client.innerApiCalls.generateStreamHlsToken = stubSimpleCall(expectedResponse); - const [response] = await client.generateStreamHlsToken(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateStreamHlsToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateStreamHlsToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + }); - it('invokes generateStreamHlsToken without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest', ['stream']); - request.stream = defaultValue1; - const expectedHeaderRequestParams = `stream=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateStreamHlsTokenResponse() - ); - client.innerApiCalls.generateStreamHlsToken = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateStreamHlsToken( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateStreamHlsToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateStreamHlsToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new streamsserviceModule.v1.StreamsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'warehouse-visionai.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new streamsserviceModule.v1.StreamsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('invokes generateStreamHlsToken with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest', ['stream']); - request.stream = defaultValue1; - const expectedHeaderRequestParams = `stream=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateStreamHlsToken = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateStreamHlsToken(request), expectedError); - const actualRequest = (client.innerApiCalls.generateStreamHlsToken as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateStreamHlsToken as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has port', () => { + const port = streamsserviceModule.v1.StreamsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('invokes generateStreamHlsToken with closed client', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest', ['stream']); - request.stream = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.generateStreamHlsToken(request), expectedError); - }); + it('should create a client with no option', () => { + const client = new streamsserviceModule.v1.StreamsServiceClient(); + assert(client); }); - describe('getEvent', () => { - it('invokes getEvent without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetEventRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Event() - ); - client.innerApiCalls.getEvent = stubSimpleCall(expectedResponse); - const [response] = await client.getEvent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + fallback: true, + }); + assert(client); + }); - it('invokes getEvent without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetEventRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Event() - ); - client.innerApiCalls.getEvent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEvent( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IEvent|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.streamsServiceStub, undefined); + await client.initialize(); + assert(client.streamsServiceStub); + }); - it('invokes getEvent with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetEventRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getEvent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEvent(request), expectedError); - const actualRequest = (client.innerApiCalls.getEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.streamsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getEvent with closed client', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetEventRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getEvent(request), expectedError); + it('has close method for the non-initialized client', (done) => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.streamsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getSeries', () => { - it('invokes getSeries without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Series() - ); - client.innerApiCalls.getSeries = stubSimpleCall(expectedResponse); - const [response] = await client.getSeries(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes getSeries without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Series() - ); - client.innerApiCalls.getSeries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSeries( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ISeries|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getCluster', () => { + it('invokes getCluster without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Cluster(), + ); + client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); + const [response] = await client.getCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSeries with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSeries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSeries(request), expectedError); - const actualRequest = (client.innerApiCalls.getSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getCluster without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Cluster(), + ); + client.innerApiCalls.getCluster = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCluster( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ICluster | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSeries with closed client', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSeries(request), expectedError); - }); + it('invokes getCluster with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCluster = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getCluster(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createCluster', () => { - it('invokes createCluster without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.createCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getCluster with closed client', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getCluster(request), expectedError); + }); + }); + + describe('getStream', () => { + it('invokes getStream without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetStreamRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetStreamRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Stream(), + ); + client.innerApiCalls.getStream = stubSimpleCall(expectedResponse); + const [response] = await client.getStream(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createCluster without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getStream without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetStreamRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetStreamRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Stream(), + ); + client.innerApiCalls.getStream = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getStream( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IStream | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createCluster with call error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getStream with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetStreamRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetStreamRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getStream(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createCluster with LRO error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getStream with closed client', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetStreamRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetStreamRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getStream(request), expectedError); + }); + }); + + describe('generateStreamHlsToken', () => { + it('invokes generateStreamHlsToken without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest', + ['stream'], + ); + request.stream = defaultValue1; + const expectedHeaderRequestParams = `stream=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateStreamHlsTokenResponse(), + ); + client.innerApiCalls.generateStreamHlsToken = + stubSimpleCall(expectedResponse); + const [response] = await client.generateStreamHlsToken(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateStreamHlsToken as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateStreamHlsToken as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateClusterProgress without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes generateStreamHlsToken without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest', + ['stream'], + ); + request.stream = defaultValue1; + const expectedHeaderRequestParams = `stream=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateStreamHlsTokenResponse(), + ); + client.innerApiCalls.generateStreamHlsToken = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateStreamHlsToken( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IGenerateStreamHlsTokenResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateStreamHlsToken as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateStreamHlsToken as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateClusterProgress with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes generateStreamHlsToken with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest', + ['stream'], + ); + request.stream = defaultValue1; + const expectedHeaderRequestParams = `stream=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateStreamHlsToken = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.generateStreamHlsToken(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.generateStreamHlsToken as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateStreamHlsToken as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateCluster', () => { - it('invokes updateCluster without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateClusterRequest() - ); - request.cluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateClusterRequest', ['cluster', 'name']); - request.cluster.name = defaultValue1; - const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes generateStreamHlsToken with closed client', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GenerateStreamHlsTokenRequest', + ['stream'], + ); + request.stream = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.generateStreamHlsToken(request), + expectedError, + ); + }); + }); + + describe('getEvent', () => { + it('invokes getEvent without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetEventRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetEventRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Event(), + ); + client.innerApiCalls.getEvent = stubSimpleCall(expectedResponse); + const [response] = await client.getEvent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateCluster without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateClusterRequest() - ); - request.cluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateClusterRequest', ['cluster', 'name']); - request.cluster.name = defaultValue1; - const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getEvent without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetEventRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetEventRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Event(), + ); + client.innerApiCalls.getEvent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEvent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IEvent | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateCluster with call error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateClusterRequest() - ); - request.cluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateClusterRequest', ['cluster', 'name']); - request.cluster.name = defaultValue1; - const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getEvent with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetEventRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetEventRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEvent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getEvent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateCluster with LRO error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateClusterRequest() - ); - request.cluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateClusterRequest', ['cluster', 'name']); - request.cluster.name = defaultValue1; - const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getEvent with closed client', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetEventRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetEventRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getEvent(request), expectedError); + }); + }); + + describe('getSeries', () => { + it('invokes getSeries without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Series(), + ); + client.innerApiCalls.getSeries = stubSimpleCall(expectedResponse); + const [response] = await client.getSeries(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateClusterProgress without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes getSeries without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Series(), + ); + client.innerApiCalls.getSeries = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSeries( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ISeries | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateClusterProgress with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes getSeries with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSeries = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSeries(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteCluster', () => { - it('invokes deleteCluster without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSeries with closed client', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getSeries(request), expectedError); + }); + }); + + describe('createCluster', () => { + it('invokes createCluster without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateClusterRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createCluster = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteCluster without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createCluster without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateClusterRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createCluster = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCluster( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteCluster with call error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createCluster with call error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateClusterRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCluster = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createCluster(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteCluster with LRO error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createCluster with LRO error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateClusterRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCluster = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteClusterProgress without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateClusterProgress without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateClusterProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteClusterProgress with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateClusterProgress with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateClusterProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateCluster', () => { + it('invokes updateCluster without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateClusterRequest(), + ); + request.cluster ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateClusterRequest', + ['cluster', 'name'], + ); + request.cluster.name = defaultValue1; + const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateCluster = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createStream', () => { - it('invokes createStream without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateStreamRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createStream = stubLongRunningCall(expectedResponse); - const [operation] = await client.createStream(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateCluster without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateClusterRequest(), + ); + request.cluster ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateClusterRequest', + ['cluster', 'name'], + ); + request.cluster.name = defaultValue1; + const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateCluster = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCluster( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.ICluster, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createStream without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateStreamRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createStream = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createStream( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateCluster with call error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateClusterRequest(), + ); + request.cluster ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateClusterRequest', + ['cluster', 'name'], + ); + request.cluster.name = defaultValue1; + const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCluster = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateCluster(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createStream with call error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateStreamRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createStream = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createStream(request), expectedError); - const actualRequest = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateCluster with LRO error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateClusterRequest(), + ); + request.cluster ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateClusterRequest', + ['cluster', 'name'], + ); + request.cluster.name = defaultValue1; + const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCluster = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createStream with LRO error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateStreamRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createStream = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createStream(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateClusterProgress without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateClusterProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateStreamProgress without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateStreamProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateClusterProgress with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateClusterProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteCluster', () => { + it('invokes deleteCluster without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteCluster = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateStreamProgress with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateStreamProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteCluster without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteCluster = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCluster( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateStream', () => { - it('invokes updateStream without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateStream = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateStream(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteCluster with call error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCluster = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteCluster(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateStream without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateStream = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateStream( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteCluster with LRO error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCluster = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateStream with call error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateStream = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateStream(request), expectedError); - const actualRequest = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteClusterProgress without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteClusterProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateStream with LRO error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateStream = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateStream(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteClusterProgress with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteClusterProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createStream', () => { + it('invokes createStream without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateStreamRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateStreamRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createStream = stubLongRunningCall(expectedResponse); + const [operation] = await client.createStream(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateStreamProgress without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateStreamProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createStream without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateStreamRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateStreamRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createStream = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createStream( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateStreamProgress with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateStreamProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createStream with call error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateStreamRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateStreamRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createStream = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createStream(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteStream', () => { - it('invokes deleteStream without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteStream = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteStream(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createStream with LRO error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateStreamRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateStreamRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createStream = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createStream(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteStream without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteStream = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteStream( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateStreamProgress without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateStreamProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteStream with call error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteStream = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteStream(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateStreamProgress with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkCreateStreamProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateStream', () => { + it('invokes updateStream without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateStreamRequest(), + ); + request.stream ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateStreamRequest', + ['stream', 'name'], + ); + request.stream.name = defaultValue1; + const expectedHeaderRequestParams = `stream.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateStream = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateStream(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteStream with LRO error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteStream = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteStream(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateStream without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateStreamRequest(), + ); + request.stream ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateStreamRequest', + ['stream', 'name'], + ); + request.stream.name = defaultValue1; + const expectedHeaderRequestParams = `stream.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateStream = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateStream( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IStream, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteStreamProgress without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteStreamProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateStream with call error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateStreamRequest(), + ); + request.stream ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateStreamRequest', + ['stream', 'name'], + ); + request.stream.name = defaultValue1; + const expectedHeaderRequestParams = `stream.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateStream = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateStream(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteStreamProgress with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteStreamProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateStream with LRO error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateStreamRequest(), + ); + request.stream ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateStreamRequest', + ['stream', 'name'], + ); + request.stream.name = defaultValue1; + const expectedHeaderRequestParams = `stream.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateStream = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateStream(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getStreamThumbnail', () => { - it('invokes getStreamThumbnail without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetStreamThumbnailRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetStreamThumbnailRequest', ['stream']); - request.stream = defaultValue1; - const expectedHeaderRequestParams = `stream=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.getStreamThumbnail = stubLongRunningCall(expectedResponse); - const [operation] = await client.getStreamThumbnail(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStreamThumbnail as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStreamThumbnail as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateStreamProgress without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateStreamProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes getStreamThumbnail without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetStreamThumbnailRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetStreamThumbnailRequest', ['stream']); - request.stream = defaultValue1; - const expectedHeaderRequestParams = `stream=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.getStreamThumbnail = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getStreamThumbnail( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStreamThumbnail as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStreamThumbnail as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateStreamProgress with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkUpdateStreamProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteStream', () => { + it('invokes deleteStream without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteStreamRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteStreamRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteStream = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteStream(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getStreamThumbnail with call error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetStreamThumbnailRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetStreamThumbnailRequest', ['stream']); - request.stream = defaultValue1; - const expectedHeaderRequestParams = `stream=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getStreamThumbnail = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.getStreamThumbnail(request), expectedError); - const actualRequest = (client.innerApiCalls.getStreamThumbnail as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStreamThumbnail as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteStream without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteStreamRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteStreamRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteStream = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteStream( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getStreamThumbnail with LRO error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetStreamThumbnailRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetStreamThumbnailRequest', ['stream']); - request.stream = defaultValue1; - const expectedHeaderRequestParams = `stream=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getStreamThumbnail = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.getStreamThumbnail(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.getStreamThumbnail as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStreamThumbnail as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteStream with call error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteStreamRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteStreamRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteStream = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteStream(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkGetStreamThumbnailProgress without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkGetStreamThumbnailProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteStream with LRO error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteStreamRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteStreamRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteStream = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteStream(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteStream as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteStream as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkGetStreamThumbnailProgress with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkGetStreamThumbnailProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteStreamProgress without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteStreamProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('createEvent', () => { - it('invokes createEvent without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createEvent = stubLongRunningCall(expectedResponse); - const [operation] = await client.createEvent(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteStreamProgress with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkDeleteStreamProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('getStreamThumbnail', () => { + it('invokes getStreamThumbnail without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetStreamThumbnailRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetStreamThumbnailRequest', + ['stream'], + ); + request.stream = defaultValue1; + const expectedHeaderRequestParams = `stream=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.getStreamThumbnail = + stubLongRunningCall(expectedResponse); + const [operation] = await client.getStreamThumbnail(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getStreamThumbnail as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getStreamThumbnail as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createEvent without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createEvent = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createEvent( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getStreamThumbnail without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetStreamThumbnailRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetStreamThumbnailRequest', + ['stream'], + ); + request.stream = defaultValue1; + const expectedHeaderRequestParams = `stream=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.getStreamThumbnail = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getStreamThumbnail( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IGetStreamThumbnailResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IGetStreamThumbnailResponse, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getStreamThumbnail as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getStreamThumbnail as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createEvent with call error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEvent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createEvent(request), expectedError); - const actualRequest = (client.innerApiCalls.createEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getStreamThumbnail with call error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetStreamThumbnailRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetStreamThumbnailRequest', + ['stream'], + ); + request.stream = defaultValue1; + const expectedHeaderRequestParams = `stream=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getStreamThumbnail = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.getStreamThumbnail(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getStreamThumbnail as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getStreamThumbnail as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createEvent with LRO error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEvent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createEvent(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getStreamThumbnail with LRO error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetStreamThumbnailRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetStreamThumbnailRequest', + ['stream'], + ); + request.stream = defaultValue1; + const expectedHeaderRequestParams = `stream=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getStreamThumbnail = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.getStreamThumbnail(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.getStreamThumbnail as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getStreamThumbnail as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateEventProgress without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateEventProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkGetStreamThumbnailProgress without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkGetStreamThumbnailProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateEventProgress with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateEventProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkGetStreamThumbnailProgress with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkGetStreamThumbnailProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createEvent', () => { + it('invokes createEvent without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateEventRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateEventRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createEvent = stubLongRunningCall(expectedResponse); + const [operation] = await client.createEvent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateEvent', () => { - it('invokes updateEvent without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateEventRequest() - ); - request.event ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateEventRequest', ['event', 'name']); - request.event.name = defaultValue1; - const expectedHeaderRequestParams = `event.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateEvent = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateEvent(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createEvent without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateEventRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateEventRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createEvent = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEvent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateEvent without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateEventRequest() - ); - request.event ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateEventRequest', ['event', 'name']); - request.event.name = defaultValue1; - const expectedHeaderRequestParams = `event.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateEvent = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateEvent( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createEvent with call error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateEventRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateEventRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEvent = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createEvent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateEvent with call error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateEventRequest() - ); - request.event ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateEventRequest', ['event', 'name']); - request.event.name = defaultValue1; - const expectedHeaderRequestParams = `event.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateEvent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateEvent(request), expectedError); - const actualRequest = (client.innerApiCalls.updateEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createEvent with LRO error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateEventRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateEventRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEvent = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createEvent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateEvent with LRO error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateEventRequest() - ); - request.event ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateEventRequest', ['event', 'name']); - request.event.name = defaultValue1; - const expectedHeaderRequestParams = `event.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateEvent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateEvent(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateEventProgress without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateEventProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateEventProgress without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateEventProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateEventProgress with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkCreateEventProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateEvent', () => { + it('invokes updateEvent without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateEventRequest(), + ); + request.event ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateEventRequest', + ['event', 'name'], + ); + request.event.name = defaultValue1; + const expectedHeaderRequestParams = `event.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateEvent = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateEvent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateEventProgress with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateEventProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateEvent without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateEventRequest(), + ); + request.event ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateEventRequest', + ['event', 'name'], + ); + request.event.name = defaultValue1; + const expectedHeaderRequestParams = `event.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateEvent = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateEvent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IEvent, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteEvent', () => { - it('invokes deleteEvent without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteEventRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteEvent = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteEvent(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateEvent with call error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateEventRequest(), + ); + request.event ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateEventRequest', + ['event', 'name'], + ); + request.event.name = defaultValue1; + const expectedHeaderRequestParams = `event.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEvent = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateEvent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteEvent without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteEventRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteEvent = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteEvent( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateEvent with LRO error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateEventRequest(), + ); + request.event ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateEventRequest', + ['event', 'name'], + ); + request.event.name = defaultValue1; + const expectedHeaderRequestParams = `event.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEvent = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateEvent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteEvent with call error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteEventRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteEvent = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteEvent(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateEventProgress without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateEventProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteEvent with LRO error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteEventRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteEvent = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteEvent(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateEventProgress with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkUpdateEventProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteEvent', () => { + it('invokes deleteEvent without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteEventRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteEventRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteEvent = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteEvent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteEventProgress without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteEventProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteEvent without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteEventRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteEventRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteEvent = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteEvent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteEventProgress with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteEventProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteEvent with call error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteEventRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteEventRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEvent = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteEvent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createSeries', () => { - it('invokes createSeries without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateSeriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSeries = stubLongRunningCall(expectedResponse); - const [operation] = await client.createSeries(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteEvent with LRO error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteEventRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteEventRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEvent = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteEvent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteEvent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEvent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSeries without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateSeriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSeries = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSeries( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteEventProgress without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteEventProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createSeries with call error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateSeriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSeries = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createSeries(request), expectedError); - const actualRequest = (client.innerApiCalls.createSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteEventProgress with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkDeleteEventProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createSeries', () => { + it('invokes createSeries without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateSeriesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSeries = stubLongRunningCall(expectedResponse); + const [operation] = await client.createSeries(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSeries with LRO error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateSeriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSeries = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createSeries(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSeries without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateSeriesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSeries = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSeries( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateSeriesProgress without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateSeriesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createSeries with call error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateSeriesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSeries = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createSeries(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateSeriesProgress with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateSeriesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createSeries with LRO error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateSeriesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSeries = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createSeries(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateSeries', () => { - it('invokes updateSeries without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateSeriesRequest() - ); - request.series ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateSeriesRequest', ['series', 'name']); - request.series.name = defaultValue1; - const expectedHeaderRequestParams = `series.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSeries = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateSeries(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateSeriesProgress without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateSeriesProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateSeries without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateSeriesRequest() - ); - request.series ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateSeriesRequest', ['series', 'name']); - request.series.name = defaultValue1; - const expectedHeaderRequestParams = `series.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSeries = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSeries( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateSeriesProgress with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkCreateSeriesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateSeries', () => { + it('invokes updateSeries without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateSeriesRequest(), + ); + request.series ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateSeriesRequest', + ['series', 'name'], + ); + request.series.name = defaultValue1; + const expectedHeaderRequestParams = `series.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSeries = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSeries(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSeries with call error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateSeriesRequest() - ); - request.series ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateSeriesRequest', ['series', 'name']); - request.series.name = defaultValue1; - const expectedHeaderRequestParams = `series.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSeries = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateSeries(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSeries without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateSeriesRequest(), + ); + request.series ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateSeriesRequest', + ['series', 'name'], + ); + request.series.name = defaultValue1; + const expectedHeaderRequestParams = `series.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSeries = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSeries( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.ISeries, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSeries with LRO error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateSeriesRequest() - ); - request.series ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateSeriesRequest', ['series', 'name']); - request.series.name = defaultValue1; - const expectedHeaderRequestParams = `series.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSeries = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateSeries(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSeries with call error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateSeriesRequest(), + ); + request.series ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateSeriesRequest', + ['series', 'name'], + ); + request.series.name = defaultValue1; + const expectedHeaderRequestParams = `series.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSeries = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateSeries(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateSeriesProgress without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateSeriesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateSeries with LRO error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateSeriesRequest(), + ); + request.series ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateSeriesRequest', + ['series', 'name'], + ); + request.series.name = defaultValue1; + const expectedHeaderRequestParams = `series.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSeries = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateSeries(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateSeriesProgress with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateSeriesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateSeriesProgress without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateSeriesProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteSeries', () => { - it('invokes deleteSeries without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSeries = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteSeries(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateSeriesProgress with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkUpdateSeriesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteSeries', () => { + it('invokes deleteSeries without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSeries = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSeries(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSeries without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSeries = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSeries( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSeries without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSeries = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSeries( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSeries with call error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSeries = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteSeries(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSeries with call error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSeries = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteSeries(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSeries with LRO error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSeries = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteSeries(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSeries with LRO error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteSeriesRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSeries = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteSeries(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteSeriesProgress without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteSeriesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteSeriesProgress without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteSeriesProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteSeriesProgress with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteSeriesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteSeriesProgress with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkDeleteSeriesProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('materializeChannel', () => { + it('invokes materializeChannel without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.MaterializeChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.MaterializeChannelRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.materializeChannel = + stubLongRunningCall(expectedResponse); + const [operation] = await client.materializeChannel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.materializeChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.materializeChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('materializeChannel', () => { - it('invokes materializeChannel without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.MaterializeChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.MaterializeChannelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.materializeChannel = stubLongRunningCall(expectedResponse); - const [operation] = await client.materializeChannel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.materializeChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.materializeChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes materializeChannel without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.MaterializeChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.MaterializeChannelRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.materializeChannel = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.materializeChannel( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IChannel, + protos.google.cloud.visionai.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IChannel, + protos.google.cloud.visionai.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.materializeChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.materializeChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes materializeChannel without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.MaterializeChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.MaterializeChannelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.materializeChannel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.materializeChannel( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.materializeChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.materializeChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes materializeChannel with call error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.MaterializeChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.MaterializeChannelRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.materializeChannel = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.materializeChannel(request), expectedError); + const actualRequest = ( + client.innerApiCalls.materializeChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.materializeChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes materializeChannel with call error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.MaterializeChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.MaterializeChannelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.materializeChannel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.materializeChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.materializeChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.materializeChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes materializeChannel with LRO error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.MaterializeChannelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.MaterializeChannelRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.materializeChannel = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.materializeChannel(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.materializeChannel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.materializeChannel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes materializeChannel with LRO error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.MaterializeChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.MaterializeChannelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.materializeChannel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.materializeChannel(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.materializeChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.materializeChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkMaterializeChannelProgress without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkMaterializeChannelProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkMaterializeChannelProgress without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkMaterializeChannelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkMaterializeChannelProgress with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkMaterializeChannelProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listClusters', () => { + it('invokes listClusters without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListClustersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListClustersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), + ]; + client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); + const [response] = await client.listClusters(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listClusters as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClusters as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkMaterializeChannelProgress with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkMaterializeChannelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listClusters without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListClustersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListClustersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), + ]; + client.innerApiCalls.listClusters = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listClusters( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ICluster[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listClusters as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClusters as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listClusters', () => { - it('invokes listClusters without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), - ]; - client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); - const [response] = await client.listClusters(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listClusters with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListClustersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListClustersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listClusters = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listClusters(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listClusters as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClusters as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listClusters without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), - ]; - client.innerApiCalls.listClusters = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listClusters( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ICluster[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listClustersStream without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListClustersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListClustersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), + ]; + client.descriptors.page.listClusters.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Cluster[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Cluster) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listClusters.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listClusters, request), + ); + assert( + (client.descriptors.page.listClusters.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listClusters with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listClusters = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listClusters(request), expectedError); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listClustersStream with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListClustersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListClustersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listClusters.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Cluster[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Cluster) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listClusters.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listClusters, request), + ); + assert( + (client.descriptors.page.listClusters.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listClustersStream without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), - ]; - client.descriptors.page.listClusters.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Cluster[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Cluster) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listClusters, request)); - assert( - (client.descriptors.page.listClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listClusters without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListClustersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListClustersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), + ]; + client.descriptors.page.listClusters.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.ICluster[] = []; + const iterable = client.listClustersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listClusters.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listClusters.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listClustersStream with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listClusters.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Cluster[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Cluster) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listClusters, request)); - assert( - (client.descriptors.page.listClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listClusters with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListClustersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListClustersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listClusters.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listClustersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.ICluster[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listClusters.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listClusters.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listStreams', () => { + it('invokes listStreams without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListStreamsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListStreamsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), + ]; + client.innerApiCalls.listStreams = stubSimpleCall(expectedResponse); + const [response] = await client.listStreams(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listStreams as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listStreams as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listClusters without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Cluster()), - ]; - client.descriptors.page.listClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.ICluster[] = []; - const iterable = client.listClustersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listStreams without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListStreamsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListStreamsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), + ]; + client.innerApiCalls.listStreams = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listStreams( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IStream[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listClusters with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listClustersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.ICluster[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listStreams as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listStreams as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listStreams', () => { - it('invokes listStreams without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), - ]; - client.innerApiCalls.listStreams = stubSimpleCall(expectedResponse); - const [response] = await client.listStreams(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listStreams with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListStreamsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListStreamsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listStreams = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listStreams(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listStreams as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listStreams as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listStreams without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), - ]; - client.innerApiCalls.listStreams = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listStreams( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IStream[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listStreamsStream without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListStreamsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListStreamsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), + ]; + client.descriptors.page.listStreams.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listStreamsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Stream[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Stream) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listStreams.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listStreams, request), + ); + assert( + (client.descriptors.page.listStreams.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listStreams with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listStreams = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listStreams(request), expectedError); - const actualRequest = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listStreamsStream with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListStreamsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListStreamsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listStreams.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listStreamsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Stream[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Stream) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listStreams.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listStreams, request), + ); + assert( + (client.descriptors.page.listStreams.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listStreamsStream without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), - ]; - client.descriptors.page.listStreams.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listStreamsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Stream[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Stream) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listStreams.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listStreams, request)); - assert( - (client.descriptors.page.listStreams.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listStreams without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListStreamsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListStreamsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), + ]; + client.descriptors.page.listStreams.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IStream[] = []; + const iterable = client.listStreamsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listStreams.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listStreams.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listStreamsStream with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listStreams.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listStreamsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Stream[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Stream) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listStreams.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listStreams, request)); - assert( - (client.descriptors.page.listStreams.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listStreams with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListStreamsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListStreamsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listStreams.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listStreamsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IStream[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listStreams.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listStreams.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listEvents', () => { + it('invokes listEvents without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListEventsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListEventsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), + ]; + client.innerApiCalls.listEvents = stubSimpleCall(expectedResponse); + const [response] = await client.listEvents(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listStreams without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Stream()), - ]; - client.descriptors.page.listStreams.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IStream[] = []; - const iterable = client.listStreamsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listEvents without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListEventsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListEventsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), + ]; + client.innerApiCalls.listEvents = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEvents( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IEvent[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listStreams.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listStreams.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listStreams with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listStreams.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listStreamsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IStream[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listStreams.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listStreams.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listEvents', () => { - it('invokes listEvents without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), - ]; - client.innerApiCalls.listEvents = stubSimpleCall(expectedResponse); - const [response] = await client.listEvents(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listEvents with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListEventsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListEventsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEvents = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listEvents(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listEvents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEvents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listEvents without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), - ]; - client.innerApiCalls.listEvents = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEvents( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IEvent[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listEventsStream without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListEventsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListEventsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), + ]; + client.descriptors.page.listEvents.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listEventsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Event[] = []; + stream.on('data', (response: protos.google.cloud.visionai.v1.Event) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listEvents.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEvents, request), + ); + assert( + (client.descriptors.page.listEvents.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listEvents with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEvents = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEvents(request), expectedError); - const actualRequest = (client.innerApiCalls.listEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listEventsStream with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListEventsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListEventsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEvents.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listEventsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Event[] = []; + stream.on('data', (response: protos.google.cloud.visionai.v1.Event) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listEvents.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEvents, request), + ); + assert( + (client.descriptors.page.listEvents.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listEventsStream without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), - ]; - client.descriptors.page.listEvents.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listEventsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Event[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Event) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listEvents.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEvents, request)); - assert( - (client.descriptors.page.listEvents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listEvents without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListEventsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListEventsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), + ]; + client.descriptors.page.listEvents.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IEvent[] = []; + const iterable = client.listEventsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listEvents.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listEvents.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listEventsStream with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listEvents.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listEventsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Event[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Event) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listEvents.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEvents, request)); - assert( - (client.descriptors.page.listEvents.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listEvents with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListEventsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListEventsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEvents.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listEventsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IEvent[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listEvents.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listEvents.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listSeries', () => { + it('invokes listSeries without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSeriesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), + ]; + client.innerApiCalls.listSeries = stubSimpleCall(expectedResponse); + const [response] = await client.listSeries(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listEvents without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Event()), - ]; - client.descriptors.page.listEvents.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IEvent[] = []; - const iterable = client.listEventsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listSeries without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSeriesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), + ]; + client.innerApiCalls.listSeries = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSeries( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ISeries[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listEvents.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listEvents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listEvents with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listEvents.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listEventsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IEvent[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listEvents.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listEvents.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listSeries', () => { - it('invokes listSeries without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSeriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), - ]; - client.innerApiCalls.listSeries = stubSimpleCall(expectedResponse); - const [response] = await client.listSeries(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSeries without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSeriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), - ]; - client.innerApiCalls.listSeries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSeries( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ISeries[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSeries with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSeriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSeries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSeries(request), expectedError); - const actualRequest = (client.innerApiCalls.listSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSeries with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSeriesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSeries = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listSeries(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listSeries as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSeries as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listSeriesStream without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSeriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), - ]; - client.descriptors.page.listSeries.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSeriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Series[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Series) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSeries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSeries, request)); - assert( - (client.descriptors.page.listSeries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listSeriesStream without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSeriesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), + ]; + client.descriptors.page.listSeries.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSeriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Series[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Series) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listSeries.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSeries, request), + ); + assert( + (client.descriptors.page.listSeries.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSeriesStream with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSeriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSeries.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSeriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Series[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Series) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSeries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSeries, request)); - assert( - (client.descriptors.page.listSeries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listSeriesStream with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSeriesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSeries.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listSeriesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Series[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Series) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSeries.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSeries, request), + ); + assert( + (client.descriptors.page.listSeries.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listSeries without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSeriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), - ]; - client.descriptors.page.listSeries.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.ISeries[] = []; - const iterable = client.listSeriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSeries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSeries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSeries without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSeriesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Series()), + ]; + client.descriptors.page.listSeries.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.ISeries[] = []; + const iterable = client.listSeriesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSeries.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listSeries.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listSeries with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSeriesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSeries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSeriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.ISeries[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSeries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSeries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSeries with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSeriesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSeriesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSeries.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listSeriesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.ISeries[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSeries.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listSeries.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.getIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .getIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getIamPolicy(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.setIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .setIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('invokes setIamPolicy with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.setIamPolicy(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse(), + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions( + request, + expectedOptions, + ); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse(), + ); + client.iamClient.testIamPermissions = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .testIamPermissions( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.TestIamPermissionsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.testIamPermissions(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.IOperation[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.IOperation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + }); + + describe('Path templates', () => { + describe('analysis', async () => { + const fakePath = '/rendered/path/analysis'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + analysis: 'analysisValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.analysisPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.analysisPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('analysisPath', () => { + const result = client.analysisPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'analysisValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.analysisPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAnalysisName', () => { + const result = client.matchProjectFromAnalysisName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAnalysisName', () => { + const result = client.matchLocationFromAnalysisName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromAnalysisName', () => { + const result = client.matchClusterFromAnalysisName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAnalysisFromAnalysisName', () => { + const result = client.matchAnalysisFromAnalysisName(fakePath); + assert.strictEqual(result, 'analysisValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('analysis', async () => { - const fakePath = "/rendered/path/analysis"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - analysis: "analysisValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.analysisPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.analysisPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('analysisPath', () => { - const result = client.analysisPath("projectValue", "locationValue", "clusterValue", "analysisValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.analysisPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAnalysisName', () => { - const result = client.matchProjectFromAnalysisName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAnalysisName', () => { - const result = client.matchLocationFromAnalysisName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromAnalysisName', () => { - const result = client.matchClusterFromAnalysisName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnalysisFromAnalysisName', () => { - const result = client.matchAnalysisFromAnalysisName(fakePath); - assert.strictEqual(result, "analysisValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('annotation', async () => { - const fakePath = "/rendered/path/annotation"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - asset: "assetValue", - annotation: "annotationValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.annotationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.annotationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('annotationPath', () => { - const result = client.annotationPath("projectNumberValue", "locationValue", "corpusValue", "assetValue", "annotationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.annotationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromAnnotationName', () => { - const result = client.matchProjectNumberFromAnnotationName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAnnotationName', () => { - const result = client.matchLocationFromAnnotationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromAnnotationName', () => { - const result = client.matchCorpusFromAnnotationName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAnnotationName', () => { - const result = client.matchAssetFromAnnotationName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnnotationFromAnnotationName', () => { - const result = client.matchAnnotationFromAnnotationName(fakePath); - assert.strictEqual(result, "annotationValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('annotation', async () => { + const fakePath = '/rendered/path/annotation'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + asset: 'assetValue', + annotation: 'annotationValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.annotationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.annotationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('annotationPath', () => { + const result = client.annotationPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'assetValue', + 'annotationValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.annotationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromAnnotationName', () => { + const result = client.matchProjectNumberFromAnnotationName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAnnotationName', () => { + const result = client.matchLocationFromAnnotationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromAnnotationName', () => { + const result = client.matchCorpusFromAnnotationName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAssetFromAnnotationName', () => { + const result = client.matchAssetFromAnnotationName(fakePath); + assert.strictEqual(result, 'assetValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAnnotationFromAnnotationName', () => { + const result = client.matchAnnotationFromAnnotationName(fakePath); + assert.strictEqual(result, 'annotationValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('application', async () => { - const fakePath = "/rendered/path/application"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.applicationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.applicationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('applicationPath', () => { - const result = client.applicationPath("projectValue", "locationValue", "applicationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.applicationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApplicationName', () => { - const result = client.matchProjectFromApplicationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApplicationName', () => { - const result = client.matchLocationFromApplicationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromApplicationName', () => { - const result = client.matchApplicationFromApplicationName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('application', async () => { + const fakePath = '/rendered/path/application'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.applicationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.applicationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('applicationPath', () => { + const result = client.applicationPath( + 'projectValue', + 'locationValue', + 'applicationValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.applicationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromApplicationName', () => { + const result = client.matchProjectFromApplicationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromApplicationName', () => { + const result = client.matchLocationFromApplicationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromApplicationName', () => { + const result = client.matchApplicationFromApplicationName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('asset', async () => { - const fakePath = "/rendered/path/asset"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - asset: "assetValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.assetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.assetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('assetPath', () => { - const result = client.assetPath("projectNumberValue", "locationValue", "corpusValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.assetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromAssetName', () => { - const result = client.matchProjectNumberFromAssetName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAssetName', () => { - const result = client.matchLocationFromAssetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromAssetName', () => { - const result = client.matchCorpusFromAssetName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAssetName', () => { - const result = client.matchAssetFromAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('asset', async () => { + const fakePath = '/rendered/path/asset'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + asset: 'assetValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.assetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.assetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('assetPath', () => { + const result = client.assetPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'assetValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.assetPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromAssetName', () => { + const result = client.matchProjectNumberFromAssetName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAssetName', () => { + const result = client.matchLocationFromAssetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromAssetName', () => { + const result = client.matchCorpusFromAssetName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAssetFromAssetName', () => { + const result = client.matchAssetFromAssetName(fakePath); + assert.strictEqual(result, 'assetValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('channel', async () => { - const fakePath = "/rendered/path/channel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - channel: "channelValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.channelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.channelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('channelPath', () => { - const result = client.channelPath("projectValue", "locationValue", "clusterValue", "channelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.channelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromChannelName', () => { - const result = client.matchProjectFromChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromChannelName', () => { - const result = client.matchLocationFromChannelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromChannelName', () => { - const result = client.matchClusterFromChannelName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelFromChannelName', () => { - const result = client.matchChannelFromChannelName(fakePath); - assert.strictEqual(result, "channelValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('channel', async () => { + const fakePath = '/rendered/path/channel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + channel: 'channelValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.channelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.channelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('channelPath', () => { + const result = client.channelPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'channelValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.channelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromChannelName', () => { + const result = client.matchProjectFromChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromChannelName', () => { + const result = client.matchLocationFromChannelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromChannelName', () => { + const result = client.matchClusterFromChannelName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, 'channelValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('cluster', async () => { - const fakePath = "/rendered/path/cluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clusterPath', () => { - const result = client.clusterPath("projectValue", "locationValue", "clusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClusterName', () => { - const result = client.matchProjectFromClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClusterName', () => { - const result = client.matchLocationFromClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromClusterName', () => { - const result = client.matchClusterFromClusterName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('cluster', async () => { + const fakePath = '/rendered/path/cluster'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clusterPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clusterPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clusterPath', () => { + const result = client.clusterPath( + 'projectValue', + 'locationValue', + 'clusterValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clusterPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClusterName', () => { + const result = client.matchProjectFromClusterName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClusterName', () => { + const result = client.matchLocationFromClusterName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromClusterName', () => { + const result = client.matchClusterFromClusterName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('collection', async () => { - const fakePath = "/rendered/path/collection"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - collection: "collectionValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.collectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.collectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('collectionPath', () => { - const result = client.collectionPath("projectNumberValue", "locationValue", "corpusValue", "collectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.collectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromCollectionName', () => { - const result = client.matchProjectNumberFromCollectionName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCollectionName', () => { - const result = client.matchLocationFromCollectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromCollectionName', () => { - const result = client.matchCorpusFromCollectionName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCollectionFromCollectionName', () => { - const result = client.matchCollectionFromCollectionName(fakePath); - assert.strictEqual(result, "collectionValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('collection', async () => { + const fakePath = '/rendered/path/collection'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + collection: 'collectionValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.collectionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.collectionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('collectionPath', () => { + const result = client.collectionPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'collectionValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.collectionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromCollectionName', () => { + const result = client.matchProjectNumberFromCollectionName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCollectionName', () => { + const result = client.matchLocationFromCollectionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromCollectionName', () => { + const result = client.matchCorpusFromCollectionName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCollectionFromCollectionName', () => { + const result = client.matchCollectionFromCollectionName(fakePath); + assert.strictEqual(result, 'collectionValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('corpus', async () => { - const fakePath = "/rendered/path/corpus"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.corpusPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.corpusPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('corpusPath', () => { - const result = client.corpusPath("projectNumberValue", "locationValue", "corpusValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.corpusPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromCorpusName', () => { - const result = client.matchProjectNumberFromCorpusName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCorpusName', () => { - const result = client.matchLocationFromCorpusName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromCorpusName', () => { - const result = client.matchCorpusFromCorpusName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('corpus', async () => { + const fakePath = '/rendered/path/corpus'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.corpusPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.corpusPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('corpusPath', () => { + const result = client.corpusPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.corpusPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromCorpusName', () => { + const result = client.matchProjectNumberFromCorpusName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCorpusName', () => { + const result = client.matchLocationFromCorpusName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromCorpusName', () => { + const result = client.matchCorpusFromCorpusName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dataSchema', async () => { - const fakePath = "/rendered/path/dataSchema"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - data_schema: "dataSchemaValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dataSchemaPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dataSchemaPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dataSchemaPath', () => { - const result = client.dataSchemaPath("projectNumberValue", "locationValue", "corpusValue", "dataSchemaValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dataSchemaPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromDataSchemaName', () => { - const result = client.matchProjectNumberFromDataSchemaName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDataSchemaName', () => { - const result = client.matchLocationFromDataSchemaName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromDataSchemaName', () => { - const result = client.matchCorpusFromDataSchemaName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDataSchemaFromDataSchemaName', () => { - const result = client.matchDataSchemaFromDataSchemaName(fakePath); - assert.strictEqual(result, "dataSchemaValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dataSchema', async () => { + const fakePath = '/rendered/path/dataSchema'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + data_schema: 'dataSchemaValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dataSchemaPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dataSchemaPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dataSchemaPath', () => { + const result = client.dataSchemaPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'dataSchemaValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.dataSchemaPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromDataSchemaName', () => { + const result = client.matchProjectNumberFromDataSchemaName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDataSchemaName', () => { + const result = client.matchLocationFromDataSchemaName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromDataSchemaName', () => { + const result = client.matchCorpusFromDataSchemaName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataSchemaFromDataSchemaName', () => { + const result = client.matchDataSchemaFromDataSchemaName(fakePath); + assert.strictEqual(result, 'dataSchemaValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('draft', async () => { - const fakePath = "/rendered/path/draft"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - draft: "draftValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.draftPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.draftPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('draftPath', () => { - const result = client.draftPath("projectValue", "locationValue", "applicationValue", "draftValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.draftPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDraftName', () => { - const result = client.matchProjectFromDraftName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDraftName', () => { - const result = client.matchLocationFromDraftName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromDraftName', () => { - const result = client.matchApplicationFromDraftName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDraftFromDraftName', () => { - const result = client.matchDraftFromDraftName(fakePath); - assert.strictEqual(result, "draftValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('draft', async () => { + const fakePath = '/rendered/path/draft'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + draft: 'draftValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.draftPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.draftPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('draftPath', () => { + const result = client.draftPath( + 'projectValue', + 'locationValue', + 'applicationValue', + 'draftValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.draftPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDraftName', () => { + const result = client.matchProjectFromDraftName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDraftName', () => { + const result = client.matchLocationFromDraftName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromDraftName', () => { + const result = client.matchApplicationFromDraftName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDraftFromDraftName', () => { + const result = client.matchDraftFromDraftName(fakePath); + assert.strictEqual(result, 'draftValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('event', async () => { - const fakePath = "/rendered/path/event"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - event: "eventValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.eventPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.eventPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('eventPath', () => { - const result = client.eventPath("projectValue", "locationValue", "clusterValue", "eventValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.eventPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromEventName', () => { - const result = client.matchProjectFromEventName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromEventName', () => { - const result = client.matchLocationFromEventName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromEventName', () => { - const result = client.matchClusterFromEventName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEventFromEventName', () => { - const result = client.matchEventFromEventName(fakePath); - assert.strictEqual(result, "eventValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('event', async () => { + const fakePath = '/rendered/path/event'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + event: 'eventValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.eventPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.eventPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('eventPath', () => { + const result = client.eventPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'eventValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.eventPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromEventName', () => { + const result = client.matchProjectFromEventName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromEventName', () => { + const result = client.matchLocationFromEventName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromEventName', () => { + const result = client.matchClusterFromEventName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchEventFromEventName', () => { + const result = client.matchEventFromEventName(fakePath); + assert.strictEqual(result, 'eventValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('index', async () => { - const fakePath = "/rendered/path/index"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - index: "indexValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.indexPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.indexPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('indexPath', () => { - const result = client.indexPath("projectNumberValue", "locationValue", "corpusValue", "indexValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.indexPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromIndexName', () => { - const result = client.matchProjectNumberFromIndexName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromIndexName', () => { - const result = client.matchLocationFromIndexName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromIndexName', () => { - const result = client.matchCorpusFromIndexName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIndexFromIndexName', () => { - const result = client.matchIndexFromIndexName(fakePath); - assert.strictEqual(result, "indexValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('index', async () => { + const fakePath = '/rendered/path/index'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + index: 'indexValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.indexPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.indexPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('indexPath', () => { + const result = client.indexPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'indexValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.indexPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromIndexName', () => { + const result = client.matchProjectNumberFromIndexName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromIndexName', () => { + const result = client.matchLocationFromIndexName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromIndexName', () => { + const result = client.matchCorpusFromIndexName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchIndexFromIndexName', () => { + const result = client.matchIndexFromIndexName(fakePath); + assert.strictEqual(result, 'indexValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('indexEndpoint', async () => { - const fakePath = "/rendered/path/indexEndpoint"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - index_endpoint: "indexEndpointValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.indexEndpointPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.indexEndpointPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('indexEndpointPath', () => { - const result = client.indexEndpointPath("projectValue", "locationValue", "indexEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.indexEndpointPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromIndexEndpointName', () => { - const result = client.matchProjectFromIndexEndpointName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromIndexEndpointName', () => { - const result = client.matchLocationFromIndexEndpointName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIndexEndpointFromIndexEndpointName', () => { - const result = client.matchIndexEndpointFromIndexEndpointName(fakePath); - assert.strictEqual(result, "indexEndpointValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('indexEndpoint', async () => { + const fakePath = '/rendered/path/indexEndpoint'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + index_endpoint: 'indexEndpointValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.indexEndpointPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.indexEndpointPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('indexEndpointPath', () => { + const result = client.indexEndpointPath( + 'projectValue', + 'locationValue', + 'indexEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.indexEndpointPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromIndexEndpointName', () => { + const result = client.matchProjectFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromIndexEndpointName', () => { + const result = client.matchLocationFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchIndexEndpointFromIndexEndpointName', () => { + const result = client.matchIndexEndpointFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'indexEndpointValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('instance', async () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - instance: "instanceValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "applicationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromInstanceName', () => { - const result = client.matchApplicationFromInstanceName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('instance', async () => { + const fakePath = '/rendered/path/instance'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + instance: 'instanceValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.instancePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.instancePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath( + 'projectValue', + 'locationValue', + 'applicationValue', + 'instanceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInstanceName', () => { + const result = client.matchLocationFromInstanceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromInstanceName', () => { + const result = client.matchApplicationFromInstanceName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, 'instanceValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('operator', async () => { - const fakePath = "/rendered/path/operator"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - operator: "operatorValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.operatorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.operatorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('operatorPath', () => { - const result = client.operatorPath("projectValue", "locationValue", "operatorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.operatorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromOperatorName', () => { - const result = client.matchProjectFromOperatorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOperatorName', () => { - const result = client.matchLocationFromOperatorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchOperatorFromOperatorName', () => { - const result = client.matchOperatorFromOperatorName(fakePath); - assert.strictEqual(result, "operatorValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('operator', async () => { + const fakePath = '/rendered/path/operator'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + operator: 'operatorValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.operatorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.operatorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('operatorPath', () => { + const result = client.operatorPath( + 'projectValue', + 'locationValue', + 'operatorValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.operatorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromOperatorName', () => { + const result = client.matchProjectFromOperatorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOperatorName', () => { + const result = client.matchLocationFromOperatorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchOperatorFromOperatorName', () => { + const result = client.matchOperatorFromOperatorName(fakePath); + assert.strictEqual(result, 'operatorValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('process', async () => { - const fakePath = "/rendered/path/process"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - process: "processValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.processPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.processPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('processPath', () => { - const result = client.processPath("projectValue", "locationValue", "clusterValue", "processValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.processPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProcessName', () => { - const result = client.matchProjectFromProcessName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProcessName', () => { - const result = client.matchLocationFromProcessName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromProcessName', () => { - const result = client.matchClusterFromProcessName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProcessFromProcessName', () => { - const result = client.matchProcessFromProcessName(fakePath); - assert.strictEqual(result, "processValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('process', async () => { + const fakePath = '/rendered/path/process'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + process: 'processValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.processPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processPath', () => { + const result = client.processPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'processValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProcessName', () => { + const result = client.matchProjectFromProcessName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProcessName', () => { + const result = client.matchLocationFromProcessName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromProcessName', () => { + const result = client.matchClusterFromProcessName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchProcessFromProcessName', () => { + const result = client.matchProcessFromProcessName(fakePath); + assert.strictEqual(result, 'processValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('processor', async () => { - const fakePath = "/rendered/path/processor"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - processor: "processorValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.processorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.processorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('processorPath', () => { - const result = client.processorPath("projectValue", "locationValue", "processorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.processorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProcessorName', () => { - const result = client.matchProjectFromProcessorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProcessorName', () => { - const result = client.matchLocationFromProcessorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProcessorFromProcessorName', () => { - const result = client.matchProcessorFromProcessorName(fakePath); - assert.strictEqual(result, "processorValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('processor', async () => { + const fakePath = '/rendered/path/processor'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor: 'processorValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.processorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processorPath', () => { + const result = client.processorPath( + 'projectValue', + 'locationValue', + 'processorValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProcessorName', () => { + const result = client.matchProjectFromProcessorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProcessorName', () => { + const result = client.matchLocationFromProcessorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchProcessorFromProcessorName', () => { + const result = client.matchProcessorFromProcessorName(fakePath); + assert.strictEqual(result, 'processorValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('searchConfig', async () => { - const fakePath = "/rendered/path/searchConfig"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - search_config: "searchConfigValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.searchConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.searchConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('searchConfigPath', () => { - const result = client.searchConfigPath("projectNumberValue", "locationValue", "corpusValue", "searchConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.searchConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromSearchConfigName', () => { - const result = client.matchProjectNumberFromSearchConfigName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSearchConfigName', () => { - const result = client.matchLocationFromSearchConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromSearchConfigName', () => { - const result = client.matchCorpusFromSearchConfigName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSearchConfigFromSearchConfigName', () => { - const result = client.matchSearchConfigFromSearchConfigName(fakePath); - assert.strictEqual(result, "searchConfigValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('searchConfig', async () => { + const fakePath = '/rendered/path/searchConfig'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + search_config: 'searchConfigValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.searchConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.searchConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('searchConfigPath', () => { + const result = client.searchConfigPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'searchConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.searchConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromSearchConfigName', () => { + const result = client.matchProjectNumberFromSearchConfigName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSearchConfigName', () => { + const result = client.matchLocationFromSearchConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromSearchConfigName', () => { + const result = client.matchCorpusFromSearchConfigName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSearchConfigFromSearchConfigName', () => { + const result = client.matchSearchConfigFromSearchConfigName(fakePath); + assert.strictEqual(result, 'searchConfigValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('searchHypernym', async () => { - const fakePath = "/rendered/path/searchHypernym"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - search_hypernym: "searchHypernymValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.searchHypernymPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.searchHypernymPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('searchHypernymPath', () => { - const result = client.searchHypernymPath("projectNumberValue", "locationValue", "corpusValue", "searchHypernymValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.searchHypernymPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromSearchHypernymName', () => { - const result = client.matchProjectNumberFromSearchHypernymName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSearchHypernymName', () => { - const result = client.matchLocationFromSearchHypernymName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromSearchHypernymName', () => { - const result = client.matchCorpusFromSearchHypernymName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSearchHypernymFromSearchHypernymName', () => { - const result = client.matchSearchHypernymFromSearchHypernymName(fakePath); - assert.strictEqual(result, "searchHypernymValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('searchHypernym', async () => { + const fakePath = '/rendered/path/searchHypernym'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + search_hypernym: 'searchHypernymValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.searchHypernymPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.searchHypernymPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('searchHypernymPath', () => { + const result = client.searchHypernymPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'searchHypernymValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.searchHypernymPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromSearchHypernymName', () => { + const result = + client.matchProjectNumberFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSearchHypernymName', () => { + const result = client.matchLocationFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromSearchHypernymName', () => { + const result = client.matchCorpusFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSearchHypernymFromSearchHypernymName', () => { + const result = + client.matchSearchHypernymFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'searchHypernymValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('series', async () => { - const fakePath = "/rendered/path/series"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - series: "seriesValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.seriesPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.seriesPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('seriesPath', () => { - const result = client.seriesPath("projectValue", "locationValue", "clusterValue", "seriesValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.seriesPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSeriesName', () => { - const result = client.matchProjectFromSeriesName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSeriesName', () => { - const result = client.matchLocationFromSeriesName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromSeriesName', () => { - const result = client.matchClusterFromSeriesName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSeriesFromSeriesName', () => { - const result = client.matchSeriesFromSeriesName(fakePath); - assert.strictEqual(result, "seriesValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('series', async () => { + const fakePath = '/rendered/path/series'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + series: 'seriesValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.seriesPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.seriesPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('seriesPath', () => { + const result = client.seriesPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'seriesValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.seriesPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSeriesName', () => { + const result = client.matchProjectFromSeriesName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSeriesName', () => { + const result = client.matchLocationFromSeriesName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromSeriesName', () => { + const result = client.matchClusterFromSeriesName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSeriesFromSeriesName', () => { + const result = client.matchSeriesFromSeriesName(fakePath); + assert.strictEqual(result, 'seriesValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('stream', async () => { - const fakePath = "/rendered/path/stream"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - stream: "streamValue", - }; - const client = new streamsserviceModule.v1.StreamsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.streamPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.streamPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('streamPath', () => { - const result = client.streamPath("projectValue", "locationValue", "clusterValue", "streamValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.streamPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromStreamName', () => { - const result = client.matchProjectFromStreamName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromStreamName', () => { - const result = client.matchLocationFromStreamName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromStreamName', () => { - const result = client.matchClusterFromStreamName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStreamFromStreamName', () => { - const result = client.matchStreamFromStreamName(fakePath); - assert.strictEqual(result, "streamValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('stream', async () => { + const fakePath = '/rendered/path/stream'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + stream: 'streamValue', + }; + const client = new streamsserviceModule.v1.StreamsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.streamPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.streamPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('streamPath', () => { + const result = client.streamPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'streamValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.streamPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromStreamName', () => { + const result = client.matchProjectFromStreamName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromStreamName', () => { + const result = client.matchLocationFromStreamName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromStreamName', () => { + const result = client.matchClusterFromStreamName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchStreamFromStreamName', () => { + const result = client.matchStreamFromStreamName(fakePath); + assert.strictEqual(result, 'streamValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-visionai/test/gapic_warehouse_v1.ts b/packages/google-cloud-visionai/test/gapic_warehouse_v1.ts index 9bb72f646c78..d80fe3de5703 100644 --- a/packages/google-cloud-visionai/test/gapic_warehouse_v1.ts +++ b/packages/google-cloud-visionai/test/gapic_warehouse_v1.ts @@ -19,11513 +19,14555 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as warehouseModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + IamProtos, + LocationProtos, +} from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); +function stubBidiStreamingCall( + response?: ResponseType, + error?: Error, +) { + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + return sinon.stub().returns(mockStream); } -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); } -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.WarehouseClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new warehouseModule.v1.WarehouseClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new warehouseModule.v1.WarehouseClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = warehouseModule.v1.WarehouseClient.servicePath; - assert.strictEqual(servicePath, 'warehouse-visionai.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = warehouseModule.v1.WarehouseClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new warehouseModule.v1.WarehouseClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new warehouseModule.v1.WarehouseClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new warehouseModule.v1.WarehouseClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - }); + it('has universeDomain', () => { + const client = new warehouseModule.v1.WarehouseClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new warehouseModule.v1.WarehouseClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new warehouseModule.v1.WarehouseClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'warehouse-visionai.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new warehouseModule.v1.WarehouseClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = warehouseModule.v1.WarehouseClient.servicePath; + assert.strictEqual(servicePath, 'warehouse-visionai.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = warehouseModule.v1.WarehouseClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'warehouse-visionai.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new warehouseModule.v1.WarehouseClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + }); - it('has port', () => { - const port = warehouseModule.v1.WarehouseClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new warehouseModule.v1.WarehouseClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + }); - it('should create a client with no option', () => { - const client = new warehouseModule.v1.WarehouseClient(); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new warehouseModule.v1.WarehouseClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'warehouse-visionai.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new warehouseModule.v1.WarehouseClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'warehouse-visionai.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new warehouseModule.v1.WarehouseClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with gRPC fallback', () => { - const client = new warehouseModule.v1.WarehouseClient({ - fallback: true, - }); - assert(client); - }); + it('has port', () => { + const port = warehouseModule.v1.WarehouseClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.warehouseStub, undefined); - await client.initialize(); - assert(client.warehouseStub); - }); + it('should create a client with no option', () => { + const client = new warehouseModule.v1.WarehouseClient(); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.warehouseStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with gRPC fallback', () => { + const client = new warehouseModule.v1.WarehouseClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.warehouseStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.warehouseStub, undefined); + await client.initialize(); + assert(client.warehouseStub); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the initialized client', (done) => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.warehouseStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has close method for the non-initialized client', (done) => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.warehouseStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('createAsset', () => { - it('invokes createAsset without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateAssetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Asset() - ); - client.innerApiCalls.createAsset = stubSimpleCall(expectedResponse); - const [response] = await client.createAsset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes createAsset without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateAssetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Asset() - ); - client.innerApiCalls.createAsset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAsset( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IAsset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createAsset', () => { + it('invokes createAsset without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateAssetRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Asset(), + ); + client.innerApiCalls.createAsset = stubSimpleCall(expectedResponse); + const [response] = await client.createAsset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAsset with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateAssetRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAsset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createAsset(request), expectedError); - const actualRequest = (client.innerApiCalls.createAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAsset without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateAssetRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Asset(), + ); + client.innerApiCalls.createAsset = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAsset( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IAsset | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAsset with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateAssetRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createAsset(request), expectedError); - }); + it('invokes createAsset with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateAssetRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAsset = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createAsset(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateAsset', () => { - it('invokes updateAsset without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateAssetRequest() - ); - request.asset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateAssetRequest', ['asset', 'name']); - request.asset.name = defaultValue1; - const expectedHeaderRequestParams = `asset.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Asset() - ); - client.innerApiCalls.updateAsset = stubSimpleCall(expectedResponse); - const [response] = await client.updateAsset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAsset with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateAssetRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createAsset(request), expectedError); + }); + }); + + describe('updateAsset', () => { + it('invokes updateAsset without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateAssetRequest(), + ); + request.asset ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateAssetRequest', + ['asset', 'name'], + ); + request.asset.name = defaultValue1; + const expectedHeaderRequestParams = `asset.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Asset(), + ); + client.innerApiCalls.updateAsset = stubSimpleCall(expectedResponse); + const [response] = await client.updateAsset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAsset without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateAssetRequest() - ); - request.asset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateAssetRequest', ['asset', 'name']); - request.asset.name = defaultValue1; - const expectedHeaderRequestParams = `asset.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Asset() - ); - client.innerApiCalls.updateAsset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAsset( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IAsset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAsset without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateAssetRequest(), + ); + request.asset ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateAssetRequest', + ['asset', 'name'], + ); + request.asset.name = defaultValue1; + const expectedHeaderRequestParams = `asset.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Asset(), + ); + client.innerApiCalls.updateAsset = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAsset( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IAsset | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAsset with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateAssetRequest() - ); - request.asset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateAssetRequest', ['asset', 'name']); - request.asset.name = defaultValue1; - const expectedHeaderRequestParams = `asset.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAsset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAsset(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAsset with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateAssetRequest(), + ); + request.asset ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateAssetRequest', + ['asset', 'name'], + ); + request.asset.name = defaultValue1; + const expectedHeaderRequestParams = `asset.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAsset = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateAsset(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAsset with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateAssetRequest() - ); - request.asset ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateAssetRequest', ['asset', 'name']); - request.asset.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateAsset(request), expectedError); - }); + it('invokes updateAsset with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateAssetRequest(), + ); + request.asset ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateAssetRequest', + ['asset', 'name'], + ); + request.asset.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateAsset(request), expectedError); + }); + }); + + describe('getAsset', () => { + it('invokes getAsset without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Asset(), + ); + client.innerApiCalls.getAsset = stubSimpleCall(expectedResponse); + const [response] = await client.getAsset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getAsset', () => { - it('invokes getAsset without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Asset() - ); - client.innerApiCalls.getAsset = stubSimpleCall(expectedResponse); - const [response] = await client.getAsset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAsset without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Asset(), + ); + client.innerApiCalls.getAsset = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAsset( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IAsset | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAsset without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Asset() - ); - client.innerApiCalls.getAsset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAsset( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IAsset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAsset with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAsset = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAsset(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAsset with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAsset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAsset(request), expectedError); - const actualRequest = (client.innerApiCalls.getAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAsset with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getAsset(request), expectedError); + }); + }); + + describe('generateRetrievalUrl', () => { + it('invokes generateRetrievalUrl without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateRetrievalUrlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GenerateRetrievalUrlRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateRetrievalUrlResponse(), + ); + client.innerApiCalls.generateRetrievalUrl = + stubSimpleCall(expectedResponse); + const [response] = await client.generateRetrievalUrl(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateRetrievalUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateRetrievalUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAsset with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetAssetRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAsset(request), expectedError); - }); + it('invokes generateRetrievalUrl without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateRetrievalUrlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GenerateRetrievalUrlRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateRetrievalUrlResponse(), + ); + client.innerApiCalls.generateRetrievalUrl = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateRetrievalUrl( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateRetrievalUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateRetrievalUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('generateRetrievalUrl', () => { - it('invokes generateRetrievalUrl without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateRetrievalUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GenerateRetrievalUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateRetrievalUrlResponse() - ); - client.innerApiCalls.generateRetrievalUrl = stubSimpleCall(expectedResponse); - const [response] = await client.generateRetrievalUrl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateRetrievalUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateRetrievalUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes generateRetrievalUrl with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateRetrievalUrlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GenerateRetrievalUrlRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateRetrievalUrl = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.generateRetrievalUrl(request), expectedError); + const actualRequest = ( + client.innerApiCalls.generateRetrievalUrl as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateRetrievalUrl as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes generateRetrievalUrl without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateRetrievalUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GenerateRetrievalUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateRetrievalUrlResponse() - ); - client.innerApiCalls.generateRetrievalUrl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateRetrievalUrl( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IGenerateRetrievalUrlResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateRetrievalUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateRetrievalUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes generateRetrievalUrl with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateRetrievalUrlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GenerateRetrievalUrlRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.generateRetrievalUrl(request), expectedError); + }); + }); + + describe('getIndex', () => { + it('invokes getIndex without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Index(), + ); + client.innerApiCalls.getIndex = stubSimpleCall(expectedResponse); + const [response] = await client.getIndex(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes generateRetrievalUrl with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateRetrievalUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GenerateRetrievalUrlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateRetrievalUrl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateRetrievalUrl(request), expectedError); - const actualRequest = (client.innerApiCalls.generateRetrievalUrl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateRetrievalUrl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getIndex without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Index(), + ); + client.innerApiCalls.getIndex = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIndex( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IIndex | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes generateRetrievalUrl with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateRetrievalUrlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GenerateRetrievalUrlRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.generateRetrievalUrl(request), expectedError); - }); + it('invokes getIndex with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIndex = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIndex(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getIndex', () => { - it('invokes getIndex without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetIndexRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Index() - ); - client.innerApiCalls.getIndex = stubSimpleCall(expectedResponse); - const [response] = await client.getIndex(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getIndex with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getIndex(request), expectedError); + }); + }); + + describe('getCorpus', () => { + it('invokes getCorpus without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetCorpusRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Corpus(), + ); + client.innerApiCalls.getCorpus = stubSimpleCall(expectedResponse); + const [response] = await client.getCorpus(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getIndex without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetIndexRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Index() - ); - client.innerApiCalls.getIndex = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIndex( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IIndex|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getCorpus without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetCorpusRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Corpus(), + ); + client.innerApiCalls.getCorpus = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCorpus( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ICorpus | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getIndex with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetIndexRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIndex = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIndex(request), expectedError); - const actualRequest = (client.innerApiCalls.getIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getCorpus with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetCorpusRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCorpus = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getCorpus(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getIndex with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetIndexRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getIndex(request), expectedError); - }); + it('invokes getCorpus with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetCorpusRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getCorpus(request), expectedError); + }); + }); + + describe('updateCorpus', () => { + it('invokes updateCorpus without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateCorpusRequest(), + ); + request.corpus ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateCorpusRequest', + ['corpus', 'name'], + ); + request.corpus.name = defaultValue1; + const expectedHeaderRequestParams = `corpus.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Corpus(), + ); + client.innerApiCalls.updateCorpus = stubSimpleCall(expectedResponse); + const [response] = await client.updateCorpus(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getCorpus', () => { - it('invokes getCorpus without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetCorpusRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Corpus() - ); - client.innerApiCalls.getCorpus = stubSimpleCall(expectedResponse); - const [response] = await client.getCorpus(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateCorpus without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateCorpusRequest(), + ); + request.corpus ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateCorpusRequest', + ['corpus', 'name'], + ); + request.corpus.name = defaultValue1; + const expectedHeaderRequestParams = `corpus.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Corpus(), + ); + client.innerApiCalls.updateCorpus = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCorpus( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ICorpus | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getCorpus without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetCorpusRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Corpus() - ); - client.innerApiCalls.getCorpus = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCorpus( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ICorpus|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateCorpus with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateCorpusRequest(), + ); + request.corpus ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateCorpusRequest', + ['corpus', 'name'], + ); + request.corpus.name = defaultValue1; + const expectedHeaderRequestParams = `corpus.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCorpus = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateCorpus(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getCorpus with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetCorpusRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCorpus = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCorpus(request), expectedError); - const actualRequest = (client.innerApiCalls.getCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateCorpus with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateCorpusRequest(), + ); + request.corpus ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateCorpusRequest', + ['corpus', 'name'], + ); + request.corpus.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateCorpus(request), expectedError); + }); + }); + + describe('deleteCorpus', () => { + it('invokes deleteCorpus without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteCorpusRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteCorpus = stubSimpleCall(expectedResponse); + const [response] = await client.deleteCorpus(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getCorpus with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetCorpusRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getCorpus(request), expectedError); - }); + it('invokes deleteCorpus without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteCorpusRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteCorpus = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCorpus( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateCorpus', () => { - it('invokes updateCorpus without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateCorpusRequest() - ); - request.corpus ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateCorpusRequest', ['corpus', 'name']); - request.corpus.name = defaultValue1; - const expectedHeaderRequestParams = `corpus.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Corpus() - ); - client.innerApiCalls.updateCorpus = stubSimpleCall(expectedResponse); - const [response] = await client.updateCorpus(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteCorpus with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteCorpusRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCorpus = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteCorpus(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateCorpus without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateCorpusRequest() - ); - request.corpus ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateCorpusRequest', ['corpus', 'name']); - request.corpus.name = defaultValue1; - const expectedHeaderRequestParams = `corpus.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Corpus() - ); - client.innerApiCalls.updateCorpus = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCorpus( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ICorpus|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteCorpus with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteCorpusRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteCorpus(request), expectedError); + }); + }); + + describe('createDataSchema', () => { + it('invokes createDataSchema without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateDataSchemaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateDataSchemaRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.DataSchema(), + ); + client.innerApiCalls.createDataSchema = stubSimpleCall(expectedResponse); + const [response] = await client.createDataSchema(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDataSchema as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDataSchema as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateCorpus with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateCorpusRequest() - ); - request.corpus ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateCorpusRequest', ['corpus', 'name']); - request.corpus.name = defaultValue1; - const expectedHeaderRequestParams = `corpus.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCorpus = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCorpus(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createDataSchema without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateDataSchemaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateDataSchemaRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.DataSchema(), + ); + client.innerApiCalls.createDataSchema = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDataSchema( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IDataSchema | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDataSchema as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDataSchema as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateCorpus with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateCorpusRequest() - ); - request.corpus ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateCorpusRequest', ['corpus', 'name']); - request.corpus.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateCorpus(request), expectedError); - }); + it('invokes createDataSchema with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateDataSchemaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateDataSchemaRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDataSchema = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createDataSchema(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createDataSchema as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDataSchema as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteCorpus', () => { - it('invokes deleteCorpus without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteCorpusRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteCorpus = stubSimpleCall(expectedResponse); - const [response] = await client.deleteCorpus(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createDataSchema with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateDataSchemaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateDataSchemaRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createDataSchema(request), expectedError); + }); + }); + + describe('updateDataSchema', () => { + it('invokes updateDataSchema without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateDataSchemaRequest(), + ); + request.dataSchema ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateDataSchemaRequest', + ['dataSchema', 'name'], + ); + request.dataSchema.name = defaultValue1; + const expectedHeaderRequestParams = `data_schema.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.DataSchema(), + ); + client.innerApiCalls.updateDataSchema = stubSimpleCall(expectedResponse); + const [response] = await client.updateDataSchema(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDataSchema as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDataSchema as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteCorpus without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteCorpusRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteCorpus = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteCorpus( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateDataSchema without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateDataSchemaRequest(), + ); + request.dataSchema ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateDataSchemaRequest', + ['dataSchema', 'name'], + ); + request.dataSchema.name = defaultValue1; + const expectedHeaderRequestParams = `data_schema.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.DataSchema(), + ); + client.innerApiCalls.updateDataSchema = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDataSchema( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IDataSchema | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDataSchema as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDataSchema as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteCorpus with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteCorpusRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCorpus = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteCorpus(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateDataSchema with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateDataSchemaRequest(), + ); + request.dataSchema ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateDataSchemaRequest', + ['dataSchema', 'name'], + ); + request.dataSchema.name = defaultValue1; + const expectedHeaderRequestParams = `data_schema.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDataSchema = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateDataSchema(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDataSchema as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDataSchema as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteCorpus with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteCorpusRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteCorpus(request), expectedError); - }); + it('invokes updateDataSchema with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateDataSchemaRequest(), + ); + request.dataSchema ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateDataSchemaRequest', + ['dataSchema', 'name'], + ); + request.dataSchema.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateDataSchema(request), expectedError); + }); + }); + + describe('getDataSchema', () => { + it('invokes getDataSchema without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetDataSchemaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetDataSchemaRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.DataSchema(), + ); + client.innerApiCalls.getDataSchema = stubSimpleCall(expectedResponse); + const [response] = await client.getDataSchema(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDataSchema as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDataSchema as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createDataSchema', () => { - it('invokes createDataSchema without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateDataSchemaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateDataSchemaRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.DataSchema() - ); - client.innerApiCalls.createDataSchema = stubSimpleCall(expectedResponse); - const [response] = await client.createDataSchema(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDataSchema as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDataSchema as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDataSchema without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetDataSchemaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetDataSchemaRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.DataSchema(), + ); + client.innerApiCalls.getDataSchema = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDataSchema( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IDataSchema | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDataSchema as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDataSchema as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDataSchema without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateDataSchemaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateDataSchemaRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.DataSchema() - ); - client.innerApiCalls.createDataSchema = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDataSchema( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IDataSchema|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDataSchema as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDataSchema as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDataSchema with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetDataSchemaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetDataSchemaRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDataSchema = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDataSchema(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDataSchema as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDataSchema as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDataSchema with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateDataSchemaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateDataSchemaRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDataSchema = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDataSchema(request), expectedError); - const actualRequest = (client.innerApiCalls.createDataSchema as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDataSchema as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDataSchema with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetDataSchemaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetDataSchemaRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDataSchema(request), expectedError); + }); + }); + + describe('deleteDataSchema', () => { + it('invokes deleteDataSchema without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteDataSchemaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteDataSchemaRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteDataSchema = stubSimpleCall(expectedResponse); + const [response] = await client.deleteDataSchema(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDataSchema as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDataSchema as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDataSchema with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateDataSchemaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateDataSchemaRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createDataSchema(request), expectedError); - }); + it('invokes deleteDataSchema without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteDataSchemaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteDataSchemaRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteDataSchema = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDataSchema( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDataSchema as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDataSchema as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateDataSchema', () => { - it('invokes updateDataSchema without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateDataSchemaRequest() - ); - request.dataSchema ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateDataSchemaRequest', ['dataSchema', 'name']); - request.dataSchema.name = defaultValue1; - const expectedHeaderRequestParams = `data_schema.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.DataSchema() - ); - client.innerApiCalls.updateDataSchema = stubSimpleCall(expectedResponse); - const [response] = await client.updateDataSchema(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDataSchema as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDataSchema as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteDataSchema with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteDataSchemaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteDataSchemaRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDataSchema = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteDataSchema(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteDataSchema as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDataSchema as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDataSchema without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateDataSchemaRequest() - ); - request.dataSchema ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateDataSchemaRequest', ['dataSchema', 'name']); - request.dataSchema.name = defaultValue1; - const expectedHeaderRequestParams = `data_schema.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.DataSchema() - ); - client.innerApiCalls.updateDataSchema = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDataSchema( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IDataSchema|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDataSchema as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDataSchema as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteDataSchema with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteDataSchemaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteDataSchemaRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteDataSchema(request), expectedError); + }); + }); + + describe('createAnnotation', () => { + it('invokes createAnnotation without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateAnnotationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateAnnotationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Annotation(), + ); + client.innerApiCalls.createAnnotation = stubSimpleCall(expectedResponse); + const [response] = await client.createAnnotation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAnnotation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAnnotation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDataSchema with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateDataSchemaRequest() - ); - request.dataSchema ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateDataSchemaRequest', ['dataSchema', 'name']); - request.dataSchema.name = defaultValue1; - const expectedHeaderRequestParams = `data_schema.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDataSchema = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateDataSchema(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDataSchema as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDataSchema as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAnnotation without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateAnnotationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateAnnotationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Annotation(), + ); + client.innerApiCalls.createAnnotation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAnnotation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IAnnotation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createAnnotation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAnnotation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDataSchema with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateDataSchemaRequest() - ); - request.dataSchema ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateDataSchemaRequest', ['dataSchema', 'name']); - request.dataSchema.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateDataSchema(request), expectedError); - }); + it('invokes createAnnotation with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateAnnotationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateAnnotationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createAnnotation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createAnnotation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createAnnotation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createAnnotation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getDataSchema', () => { - it('invokes getDataSchema without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetDataSchemaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetDataSchemaRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.DataSchema() - ); - client.innerApiCalls.getDataSchema = stubSimpleCall(expectedResponse); - const [response] = await client.getDataSchema(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDataSchema as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataSchema as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createAnnotation with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateAnnotationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateAnnotationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createAnnotation(request), expectedError); + }); + }); + + describe('getAnnotation', () => { + it('invokes getAnnotation without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetAnnotationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetAnnotationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Annotation(), + ); + client.innerApiCalls.getAnnotation = stubSimpleCall(expectedResponse); + const [response] = await client.getAnnotation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAnnotation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAnnotation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDataSchema without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetDataSchemaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetDataSchemaRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.DataSchema() - ); - client.innerApiCalls.getDataSchema = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDataSchema( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IDataSchema|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDataSchema as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataSchema as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAnnotation without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetAnnotationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetAnnotationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Annotation(), + ); + client.innerApiCalls.getAnnotation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAnnotation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IAnnotation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAnnotation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAnnotation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDataSchema with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetDataSchemaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetDataSchemaRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDataSchema = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDataSchema(request), expectedError); - const actualRequest = (client.innerApiCalls.getDataSchema as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataSchema as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getAnnotation with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetAnnotationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetAnnotationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAnnotation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getAnnotation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getAnnotation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAnnotation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDataSchema with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetDataSchemaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetDataSchemaRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDataSchema(request), expectedError); - }); + it('invokes getAnnotation with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetAnnotationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetAnnotationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getAnnotation(request), expectedError); + }); + }); + + describe('updateAnnotation', () => { + it('invokes updateAnnotation without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateAnnotationRequest(), + ); + request.annotation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateAnnotationRequest', + ['annotation', 'name'], + ); + request.annotation.name = defaultValue1; + const expectedHeaderRequestParams = `annotation.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Annotation(), + ); + client.innerApiCalls.updateAnnotation = stubSimpleCall(expectedResponse); + const [response] = await client.updateAnnotation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAnnotation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAnnotation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteDataSchema', () => { - it('invokes deleteDataSchema without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteDataSchemaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteDataSchemaRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDataSchema = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDataSchema(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDataSchema as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataSchema as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAnnotation without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateAnnotationRequest(), + ); + request.annotation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateAnnotationRequest', + ['annotation', 'name'], + ); + request.annotation.name = defaultValue1; + const expectedHeaderRequestParams = `annotation.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Annotation(), + ); + client.innerApiCalls.updateAnnotation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAnnotation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IAnnotation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAnnotation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAnnotation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteDataSchema without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteDataSchemaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteDataSchemaRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDataSchema = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDataSchema( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDataSchema as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataSchema as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAnnotation with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateAnnotationRequest(), + ); + request.annotation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateAnnotationRequest', + ['annotation', 'name'], + ); + request.annotation.name = defaultValue1; + const expectedHeaderRequestParams = `annotation.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAnnotation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateAnnotation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAnnotation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAnnotation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteDataSchema with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteDataSchemaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteDataSchemaRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDataSchema = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDataSchema(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDataSchema as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataSchema as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateAnnotation with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateAnnotationRequest(), + ); + request.annotation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateAnnotationRequest', + ['annotation', 'name'], + ); + request.annotation.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateAnnotation(request), expectedError); + }); + }); + + describe('deleteAnnotation', () => { + it('invokes deleteAnnotation without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteAnnotationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteAnnotationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteAnnotation = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAnnotation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAnnotation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAnnotation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteDataSchema with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteDataSchemaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteDataSchemaRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteDataSchema(request), expectedError); - }); + it('invokes deleteAnnotation without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteAnnotationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteAnnotationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteAnnotation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAnnotation( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAnnotation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAnnotation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createAnnotation', () => { - it('invokes createAnnotation without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateAnnotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateAnnotationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Annotation() - ); - client.innerApiCalls.createAnnotation = stubSimpleCall(expectedResponse); - const [response] = await client.createAnnotation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAnnotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAnnotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAnnotation with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteAnnotationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteAnnotationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAnnotation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteAnnotation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAnnotation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAnnotation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAnnotation without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateAnnotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateAnnotationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Annotation() - ); - client.innerApiCalls.createAnnotation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAnnotation( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IAnnotation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAnnotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAnnotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAnnotation with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteAnnotationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteAnnotationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteAnnotation(request), expectedError); + }); + }); + + describe('clipAsset', () => { + it('invokes clipAsset without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ClipAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ClipAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.ClipAssetResponse(), + ); + client.innerApiCalls.clipAsset = stubSimpleCall(expectedResponse); + const [response] = await client.clipAsset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.clipAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clipAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAnnotation with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateAnnotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateAnnotationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAnnotation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createAnnotation(request), expectedError); - const actualRequest = (client.innerApiCalls.createAnnotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAnnotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes clipAsset without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ClipAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ClipAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.ClipAssetResponse(), + ); + client.innerApiCalls.clipAsset = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.clipAsset( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IClipAssetResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.clipAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clipAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createAnnotation with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateAnnotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateAnnotationRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createAnnotation(request), expectedError); - }); + it('invokes clipAsset with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ClipAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ClipAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.clipAsset = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.clipAsset(request), expectedError); + const actualRequest = ( + client.innerApiCalls.clipAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clipAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getAnnotation', () => { - it('invokes getAnnotation without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetAnnotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetAnnotationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Annotation() - ); - client.innerApiCalls.getAnnotation = stubSimpleCall(expectedResponse); - const [response] = await client.getAnnotation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAnnotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAnnotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes clipAsset with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ClipAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ClipAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.clipAsset(request), expectedError); + }); + }); + + describe('generateHlsUri', () => { + it('invokes generateHlsUri without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateHlsUriRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GenerateHlsUriRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateHlsUriResponse(), + ); + client.innerApiCalls.generateHlsUri = stubSimpleCall(expectedResponse); + const [response] = await client.generateHlsUri(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateHlsUri as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateHlsUri as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAnnotation without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetAnnotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetAnnotationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Annotation() - ); - client.innerApiCalls.getAnnotation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAnnotation( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IAnnotation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAnnotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAnnotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes generateHlsUri without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateHlsUriRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GenerateHlsUriRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateHlsUriResponse(), + ); + client.innerApiCalls.generateHlsUri = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateHlsUri( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IGenerateHlsUriResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateHlsUri as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateHlsUri as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAnnotation with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetAnnotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetAnnotationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAnnotation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAnnotation(request), expectedError); - const actualRequest = (client.innerApiCalls.getAnnotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAnnotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes generateHlsUri with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateHlsUriRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GenerateHlsUriRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateHlsUri = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.generateHlsUri(request), expectedError); + const actualRequest = ( + client.innerApiCalls.generateHlsUri as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateHlsUri as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getAnnotation with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetAnnotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetAnnotationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAnnotation(request), expectedError); - }); + it('invokes generateHlsUri with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GenerateHlsUriRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GenerateHlsUriRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.generateHlsUri(request), expectedError); + }); + }); + + describe('createSearchConfig', () => { + it('invokes createSearchConfig without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateSearchConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateSearchConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ); + client.innerApiCalls.createSearchConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.createSearchConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSearchConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSearchConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateAnnotation', () => { - it('invokes updateAnnotation without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateAnnotationRequest() - ); - request.annotation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateAnnotationRequest', ['annotation', 'name']); - request.annotation.name = defaultValue1; - const expectedHeaderRequestParams = `annotation.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Annotation() - ); - client.innerApiCalls.updateAnnotation = stubSimpleCall(expectedResponse); - const [response] = await client.updateAnnotation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAnnotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAnnotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSearchConfig without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateSearchConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateSearchConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ); + client.innerApiCalls.createSearchConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSearchConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ISearchConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSearchConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSearchConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAnnotation without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateAnnotationRequest() - ); - request.annotation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateAnnotationRequest', ['annotation', 'name']); - request.annotation.name = defaultValue1; - const expectedHeaderRequestParams = `annotation.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Annotation() - ); - client.innerApiCalls.updateAnnotation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAnnotation( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IAnnotation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAnnotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAnnotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSearchConfig with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateSearchConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateSearchConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSearchConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createSearchConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createSearchConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSearchConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAnnotation with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateAnnotationRequest() - ); - request.annotation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateAnnotationRequest', ['annotation', 'name']); - request.annotation.name = defaultValue1; - const expectedHeaderRequestParams = `annotation.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAnnotation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAnnotation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAnnotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAnnotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSearchConfig with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateSearchConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateSearchConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createSearchConfig(request), expectedError); + }); + }); + + describe('updateSearchConfig', () => { + it('invokes updateSearchConfig without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateSearchConfigRequest(), + ); + request.searchConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateSearchConfigRequest', + ['searchConfig', 'name'], + ); + request.searchConfig.name = defaultValue1; + const expectedHeaderRequestParams = `search_config.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ); + client.innerApiCalls.updateSearchConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.updateSearchConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSearchConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSearchConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateAnnotation with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateAnnotationRequest() - ); - request.annotation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateAnnotationRequest', ['annotation', 'name']); - request.annotation.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateAnnotation(request), expectedError); - }); + it('invokes updateSearchConfig without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateSearchConfigRequest(), + ); + request.searchConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateSearchConfigRequest', + ['searchConfig', 'name'], + ); + request.searchConfig.name = defaultValue1; + const expectedHeaderRequestParams = `search_config.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ); + client.innerApiCalls.updateSearchConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSearchConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ISearchConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSearchConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSearchConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteAnnotation', () => { - it('invokes deleteAnnotation without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteAnnotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteAnnotationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAnnotation = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAnnotation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAnnotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAnnotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSearchConfig with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateSearchConfigRequest(), + ); + request.searchConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateSearchConfigRequest', + ['searchConfig', 'name'], + ); + request.searchConfig.name = defaultValue1; + const expectedHeaderRequestParams = `search_config.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSearchConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateSearchConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSearchConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSearchConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAnnotation without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteAnnotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteAnnotationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAnnotation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAnnotation( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAnnotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAnnotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSearchConfig with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateSearchConfigRequest(), + ); + request.searchConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateSearchConfigRequest', + ['searchConfig', 'name'], + ); + request.searchConfig.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateSearchConfig(request), expectedError); + }); + }); + + describe('getSearchConfig', () => { + it('invokes getSearchConfig without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetSearchConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetSearchConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ); + client.innerApiCalls.getSearchConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getSearchConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSearchConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSearchConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAnnotation with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteAnnotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteAnnotationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAnnotation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAnnotation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAnnotation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAnnotation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSearchConfig without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetSearchConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetSearchConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ); + client.innerApiCalls.getSearchConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSearchConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ISearchConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSearchConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSearchConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAnnotation with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteAnnotationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteAnnotationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteAnnotation(request), expectedError); - }); + it('invokes getSearchConfig with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetSearchConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetSearchConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSearchConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getSearchConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSearchConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSearchConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('clipAsset', () => { - it('invokes clipAsset without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ClipAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ClipAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.ClipAssetResponse() - ); - client.innerApiCalls.clipAsset = stubSimpleCall(expectedResponse); - const [response] = await client.clipAsset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.clipAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clipAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSearchConfig with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetSearchConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetSearchConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getSearchConfig(request), expectedError); + }); + }); + + describe('deleteSearchConfig', () => { + it('invokes deleteSearchConfig without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteSearchConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteSearchConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteSearchConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteSearchConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSearchConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSearchConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes clipAsset without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ClipAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ClipAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.ClipAssetResponse() - ); - client.innerApiCalls.clipAsset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.clipAsset( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IClipAssetResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.clipAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clipAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSearchConfig without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteSearchConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteSearchConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteSearchConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSearchConfig( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSearchConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSearchConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes clipAsset with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ClipAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ClipAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.clipAsset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.clipAsset(request), expectedError); - const actualRequest = (client.innerApiCalls.clipAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clipAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSearchConfig with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteSearchConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteSearchConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSearchConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteSearchConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSearchConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSearchConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes clipAsset with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ClipAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ClipAssetRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.clipAsset(request), expectedError); - }); + it('invokes deleteSearchConfig with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteSearchConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteSearchConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteSearchConfig(request), expectedError); + }); + }); + + describe('createSearchHypernym', () => { + it('invokes createSearchHypernym without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateSearchHypernymRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateSearchHypernymRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ); + client.innerApiCalls.createSearchHypernym = + stubSimpleCall(expectedResponse); + const [response] = await client.createSearchHypernym(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSearchHypernym as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSearchHypernym as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('generateHlsUri', () => { - it('invokes generateHlsUri without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateHlsUriRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GenerateHlsUriRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateHlsUriResponse() - ); - client.innerApiCalls.generateHlsUri = stubSimpleCall(expectedResponse); - const [response] = await client.generateHlsUri(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateHlsUri as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateHlsUri as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSearchHypernym without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateSearchHypernymRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateSearchHypernymRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ); + client.innerApiCalls.createSearchHypernym = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSearchHypernym( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ISearchHypernym | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSearchHypernym as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSearchHypernym as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes generateHlsUri without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateHlsUriRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GenerateHlsUriRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateHlsUriResponse() - ); - client.innerApiCalls.generateHlsUri = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateHlsUri( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IGenerateHlsUriResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateHlsUri as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateHlsUri as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSearchHypernym with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateSearchHypernymRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateSearchHypernymRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSearchHypernym = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createSearchHypernym(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createSearchHypernym as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSearchHypernym as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes generateHlsUri with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateHlsUriRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GenerateHlsUriRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateHlsUri = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateHlsUri(request), expectedError); - const actualRequest = (client.innerApiCalls.generateHlsUri as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateHlsUri as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSearchHypernym with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateSearchHypernymRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateSearchHypernymRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createSearchHypernym(request), expectedError); + }); + }); + + describe('updateSearchHypernym', () => { + it('invokes updateSearchHypernym without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateSearchHypernymRequest(), + ); + request.searchHypernym ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateSearchHypernymRequest', + ['searchHypernym', 'name'], + ); + request.searchHypernym.name = defaultValue1; + const expectedHeaderRequestParams = `search_hypernym.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ); + client.innerApiCalls.updateSearchHypernym = + stubSimpleCall(expectedResponse); + const [response] = await client.updateSearchHypernym(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSearchHypernym as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSearchHypernym as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes generateHlsUri with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GenerateHlsUriRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GenerateHlsUriRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.generateHlsUri(request), expectedError); - }); + it('invokes updateSearchHypernym without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateSearchHypernymRequest(), + ); + request.searchHypernym ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateSearchHypernymRequest', + ['searchHypernym', 'name'], + ); + request.searchHypernym.name = defaultValue1; + const expectedHeaderRequestParams = `search_hypernym.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ); + client.innerApiCalls.updateSearchHypernym = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSearchHypernym( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ISearchHypernym | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSearchHypernym as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSearchHypernym as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createSearchConfig', () => { - it('invokes createSearchConfig without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateSearchConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateSearchConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchConfig() - ); - client.innerApiCalls.createSearchConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createSearchConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSearchConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSearchConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSearchHypernym with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateSearchHypernymRequest(), + ); + request.searchHypernym ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateSearchHypernymRequest', + ['searchHypernym', 'name'], + ); + request.searchHypernym.name = defaultValue1; + const expectedHeaderRequestParams = `search_hypernym.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSearchHypernym = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateSearchHypernym(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSearchHypernym as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSearchHypernym as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSearchConfig without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateSearchConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateSearchConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchConfig() - ); - client.innerApiCalls.createSearchConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSearchConfig( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ISearchConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSearchConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSearchConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSearchHypernym with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateSearchHypernymRequest(), + ); + request.searchHypernym ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateSearchHypernymRequest', + ['searchHypernym', 'name'], + ); + request.searchHypernym.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateSearchHypernym(request), expectedError); + }); + }); + + describe('getSearchHypernym', () => { + it('invokes getSearchHypernym without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetSearchHypernymRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetSearchHypernymRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ); + client.innerApiCalls.getSearchHypernym = stubSimpleCall(expectedResponse); + const [response] = await client.getSearchHypernym(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSearchHypernym as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSearchHypernym as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSearchConfig with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateSearchConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateSearchConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSearchConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSearchConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createSearchConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSearchConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSearchHypernym without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetSearchHypernymRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetSearchHypernymRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ); + client.innerApiCalls.getSearchHypernym = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSearchHypernym( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ISearchHypernym | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSearchHypernym as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSearchHypernym as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSearchConfig with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateSearchConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateSearchConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createSearchConfig(request), expectedError); - }); + it('invokes getSearchHypernym with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetSearchHypernymRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetSearchHypernymRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSearchHypernym = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getSearchHypernym(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSearchHypernym as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSearchHypernym as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateSearchConfig', () => { - it('invokes updateSearchConfig without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateSearchConfigRequest() - ); - request.searchConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateSearchConfigRequest', ['searchConfig', 'name']); - request.searchConfig.name = defaultValue1; - const expectedHeaderRequestParams = `search_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchConfig() - ); - client.innerApiCalls.updateSearchConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateSearchConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSearchConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSearchConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSearchHypernym with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetSearchHypernymRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetSearchHypernymRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getSearchHypernym(request), expectedError); + }); + }); + + describe('deleteSearchHypernym', () => { + it('invokes deleteSearchHypernym without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteSearchHypernymRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteSearchHypernymRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteSearchHypernym = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteSearchHypernym(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSearchHypernym as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSearchHypernym as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSearchConfig without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateSearchConfigRequest() - ); - request.searchConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateSearchConfigRequest', ['searchConfig', 'name']); - request.searchConfig.name = defaultValue1; - const expectedHeaderRequestParams = `search_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchConfig() - ); - client.innerApiCalls.updateSearchConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSearchConfig( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ISearchConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSearchConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSearchConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSearchHypernym without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteSearchHypernymRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteSearchHypernymRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteSearchHypernym = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSearchHypernym( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSearchHypernym as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSearchHypernym as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSearchConfig with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateSearchConfigRequest() - ); - request.searchConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateSearchConfigRequest', ['searchConfig', 'name']); - request.searchConfig.name = defaultValue1; - const expectedHeaderRequestParams = `search_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSearchConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSearchConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSearchConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSearchConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSearchHypernym with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteSearchHypernymRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteSearchHypernymRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSearchHypernym = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteSearchHypernym(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSearchHypernym as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSearchHypernym as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSearchConfig with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateSearchConfigRequest() - ); - request.searchConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateSearchConfigRequest', ['searchConfig', 'name']); - request.searchConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateSearchConfig(request), expectedError); - }); + it('invokes deleteSearchHypernym with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteSearchHypernymRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteSearchHypernymRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteSearchHypernym(request), expectedError); + }); + }); + + describe('getIndexEndpoint', () => { + it('invokes getIndexEndpoint without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetIndexEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexEndpoint(), + ); + client.innerApiCalls.getIndexEndpoint = stubSimpleCall(expectedResponse); + const [response] = await client.getIndexEndpoint(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getSearchConfig', () => { - it('invokes getSearchConfig without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetSearchConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetSearchConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchConfig() - ); - client.innerApiCalls.getSearchConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getSearchConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSearchConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSearchConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getIndexEndpoint without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetIndexEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexEndpoint(), + ); + client.innerApiCalls.getIndexEndpoint = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIndexEndpoint( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IIndexEndpoint | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSearchConfig without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetSearchConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetSearchConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchConfig() - ); - client.innerApiCalls.getSearchConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSearchConfig( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ISearchConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSearchConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSearchConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getIndexEndpoint with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetIndexEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIndexEndpoint = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getIndexEndpoint(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSearchConfig with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetSearchConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetSearchConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSearchConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSearchConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getSearchConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSearchConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getIndexEndpoint with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetIndexEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getIndexEndpoint(request), expectedError); + }); + }); + + describe('getCollection', () => { + it('invokes getCollection without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetCollectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetCollectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Collection(), + ); + client.innerApiCalls.getCollection = stubSimpleCall(expectedResponse); + const [response] = await client.getCollection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCollection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCollection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSearchConfig with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetSearchConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetSearchConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSearchConfig(request), expectedError); - }); + it('invokes getCollection without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetCollectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetCollectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Collection(), + ); + client.innerApiCalls.getCollection = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCollection( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ICollection | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCollection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCollection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteSearchConfig', () => { - it('invokes deleteSearchConfig without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteSearchConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteSearchConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSearchConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSearchConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSearchConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSearchConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getCollection with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetCollectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetCollectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCollection = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getCollection(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getCollection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCollection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSearchConfig without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteSearchConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteSearchConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSearchConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSearchConfig( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSearchConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSearchConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getCollection with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.GetCollectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.GetCollectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getCollection(request), expectedError); + }); + }); + + describe('updateCollection', () => { + it('invokes updateCollection without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateCollectionRequest(), + ); + request.collection ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateCollectionRequest', + ['collection', 'name'], + ); + request.collection.name = defaultValue1; + const expectedHeaderRequestParams = `collection.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Collection(), + ); + client.innerApiCalls.updateCollection = stubSimpleCall(expectedResponse); + const [response] = await client.updateCollection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCollection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCollection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSearchConfig with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteSearchConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteSearchConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSearchConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSearchConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSearchConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSearchConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateCollection without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateCollectionRequest(), + ); + request.collection ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateCollectionRequest', + ['collection', 'name'], + ); + request.collection.name = defaultValue1; + const expectedHeaderRequestParams = `collection.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.Collection(), + ); + client.innerApiCalls.updateCollection = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCollection( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ICollection | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCollection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCollection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSearchConfig with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteSearchConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteSearchConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteSearchConfig(request), expectedError); - }); + it('invokes updateCollection with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateCollectionRequest(), + ); + request.collection ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateCollectionRequest', + ['collection', 'name'], + ); + request.collection.name = defaultValue1; + const expectedHeaderRequestParams = `collection.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCollection = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateCollection(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateCollection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCollection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createSearchHypernym', () => { - it('invokes createSearchHypernym without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateSearchHypernymRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateSearchHypernymRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchHypernym() - ); - client.innerApiCalls.createSearchHypernym = stubSimpleCall(expectedResponse); - const [response] = await client.createSearchHypernym(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSearchHypernym as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSearchHypernym as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateCollection with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateCollectionRequest(), + ); + request.collection ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateCollectionRequest', + ['collection', 'name'], + ); + request.collection.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateCollection(request), expectedError); + }); + }); + + describe('addCollectionItem', () => { + it('invokes addCollectionItem without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AddCollectionItemRequest(), + ); + request.item ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AddCollectionItemRequest', + ['item', 'collection'], + ); + request.item.collection = defaultValue1; + const expectedHeaderRequestParams = `item.collection=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.AddCollectionItemResponse(), + ); + client.innerApiCalls.addCollectionItem = stubSimpleCall(expectedResponse); + const [response] = await client.addCollectionItem(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addCollectionItem as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addCollectionItem as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSearchHypernym without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateSearchHypernymRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateSearchHypernymRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchHypernym() - ); - client.innerApiCalls.createSearchHypernym = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSearchHypernym( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ISearchHypernym|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSearchHypernym as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSearchHypernym as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addCollectionItem without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AddCollectionItemRequest(), + ); + request.item ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AddCollectionItemRequest', + ['item', 'collection'], + ); + request.item.collection = defaultValue1; + const expectedHeaderRequestParams = `item.collection=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.AddCollectionItemResponse(), + ); + client.innerApiCalls.addCollectionItem = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addCollectionItem( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IAddCollectionItemResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addCollectionItem as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addCollectionItem as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSearchHypernym with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateSearchHypernymRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateSearchHypernymRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSearchHypernym = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSearchHypernym(request), expectedError); - const actualRequest = (client.innerApiCalls.createSearchHypernym as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSearchHypernym as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addCollectionItem with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AddCollectionItemRequest(), + ); + request.item ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AddCollectionItemRequest', + ['item', 'collection'], + ); + request.item.collection = defaultValue1; + const expectedHeaderRequestParams = `item.collection=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addCollectionItem = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.addCollectionItem(request), expectedError); + const actualRequest = ( + client.innerApiCalls.addCollectionItem as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addCollectionItem as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSearchHypernym with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateSearchHypernymRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateSearchHypernymRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createSearchHypernym(request), expectedError); - }); + it('invokes addCollectionItem with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AddCollectionItemRequest(), + ); + request.item ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AddCollectionItemRequest', + ['item', 'collection'], + ); + request.item.collection = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.addCollectionItem(request), expectedError); + }); + }); + + describe('removeCollectionItem', () => { + it('invokes removeCollectionItem without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RemoveCollectionItemRequest(), + ); + request.item ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RemoveCollectionItemRequest', + ['item', 'collection'], + ); + request.item.collection = defaultValue1; + const expectedHeaderRequestParams = `item.collection=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.RemoveCollectionItemResponse(), + ); + client.innerApiCalls.removeCollectionItem = + stubSimpleCall(expectedResponse); + const [response] = await client.removeCollectionItem(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.removeCollectionItem as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeCollectionItem as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateSearchHypernym', () => { - it('invokes updateSearchHypernym without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateSearchHypernymRequest() - ); - request.searchHypernym ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateSearchHypernymRequest', ['searchHypernym', 'name']); - request.searchHypernym.name = defaultValue1; - const expectedHeaderRequestParams = `search_hypernym.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchHypernym() - ); - client.innerApiCalls.updateSearchHypernym = stubSimpleCall(expectedResponse); - const [response] = await client.updateSearchHypernym(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSearchHypernym as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSearchHypernym as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes removeCollectionItem without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RemoveCollectionItemRequest(), + ); + request.item ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RemoveCollectionItemRequest', + ['item', 'collection'], + ); + request.item.collection = defaultValue1; + const expectedHeaderRequestParams = `item.collection=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.RemoveCollectionItemResponse(), + ); + client.innerApiCalls.removeCollectionItem = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeCollectionItem( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.removeCollectionItem as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeCollectionItem as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSearchHypernym without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateSearchHypernymRequest() - ); - request.searchHypernym ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateSearchHypernymRequest', ['searchHypernym', 'name']); - request.searchHypernym.name = defaultValue1; - const expectedHeaderRequestParams = `search_hypernym.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchHypernym() - ); - client.innerApiCalls.updateSearchHypernym = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSearchHypernym( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ISearchHypernym|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSearchHypernym as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSearchHypernym as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes removeCollectionItem with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RemoveCollectionItemRequest(), + ); + request.item ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RemoveCollectionItemRequest', + ['item', 'collection'], + ); + request.item.collection = defaultValue1; + const expectedHeaderRequestParams = `item.collection=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeCollectionItem = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.removeCollectionItem(request), expectedError); + const actualRequest = ( + client.innerApiCalls.removeCollectionItem as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeCollectionItem as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSearchHypernym with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateSearchHypernymRequest() - ); - request.searchHypernym ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateSearchHypernymRequest', ['searchHypernym', 'name']); - request.searchHypernym.name = defaultValue1; - const expectedHeaderRequestParams = `search_hypernym.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSearchHypernym = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSearchHypernym(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSearchHypernym as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSearchHypernym as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes removeCollectionItem with closed client', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RemoveCollectionItemRequest(), + ); + request.item ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RemoveCollectionItemRequest', + ['item', 'collection'], + ); + request.item.collection = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.removeCollectionItem(request), expectedError); + }); + }); + + describe('deleteAsset', () => { + it('invokes deleteAsset without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAsset = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteAsset(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSearchHypernym with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateSearchHypernymRequest() - ); - request.searchHypernym ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateSearchHypernymRequest', ['searchHypernym', 'name']); - request.searchHypernym.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateSearchHypernym(request), expectedError); - }); + it('invokes deleteAsset without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteAsset = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAsset( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteAssetMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteAssetMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getSearchHypernym', () => { - it('invokes getSearchHypernym without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetSearchHypernymRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetSearchHypernymRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchHypernym() - ); - client.innerApiCalls.getSearchHypernym = stubSimpleCall(expectedResponse); - const [response] = await client.getSearchHypernym(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSearchHypernym as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSearchHypernym as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAsset with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAsset = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteAsset(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSearchHypernym without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetSearchHypernymRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetSearchHypernymRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchHypernym() - ); - client.innerApiCalls.getSearchHypernym = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSearchHypernym( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ISearchHypernym|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSearchHypernym as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSearchHypernym as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteAsset with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAsset = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteAsset(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSearchHypernym with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetSearchHypernymRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetSearchHypernymRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSearchHypernym = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSearchHypernym(request), expectedError); - const actualRequest = (client.innerApiCalls.getSearchHypernym as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSearchHypernym as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteAssetProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteAssetProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes getSearchHypernym with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetSearchHypernymRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetSearchHypernymRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSearchHypernym(request), expectedError); - }); + it('invokes checkDeleteAssetProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkDeleteAssetProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('uploadAsset', () => { + it('invokes uploadAsset without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UploadAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UploadAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.uploadAsset = stubLongRunningCall(expectedResponse); + const [operation] = await client.uploadAsset(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.uploadAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.uploadAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteSearchHypernym', () => { - it('invokes deleteSearchHypernym without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteSearchHypernymRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteSearchHypernymRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSearchHypernym = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSearchHypernym(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSearchHypernym as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSearchHypernym as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes uploadAsset without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UploadAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UploadAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.uploadAsset = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.uploadAsset( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IUploadAssetResponse, + protos.google.cloud.visionai.v1.IUploadAssetMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IUploadAssetResponse, + protos.google.cloud.visionai.v1.IUploadAssetMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.uploadAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.uploadAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSearchHypernym without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteSearchHypernymRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteSearchHypernymRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSearchHypernym = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSearchHypernym( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSearchHypernym as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSearchHypernym as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes uploadAsset with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UploadAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UploadAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.uploadAsset = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.uploadAsset(request), expectedError); + const actualRequest = ( + client.innerApiCalls.uploadAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.uploadAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSearchHypernym with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteSearchHypernymRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteSearchHypernymRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSearchHypernym = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSearchHypernym(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSearchHypernym as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSearchHypernym as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes uploadAsset with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UploadAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UploadAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.uploadAsset = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.uploadAsset(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.uploadAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.uploadAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSearchHypernym with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteSearchHypernymRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteSearchHypernymRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteSearchHypernym(request), expectedError); - }); + it('invokes checkUploadAssetProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUploadAssetProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('getIndexEndpoint', () => { - it('invokes getIndexEndpoint without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetIndexEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.IndexEndpoint() - ); - client.innerApiCalls.getIndexEndpoint = stubSimpleCall(expectedResponse); - const [response] = await client.getIndexEndpoint(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUploadAssetProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkUploadAssetProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('analyzeAsset', () => { + it('invokes analyzeAsset without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AnalyzeAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AnalyzeAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.analyzeAsset = stubLongRunningCall(expectedResponse); + const [operation] = await client.analyzeAsset(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.analyzeAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.analyzeAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getIndexEndpoint without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetIndexEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.IndexEndpoint() - ); - client.innerApiCalls.getIndexEndpoint = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIndexEndpoint( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IIndexEndpoint|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes analyzeAsset without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AnalyzeAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AnalyzeAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.analyzeAsset = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeAsset( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IAnalyzeAssetResponse, + protos.google.cloud.visionai.v1.IAnalyzeAssetMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IAnalyzeAssetResponse, + protos.google.cloud.visionai.v1.IAnalyzeAssetMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.analyzeAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.analyzeAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getIndexEndpoint with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetIndexEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIndexEndpoint = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIndexEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.getIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes analyzeAsset with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AnalyzeAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AnalyzeAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeAsset = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.analyzeAsset(request), expectedError); + const actualRequest = ( + client.innerApiCalls.analyzeAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.analyzeAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getIndexEndpoint with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetIndexEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getIndexEndpoint(request), expectedError); - }); + it('invokes analyzeAsset with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AnalyzeAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AnalyzeAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeAsset = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.analyzeAsset(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.analyzeAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.analyzeAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getCollection', () => { - it('invokes getCollection without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetCollectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetCollectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Collection() - ); - client.innerApiCalls.getCollection = stubSimpleCall(expectedResponse); - const [response] = await client.getCollection(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCollection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCollection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkAnalyzeAssetProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAnalyzeAssetProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes getCollection without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetCollectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetCollectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Collection() - ); - client.innerApiCalls.getCollection = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCollection( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ICollection|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCollection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCollection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkAnalyzeAssetProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkAnalyzeAssetProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('indexAsset', () => { + it('invokes indexAsset without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.IndexAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.indexAsset = stubLongRunningCall(expectedResponse); + const [operation] = await client.indexAsset(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.indexAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.indexAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getCollection with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetCollectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetCollectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCollection = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCollection(request), expectedError); - const actualRequest = (client.innerApiCalls.getCollection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCollection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes indexAsset without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.IndexAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.indexAsset = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.indexAsset( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IIndexAssetResponse, + protos.google.cloud.visionai.v1.IIndexAssetMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IIndexAssetResponse, + protos.google.cloud.visionai.v1.IIndexAssetMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.indexAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.indexAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getCollection with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.GetCollectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.GetCollectionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getCollection(request), expectedError); - }); + it('invokes indexAsset with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.IndexAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.indexAsset = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.indexAsset(request), expectedError); + const actualRequest = ( + client.innerApiCalls.indexAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.indexAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateCollection', () => { - it('invokes updateCollection without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateCollectionRequest() - ); - request.collection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateCollectionRequest', ['collection', 'name']); - request.collection.name = defaultValue1; - const expectedHeaderRequestParams = `collection.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Collection() - ); - client.innerApiCalls.updateCollection = stubSimpleCall(expectedResponse); - const [response] = await client.updateCollection(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCollection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCollection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes indexAsset with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.IndexAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.indexAsset = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.indexAsset(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.indexAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.indexAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateCollection without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateCollectionRequest() - ); - request.collection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateCollectionRequest', ['collection', 'name']); - request.collection.name = defaultValue1; - const expectedHeaderRequestParams = `collection.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.Collection() - ); - client.innerApiCalls.updateCollection = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCollection( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ICollection|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCollection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCollection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkIndexAssetProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkIndexAssetProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateCollection with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateCollectionRequest() - ); - request.collection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateCollectionRequest', ['collection', 'name']); - request.collection.name = defaultValue1; - const expectedHeaderRequestParams = `collection.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCollection = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCollection(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCollection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCollection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkIndexAssetProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkIndexAssetProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('removeIndexAsset', () => { + it('invokes removeIndexAsset without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RemoveIndexAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RemoveIndexAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.removeIndexAsset = + stubLongRunningCall(expectedResponse); + const [operation] = await client.removeIndexAsset(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.removeIndexAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeIndexAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateCollection with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateCollectionRequest() - ); - request.collection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateCollectionRequest', ['collection', 'name']); - request.collection.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateCollection(request), expectedError); - }); + it('invokes removeIndexAsset without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RemoveIndexAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RemoveIndexAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.removeIndexAsset = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeIndexAsset( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IRemoveIndexAssetResponse, + protos.google.cloud.visionai.v1.IRemoveIndexAssetMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IRemoveIndexAssetResponse, + protos.google.cloud.visionai.v1.IRemoveIndexAssetMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.removeIndexAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeIndexAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('addCollectionItem', () => { - it('invokes addCollectionItem without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AddCollectionItemRequest() - ); - request.item ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AddCollectionItemRequest', ['item', 'collection']); - request.item.collection = defaultValue1; - const expectedHeaderRequestParams = `item.collection=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.AddCollectionItemResponse() - ); - client.innerApiCalls.addCollectionItem = stubSimpleCall(expectedResponse); - const [response] = await client.addCollectionItem(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addCollectionItem as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addCollectionItem as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes removeIndexAsset with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RemoveIndexAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RemoveIndexAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeIndexAsset = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.removeIndexAsset(request), expectedError); + const actualRequest = ( + client.innerApiCalls.removeIndexAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeIndexAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addCollectionItem without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AddCollectionItemRequest() - ); - request.item ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AddCollectionItemRequest', ['item', 'collection']); - request.item.collection = defaultValue1; - const expectedHeaderRequestParams = `item.collection=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.AddCollectionItemResponse() - ); - client.innerApiCalls.addCollectionItem = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addCollectionItem( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IAddCollectionItemResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addCollectionItem as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addCollectionItem as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes removeIndexAsset with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.RemoveIndexAssetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.RemoveIndexAssetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeIndexAsset = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.removeIndexAsset(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.removeIndexAsset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeIndexAsset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addCollectionItem with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AddCollectionItemRequest() - ); - request.item ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AddCollectionItemRequest', ['item', 'collection']); - request.item.collection = defaultValue1; - const expectedHeaderRequestParams = `item.collection=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addCollectionItem = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.addCollectionItem(request), expectedError); - const actualRequest = (client.innerApiCalls.addCollectionItem as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addCollectionItem as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkRemoveIndexAssetProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRemoveIndexAssetProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes addCollectionItem with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AddCollectionItemRequest() - ); - request.item ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AddCollectionItemRequest', ['item', 'collection']); - request.item.collection = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.addCollectionItem(request), expectedError); - }); + it('invokes checkRemoveIndexAssetProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkRemoveIndexAssetProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createIndex', () => { + it('invokes createIndex without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateIndexRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createIndex = stubLongRunningCall(expectedResponse); + const [operation] = await client.createIndex(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('removeCollectionItem', () => { - it('invokes removeCollectionItem without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RemoveCollectionItemRequest() - ); - request.item ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RemoveCollectionItemRequest', ['item', 'collection']); - request.item.collection = defaultValue1; - const expectedHeaderRequestParams = `item.collection=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.RemoveCollectionItemResponse() - ); - client.innerApiCalls.removeCollectionItem = stubSimpleCall(expectedResponse); - const [response] = await client.removeCollectionItem(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeCollectionItem as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeCollectionItem as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createIndex without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateIndexRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createIndex = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createIndex( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.ICreateIndexMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.ICreateIndexMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes removeCollectionItem without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RemoveCollectionItemRequest() - ); - request.item ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RemoveCollectionItemRequest', ['item', 'collection']); - request.item.collection = defaultValue1; - const expectedHeaderRequestParams = `item.collection=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.RemoveCollectionItemResponse() - ); - client.innerApiCalls.removeCollectionItem = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeCollectionItem( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IRemoveCollectionItemResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeCollectionItem as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeCollectionItem as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createIndex with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateIndexRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createIndex = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createIndex(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes removeCollectionItem with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RemoveCollectionItemRequest() - ); - request.item ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RemoveCollectionItemRequest', ['item', 'collection']); - request.item.collection = defaultValue1; - const expectedHeaderRequestParams = `item.collection=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeCollectionItem = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.removeCollectionItem(request), expectedError); - const actualRequest = (client.innerApiCalls.removeCollectionItem as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeCollectionItem as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createIndex with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateIndexRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createIndex = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createIndex(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes removeCollectionItem with closed client', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RemoveCollectionItemRequest() - ); - request.item ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RemoveCollectionItemRequest', ['item', 'collection']); - request.item.collection = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.removeCollectionItem(request), expectedError); - }); + it('invokes checkCreateIndexProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateIndexProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteAsset', () => { - it('invokes deleteAsset without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAsset = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteAsset(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateIndexProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkCreateIndexProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateIndex', () => { + it('invokes updateIndex without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateIndexRequest(), + ); + request.index ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateIndexRequest', + ['index', 'name'], + ); + request.index.name = defaultValue1; + const expectedHeaderRequestParams = `index.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateIndex = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateIndex(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAsset without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteAsset = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAsset( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateIndex without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateIndexRequest(), + ); + request.index ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateIndexRequest', + ['index', 'name'], + ); + request.index.name = defaultValue1; + const expectedHeaderRequestParams = `index.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateIndex = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateIndex( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IUpdateIndexMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IIndex, + protos.google.cloud.visionai.v1.IUpdateIndexMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAsset with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAsset = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteAsset(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateIndex with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateIndexRequest(), + ); + request.index ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateIndexRequest', + ['index', 'name'], + ); + request.index.name = defaultValue1; + const expectedHeaderRequestParams = `index.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIndex = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateIndex(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteAsset with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAsset = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteAsset(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateIndex with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateIndexRequest(), + ); + request.index ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateIndexRequest', + ['index', 'name'], + ); + request.index.name = defaultValue1; + const expectedHeaderRequestParams = `index.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIndex = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateIndex(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteAssetProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteAssetProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateIndexProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateIndexProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteAssetProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteAssetProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateIndexProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkUpdateIndexProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteIndex', () => { + it('invokes deleteIndex without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteIndex = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteIndex(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('uploadAsset', () => { - it('invokes uploadAsset without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UploadAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UploadAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.uploadAsset = stubLongRunningCall(expectedResponse); - const [operation] = await client.uploadAsset(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.uploadAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.uploadAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteIndex without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteIndex = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteIndex( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes uploadAsset without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UploadAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UploadAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.uploadAsset = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.uploadAsset( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.uploadAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.uploadAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteIndex with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIndex = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteIndex(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes uploadAsset with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UploadAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UploadAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.uploadAsset = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.uploadAsset(request), expectedError); - const actualRequest = (client.innerApiCalls.uploadAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.uploadAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteIndex with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteIndexRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIndex = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteIndex(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes uploadAsset with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UploadAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UploadAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.uploadAsset = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.uploadAsset(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.uploadAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.uploadAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteIndexProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteIndexProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUploadAssetProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUploadAssetProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteIndexProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkDeleteIndexProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createCorpus', () => { + it('invokes createCorpus without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateCorpusRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createCorpus = stubLongRunningCall(expectedResponse); + const [operation] = await client.createCorpus(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUploadAssetProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUploadAssetProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createCorpus without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateCorpusRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createCorpus = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCorpus( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.ICreateCorpusMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.ICorpus, + protos.google.cloud.visionai.v1.ICreateCorpusMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('analyzeAsset', () => { - it('invokes analyzeAsset without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AnalyzeAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AnalyzeAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.analyzeAsset = stubLongRunningCall(expectedResponse); - const [operation] = await client.analyzeAsset(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.analyzeAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createCorpus with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateCorpusRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCorpus = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createCorpus(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes analyzeAsset without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AnalyzeAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AnalyzeAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.analyzeAsset = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeAsset( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.analyzeAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createCorpus with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateCorpusRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCorpus = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createCorpus(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes analyzeAsset with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AnalyzeAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AnalyzeAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeAsset = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.analyzeAsset(request), expectedError); - const actualRequest = (client.innerApiCalls.analyzeAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateCorpusProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateCorpusProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes analyzeAsset with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AnalyzeAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AnalyzeAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeAsset = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.analyzeAsset(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.analyzeAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateCorpusProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkCreateCorpusProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('analyzeCorpus', () => { + it('invokes analyzeCorpus without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AnalyzeCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AnalyzeCorpusRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.analyzeCorpus = + stubLongRunningCall(expectedResponse); + const [operation] = await client.analyzeCorpus(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.analyzeCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.analyzeCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkAnalyzeAssetProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAnalyzeAssetProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes analyzeCorpus without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AnalyzeCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AnalyzeCorpusRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.analyzeCorpus = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeCorpus( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IAnalyzeCorpusResponse, + protos.google.cloud.visionai.v1.IAnalyzeCorpusMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IAnalyzeCorpusResponse, + protos.google.cloud.visionai.v1.IAnalyzeCorpusMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.analyzeCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.analyzeCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkAnalyzeAssetProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAnalyzeAssetProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes analyzeCorpus with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AnalyzeCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AnalyzeCorpusRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeCorpus = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.analyzeCorpus(request), expectedError); + const actualRequest = ( + client.innerApiCalls.analyzeCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.analyzeCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('indexAsset', () => { - it('invokes indexAsset without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.IndexAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.IndexAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.indexAsset = stubLongRunningCall(expectedResponse); - const [operation] = await client.indexAsset(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.indexAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.indexAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes analyzeCorpus with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.AnalyzeCorpusRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.AnalyzeCorpusRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeCorpus = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.analyzeCorpus(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.analyzeCorpus as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.analyzeCorpus as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes indexAsset without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.IndexAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.IndexAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.indexAsset = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.indexAsset( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.indexAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.indexAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkAnalyzeCorpusProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAnalyzeCorpusProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes indexAsset with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.IndexAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.IndexAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.indexAsset = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.indexAsset(request), expectedError); - const actualRequest = (client.innerApiCalls.indexAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.indexAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkAnalyzeCorpusProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkAnalyzeCorpusProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('importAssets', () => { + it('invokes importAssets without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ImportAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ImportAssetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.importAssets = stubLongRunningCall(expectedResponse); + const [operation] = await client.importAssets(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importAssets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importAssets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes indexAsset with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.IndexAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.IndexAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.indexAsset = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.indexAsset(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.indexAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.indexAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes importAssets without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ImportAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ImportAssetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.importAssets = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importAssets( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IImportAssetsResponse, + protos.google.cloud.visionai.v1.IImportAssetsMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IImportAssetsResponse, + protos.google.cloud.visionai.v1.IImportAssetsMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importAssets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importAssets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkIndexAssetProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkIndexAssetProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes importAssets with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ImportAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ImportAssetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAssets = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.importAssets(request), expectedError); + const actualRequest = ( + client.innerApiCalls.importAssets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importAssets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkIndexAssetProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkIndexAssetProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes importAssets with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ImportAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ImportAssetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAssets = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.importAssets(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.importAssets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importAssets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('removeIndexAsset', () => { - it('invokes removeIndexAsset without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RemoveIndexAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RemoveIndexAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeIndexAsset = stubLongRunningCall(expectedResponse); - const [operation] = await client.removeIndexAsset(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeIndexAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeIndexAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkImportAssetsProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkImportAssetsProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes removeIndexAsset without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RemoveIndexAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RemoveIndexAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeIndexAsset = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeIndexAsset( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeIndexAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeIndexAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkImportAssetsProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkImportAssetsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createIndexEndpoint', () => { + it('invokes createIndexEndpoint without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateIndexEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createIndexEndpoint = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createIndexEndpoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes removeIndexAsset with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RemoveIndexAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RemoveIndexAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeIndexAsset = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.removeIndexAsset(request), expectedError); - const actualRequest = (client.innerApiCalls.removeIndexAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeIndexAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createIndexEndpoint without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateIndexEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createIndexEndpoint = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createIndexEndpoint( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.ICreateIndexEndpointMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.ICreateIndexEndpointMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes removeIndexAsset with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.RemoveIndexAssetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.RemoveIndexAssetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeIndexAsset = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.removeIndexAsset(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.removeIndexAsset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeIndexAsset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createIndexEndpoint with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateIndexEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createIndexEndpoint = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createIndexEndpoint(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkRemoveIndexAssetProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRemoveIndexAssetProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createIndexEndpoint with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateIndexEndpointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createIndexEndpoint = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createIndexEndpoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkRemoveIndexAssetProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRemoveIndexAssetProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateIndexEndpointProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateIndexEndpointProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('createIndex', () => { - it('invokes createIndex without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateIndexRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createIndex = stubLongRunningCall(expectedResponse); - const [operation] = await client.createIndex(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateIndexEndpointProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateIndexEndpointProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateIndexEndpoint', () => { + it('invokes updateIndexEndpoint without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateIndexEndpointRequest(), + ); + request.indexEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateIndexEndpointRequest', + ['indexEndpoint', 'name'], + ); + request.indexEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateIndexEndpoint = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateIndexEndpoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createIndex without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateIndexRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createIndex = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createIndex( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateIndexEndpoint without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateIndexEndpointRequest(), + ); + request.indexEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateIndexEndpointRequest', + ['indexEndpoint', 'name'], + ); + request.indexEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateIndexEndpoint = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateIndexEndpoint( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.IUpdateIndexEndpointMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IIndexEndpoint, + protos.google.cloud.visionai.v1.IUpdateIndexEndpointMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createIndex with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateIndexRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createIndex = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createIndex(request), expectedError); - const actualRequest = (client.innerApiCalls.createIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateIndexEndpoint with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateIndexEndpointRequest(), + ); + request.indexEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateIndexEndpointRequest', + ['indexEndpoint', 'name'], + ); + request.indexEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIndexEndpoint = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateIndexEndpoint(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createIndex with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateIndexRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createIndex = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createIndex(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateIndexEndpoint with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UpdateIndexEndpointRequest(), + ); + request.indexEndpoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UpdateIndexEndpointRequest', + ['indexEndpoint', 'name'], + ); + request.indexEndpoint.name = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIndexEndpoint = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateIndexEndpoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateIndexProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateIndexProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateIndexEndpointProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateIndexEndpointProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateIndexProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateIndexProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateIndexEndpointProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateIndexEndpointProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteIndexEndpoint', () => { + it('invokes deleteIndexEndpoint without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteIndexEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteIndexEndpoint = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteIndexEndpoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateIndex', () => { - it('invokes updateIndex without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateIndexRequest() - ); - request.index ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateIndexRequest', ['index', 'name']); - request.index.name = defaultValue1; - const expectedHeaderRequestParams = `index.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateIndex = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateIndex(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteIndexEndpoint without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteIndexEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteIndexEndpoint = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteIndexEndpoint( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexEndpointMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteIndexEndpointMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateIndex without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateIndexRequest() - ); - request.index ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateIndexRequest', ['index', 'name']); - request.index.name = defaultValue1; - const expectedHeaderRequestParams = `index.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateIndex = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateIndex( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteIndexEndpoint with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteIndexEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIndexEndpoint = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteIndexEndpoint(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateIndex with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateIndexRequest() - ); - request.index ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateIndexRequest', ['index', 'name']); - request.index.name = defaultValue1; - const expectedHeaderRequestParams = `index.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateIndex = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateIndex(request), expectedError); - const actualRequest = (client.innerApiCalls.updateIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteIndexEndpoint with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteIndexEndpointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIndexEndpoint = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteIndexEndpoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateIndex with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateIndexRequest() - ); - request.index ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateIndexRequest', ['index', 'name']); - request.index.name = defaultValue1; - const expectedHeaderRequestParams = `index.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateIndex = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateIndex(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteIndexEndpointProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteIndexEndpointProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateIndexProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateIndexProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteIndexEndpointProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteIndexEndpointProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deployIndex', () => { + it('invokes deployIndex without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeployIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeployIndexRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deployIndex = stubLongRunningCall(expectedResponse); + const [operation] = await client.deployIndex(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deployIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateIndexProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateIndexProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deployIndex without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeployIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeployIndexRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deployIndex = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deployIndex( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IDeployIndexResponse, + protos.google.cloud.visionai.v1.IDeployIndexMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IDeployIndexResponse, + protos.google.cloud.visionai.v1.IDeployIndexMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deployIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteIndex', () => { - it('invokes deleteIndex without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteIndexRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteIndex = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteIndex(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deployIndex with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeployIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeployIndexRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deployIndex = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deployIndex(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deployIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteIndex without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteIndexRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteIndex = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteIndex( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deployIndex with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeployIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeployIndexRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deployIndex = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deployIndex(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deployIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteIndex with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteIndexRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteIndex = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteIndex(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeployIndexProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeployIndexProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteIndex with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteIndexRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteIndex = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteIndex(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeployIndexProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkDeployIndexProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('undeployIndex', () => { + it('invokes undeployIndex without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UndeployIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UndeployIndexRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.undeployIndex = + stubLongRunningCall(expectedResponse); + const [operation] = await client.undeployIndex(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.undeployIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteIndexProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteIndexProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes undeployIndex without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UndeployIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UndeployIndexRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.undeployIndex = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.undeployIndex( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.IUndeployIndexResponse, + protos.google.cloud.visionai.v1.IUndeployIndexMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.IUndeployIndexResponse, + protos.google.cloud.visionai.v1.IUndeployIndexMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.undeployIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteIndexProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteIndexProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes undeployIndex with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UndeployIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UndeployIndexRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.undeployIndex = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.undeployIndex(request), expectedError); + const actualRequest = ( + client.innerApiCalls.undeployIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createCorpus', () => { - it('invokes createCorpus without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateCorpusRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCorpus = stubLongRunningCall(expectedResponse); - const [operation] = await client.createCorpus(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes undeployIndex with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.UndeployIndexRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.UndeployIndexRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.undeployIndex = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.undeployIndex(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.undeployIndex as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployIndex as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createCorpus without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateCorpusRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCorpus = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCorpus( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUndeployIndexProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUndeployIndexProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createCorpus with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateCorpusRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCorpus = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createCorpus(request), expectedError); - const actualRequest = (client.innerApiCalls.createCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUndeployIndexProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUndeployIndexProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createCollection', () => { + it('invokes createCollection without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateCollectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateCollectionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createCollection = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createCollection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCollection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCollection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createCorpus with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateCorpusRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCorpus = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createCorpus(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createCollection without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateCollectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateCollectionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createCollection = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCollection( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.ICreateCollectionMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.visionai.v1.ICollection, + protos.google.cloud.visionai.v1.ICreateCollectionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCollection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCollection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateCorpusProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateCorpusProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createCollection with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateCollectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateCollectionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCollection = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createCollection(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createCollection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCollection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateCorpusProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateCorpusProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createCollection with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.CreateCollectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.CreateCollectionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCollection = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createCollection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createCollection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCollection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('analyzeCorpus', () => { - it('invokes analyzeCorpus without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AnalyzeCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AnalyzeCorpusRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.analyzeCorpus = stubLongRunningCall(expectedResponse); - const [operation] = await client.analyzeCorpus(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.analyzeCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateCollectionProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateCollectionProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes analyzeCorpus without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AnalyzeCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AnalyzeCorpusRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.analyzeCorpus = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.analyzeCorpus( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.analyzeCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateCollectionProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateCollectionProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteCollection', () => { + it('invokes deleteCollection without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteCollectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteCollectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteCollection = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteCollection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteCollection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCollection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes analyzeCorpus with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AnalyzeCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AnalyzeCorpusRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeCorpus = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.analyzeCorpus(request), expectedError); - const actualRequest = (client.innerApiCalls.analyzeCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteCollection without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteCollectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteCollectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteCollection = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCollection( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCollectionMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.visionai.v1.IDeleteCollectionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteCollection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCollection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes analyzeCorpus with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.AnalyzeCorpusRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.AnalyzeCorpusRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.analyzeCorpus = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.analyzeCorpus(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.analyzeCorpus as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.analyzeCorpus as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteCollection with call error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteCollectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteCollectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCollection = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteCollection(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteCollection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCollection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkAnalyzeCorpusProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAnalyzeCorpusProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteCollection with LRO error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.DeleteCollectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.DeleteCollectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCollection = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteCollection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteCollection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCollection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkAnalyzeCorpusProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAnalyzeCorpusProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteCollectionProgress without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteCollectionProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('importAssets', () => { - it('invokes importAssets without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ImportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ImportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importAssets = stubLongRunningCall(expectedResponse); - const [operation] = await client.importAssets(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteCollectionProgress with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteCollectionProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('ingestAsset', () => { + it('invokes ingestAsset without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.IngestAssetRequest(), + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.visionai.v1.IngestAssetResponse(), + ); + client.innerApiCalls.ingestAsset = + stubBidiStreamingCall(expectedResponse); + const stream = client.ingestAsset(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.IngestAssetResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.ingestAsset as SinonStub) + .getCall(0) + .calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); + }); - it('invokes importAssets without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ImportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ImportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importAssets = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importAssets( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes ingestAsset with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.IngestAssetRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.ingestAsset = stubBidiStreamingCall( + undefined, + expectedError, + ); + const stream = client.ingestAsset(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.IngestAssetResponse) => { + resolve(response); + }, + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.ingestAsset as SinonStub) + .getCall(0) + .calledWith(null), + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request, + ); + }); + }); + + describe('listAssets', () => { + it('invokes listAssets without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAssetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), + ]; + client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); + const [response] = await client.listAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAssets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAssets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes importAssets with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ImportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ImportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importAssets = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.importAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAssets without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAssetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), + ]; + client.innerApiCalls.listAssets = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAssets( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IAsset[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAssets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAssets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes importAssets with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ImportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ImportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importAssets = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importAssets(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAssets with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAssetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAssets = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listAssets(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listAssets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAssets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkImportAssetsProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportAssetsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes listAssetsStream without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAssetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), + ]; + client.descriptors.page.listAssets.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Asset[] = []; + stream.on('data', (response: protos.google.cloud.visionai.v1.Asset) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAssets, request), + ); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkImportAssetsProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportAssetsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listAssetsStream with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAssetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Asset[] = []; + stream.on('data', (response: protos.google.cloud.visionai.v1.Asset) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAssets, request), + ); + assert( + (client.descriptors.page.listAssets.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('createIndexEndpoint', () => { - it('invokes createIndexEndpoint without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateIndexEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createIndexEndpoint = stubLongRunningCall(expectedResponse); - const [operation] = await client.createIndexEndpoint(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listAssets without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAssetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), + ]; + client.descriptors.page.listAssets.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IAsset[] = []; + const iterable = client.listAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes createIndexEndpoint without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateIndexEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createIndexEndpoint = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createIndexEndpoint( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listAssets with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAssetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IAsset[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAssets.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listAssets.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('viewIndexedAssets', () => { + it('invokes viewIndexedAssets without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ViewIndexedAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ViewIndexedAssetsRequest', + ['index'], + ); + request.index = defaultValue1; + const expectedHeaderRequestParams = `index=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexedAsset(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexedAsset(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexedAsset(), + ), + ]; + client.innerApiCalls.viewIndexedAssets = stubSimpleCall(expectedResponse); + const [response] = await client.viewIndexedAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.viewIndexedAssets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.viewIndexedAssets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createIndexEndpoint with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateIndexEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createIndexEndpoint = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createIndexEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.createIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes viewIndexedAssets without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ViewIndexedAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ViewIndexedAssetsRequest', + ['index'], + ); + request.index = defaultValue1; + const expectedHeaderRequestParams = `index=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexedAsset(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexedAsset(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexedAsset(), + ), + ]; + client.innerApiCalls.viewIndexedAssets = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.viewIndexedAssets( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IIndexedAsset[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.viewIndexedAssets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.viewIndexedAssets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createIndexEndpoint with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateIndexEndpointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createIndexEndpoint = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createIndexEndpoint(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes viewIndexedAssets with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ViewIndexedAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ViewIndexedAssetsRequest', + ['index'], + ); + request.index = defaultValue1; + const expectedHeaderRequestParams = `index=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.viewIndexedAssets = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.viewIndexedAssets(request), expectedError); + const actualRequest = ( + client.innerApiCalls.viewIndexedAssets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.viewIndexedAssets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateIndexEndpointProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateIndexEndpointProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes viewIndexedAssetsStream without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ViewIndexedAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ViewIndexedAssetsRequest', + ['index'], + ); + request.index = defaultValue1; + const expectedHeaderRequestParams = `index=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexedAsset(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexedAsset(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexedAsset(), + ), + ]; + client.descriptors.page.viewIndexedAssets.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.viewIndexedAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.IndexedAsset[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.IndexedAsset) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.viewIndexedAssets.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.viewIndexedAssets, request), + ); + assert( + (client.descriptors.page.viewIndexedAssets.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkCreateIndexEndpointProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateIndexEndpointProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes viewIndexedAssetsStream with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ViewIndexedAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ViewIndexedAssetsRequest', + ['index'], + ); + request.index = defaultValue1; + const expectedHeaderRequestParams = `index=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.viewIndexedAssets.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.viewIndexedAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.IndexedAsset[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.IndexedAsset) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.viewIndexedAssets.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.viewIndexedAssets, request), + ); + assert( + (client.descriptors.page.viewIndexedAssets.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('updateIndexEndpoint', () => { - it('invokes updateIndexEndpoint without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateIndexEndpointRequest() - ); - request.indexEndpoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateIndexEndpointRequest', ['indexEndpoint', 'name']); - request.indexEndpoint.name = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateIndexEndpoint = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateIndexEndpoint(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with viewIndexedAssets without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ViewIndexedAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ViewIndexedAssetsRequest', + ['index'], + ); + request.index = defaultValue1; + const expectedHeaderRequestParams = `index=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexedAsset(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexedAsset(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexedAsset(), + ), + ]; + client.descriptors.page.viewIndexedAssets.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IIndexedAsset[] = []; + const iterable = client.viewIndexedAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.viewIndexedAssets.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.viewIndexedAssets.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes updateIndexEndpoint without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateIndexEndpointRequest() - ); - request.indexEndpoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateIndexEndpointRequest', ['indexEndpoint', 'name']); - request.indexEndpoint.name = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateIndexEndpoint = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateIndexEndpoint( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with viewIndexedAssets with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ViewIndexedAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ViewIndexedAssetsRequest', + ['index'], + ); + request.index = defaultValue1; + const expectedHeaderRequestParams = `index=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.viewIndexedAssets.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.viewIndexedAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IIndexedAsset[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.viewIndexedAssets.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.viewIndexedAssets.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listIndexes', () => { + it('invokes listIndexes without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListIndexesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListIndexesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), + ]; + client.innerApiCalls.listIndexes = stubSimpleCall(expectedResponse); + const [response] = await client.listIndexes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listIndexes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIndexes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateIndexEndpoint with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateIndexEndpointRequest() - ); - request.indexEndpoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateIndexEndpointRequest', ['indexEndpoint', 'name']); - request.indexEndpoint.name = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateIndexEndpoint = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateIndexEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.updateIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listIndexes without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListIndexesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListIndexesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), + ]; + client.innerApiCalls.listIndexes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listIndexes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IIndex[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listIndexes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIndexes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateIndexEndpoint with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UpdateIndexEndpointRequest() - ); - request.indexEndpoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UpdateIndexEndpointRequest', ['indexEndpoint', 'name']); - request.indexEndpoint.name = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateIndexEndpoint = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateIndexEndpoint(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listIndexes with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListIndexesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListIndexesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listIndexes = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listIndexes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listIndexes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIndexes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateIndexEndpointProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateIndexEndpointProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes listIndexesStream without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListIndexesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListIndexesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), + ]; + client.descriptors.page.listIndexes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listIndexesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Index[] = []; + stream.on('data', (response: protos.google.cloud.visionai.v1.Index) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listIndexes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listIndexes, request), + ); + assert( + (client.descriptors.page.listIndexes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkUpdateIndexEndpointProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateIndexEndpointProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listIndexesStream with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListIndexesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListIndexesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listIndexes.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listIndexesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Index[] = []; + stream.on('data', (response: protos.google.cloud.visionai.v1.Index) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listIndexes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listIndexes, request), + ); + assert( + (client.descriptors.page.listIndexes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('deleteIndexEndpoint', () => { - it('invokes deleteIndexEndpoint without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteIndexEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteIndexEndpoint = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteIndexEndpoint(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listIndexes without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListIndexesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListIndexesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), + ]; + client.descriptors.page.listIndexes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IIndex[] = []; + const iterable = client.listIndexesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listIndexes.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listIndexes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes deleteIndexEndpoint without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteIndexEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteIndexEndpoint = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteIndexEndpoint( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('uses async iteration with listIndexes with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListIndexesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListIndexesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listIndexes.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listIndexesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IIndex[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listIndexes.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listIndexes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listCorpora', () => { + it('invokes listCorpora without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListCorporaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListCorporaRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), + ]; + client.innerApiCalls.listCorpora = stubSimpleCall(expectedResponse); + const [response] = await client.listCorpora(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCorpora as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCorpora as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteIndexEndpoint with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteIndexEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteIndexEndpoint = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteIndexEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listCorpora without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListCorporaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListCorporaRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), + ]; + client.innerApiCalls.listCorpora = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCorpora( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ICorpus[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCorpora as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCorpora as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteIndexEndpoint with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteIndexEndpointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteIndexEndpoint = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteIndexEndpoint(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listCorpora with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListCorporaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListCorporaRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCorpora = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listCorpora(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listCorpora as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCorpora as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteIndexEndpointProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteIndexEndpointProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteIndexEndpointProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteIndexEndpointProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listCorporaStream without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListCorporaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListCorporaRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), + ]; + client.descriptors.page.listCorpora.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listCorporaStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Corpus[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Corpus) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listCorpora.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCorpora, request), + ); + assert( + (client.descriptors.page.listCorpora.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('deployIndex', () => { - it('invokes deployIndex without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeployIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeployIndexRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deployIndex = stubLongRunningCall(expectedResponse); - const [operation] = await client.deployIndex(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deployIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deployIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deployIndex without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeployIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeployIndexRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deployIndex = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deployIndex( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deployIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deployIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deployIndex with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeployIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeployIndexRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deployIndex = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deployIndex(request), expectedError); - const actualRequest = (client.innerApiCalls.deployIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deployIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deployIndex with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeployIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeployIndexRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deployIndex = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deployIndex(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deployIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deployIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeployIndexProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeployIndexProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeployIndexProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeployIndexProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('undeployIndex', () => { - it('invokes undeployIndex without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UndeployIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UndeployIndexRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.undeployIndex = stubLongRunningCall(expectedResponse); - const [operation] = await client.undeployIndex(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeployIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeployIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeployIndex without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UndeployIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UndeployIndexRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.undeployIndex = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.undeployIndex( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeployIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeployIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeployIndex with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UndeployIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UndeployIndexRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeployIndex = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.undeployIndex(request), expectedError); - const actualRequest = (client.innerApiCalls.undeployIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeployIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeployIndex with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.UndeployIndexRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.UndeployIndexRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeployIndex = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.undeployIndex(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.undeployIndex as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeployIndex as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUndeployIndexProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUndeployIndexProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUndeployIndexProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUndeployIndexProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listCorporaStream with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListCorporaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListCorporaRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCorpora.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listCorporaStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Corpus[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Corpus) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listCorpora.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCorpora, request), + ); + assert( + (client.descriptors.page.listCorpora.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('createCollection', () => { - it('invokes createCollection without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateCollectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateCollectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCollection = stubLongRunningCall(expectedResponse); - const [operation] = await client.createCollection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCollection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCollection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCollection without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateCollectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateCollectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCollection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCollection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCollection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCollection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCollection with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateCollectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateCollectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCollection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createCollection(request), expectedError); - const actualRequest = (client.innerApiCalls.createCollection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCollection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCollection with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.CreateCollectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.CreateCollectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCollection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createCollection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createCollection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCollection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateCollectionProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateCollectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateCollectionProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateCollectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with listCorpora without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListCorporaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListCorporaRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), + ]; + client.descriptors.page.listCorpora.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.ICorpus[] = []; + const iterable = client.listCorporaAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listCorpora.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listCorpora.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('deleteCollection', () => { - it('invokes deleteCollection without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteCollectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteCollectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteCollection = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteCollection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCollection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCollection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCollection without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteCollectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteCollectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteCollection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteCollection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCollection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCollection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCollection with call error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteCollectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteCollectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCollection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteCollection(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteCollection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCollection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteCollection with LRO error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.DeleteCollectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.DeleteCollectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCollection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteCollection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteCollection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCollection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteCollectionProgress without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteCollectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteCollectionProgress with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteCollectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with listCorpora with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListCorporaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListCorporaRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCorpora.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listCorporaAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.ICorpus[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listCorpora.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listCorpora.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - - describe('ingestAsset', () => { - it('invokes ingestAsset without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.IngestAssetRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.cloud.visionai.v1.IngestAssetResponse() - ); - client.innerApiCalls.ingestAsset = stubBidiStreamingCall(expectedResponse); - const stream = client.ingestAsset(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.visionai.v1.IngestAssetResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.ingestAsset as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes ingestAsset with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.IngestAssetRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.ingestAsset = stubBidiStreamingCall(undefined, expectedError); - const stream = client.ingestAsset(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.visionai.v1.IngestAssetResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.ingestAsset as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); + }); + + describe('listDataSchemas', () => { + it('invokes listDataSchemas without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListDataSchemasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListDataSchemasRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), + generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), + generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), + ]; + client.innerApiCalls.listDataSchemas = stubSimpleCall(expectedResponse); + const [response] = await client.listDataSchemas(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDataSchemas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDataSchemas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listAssets', () => { - it('invokes listAssets without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), - ]; - client.innerApiCalls.listAssets = stubSimpleCall(expectedResponse); - const [response] = await client.listAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssets without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), - ]; - client.innerApiCalls.listAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAssets( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IAsset[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssets with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAssetsStream without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), - ]; - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Asset[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Asset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAssetsStream with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Asset[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Asset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAssets, request)); - assert( - (client.descriptors.page.listAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssets without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Asset()), - ]; - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IAsset[] = []; - const iterable = client.listAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listDataSchemas without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListDataSchemasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListDataSchemasRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), + generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), + generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), + ]; + client.innerApiCalls.listDataSchemas = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDataSchemas( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IDataSchema[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAssets with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IAsset[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDataSchemas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDataSchemas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('viewIndexedAssets', () => { - it('invokes viewIndexedAssets without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ViewIndexedAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ViewIndexedAssetsRequest', ['index']); - request.index = defaultValue1; - const expectedHeaderRequestParams = `index=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexedAsset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexedAsset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexedAsset()), - ]; - client.innerApiCalls.viewIndexedAssets = stubSimpleCall(expectedResponse); - const [response] = await client.viewIndexedAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.viewIndexedAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.viewIndexedAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes viewIndexedAssets without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ViewIndexedAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ViewIndexedAssetsRequest', ['index']); - request.index = defaultValue1; - const expectedHeaderRequestParams = `index=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexedAsset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexedAsset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexedAsset()), - ]; - client.innerApiCalls.viewIndexedAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.viewIndexedAssets( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IIndexedAsset[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.viewIndexedAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.viewIndexedAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes viewIndexedAssets with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ViewIndexedAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ViewIndexedAssetsRequest', ['index']); - request.index = defaultValue1; - const expectedHeaderRequestParams = `index=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.viewIndexedAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.viewIndexedAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.viewIndexedAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.viewIndexedAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes viewIndexedAssetsStream without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ViewIndexedAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ViewIndexedAssetsRequest', ['index']); - request.index = defaultValue1; - const expectedHeaderRequestParams = `index=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexedAsset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexedAsset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexedAsset()), - ]; - client.descriptors.page.viewIndexedAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.viewIndexedAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.IndexedAsset[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.IndexedAsset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.viewIndexedAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.viewIndexedAssets, request)); - assert( - (client.descriptors.page.viewIndexedAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes viewIndexedAssetsStream with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ViewIndexedAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ViewIndexedAssetsRequest', ['index']); - request.index = defaultValue1; - const expectedHeaderRequestParams = `index=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.viewIndexedAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.viewIndexedAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.IndexedAsset[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.IndexedAsset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.viewIndexedAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.viewIndexedAssets, request)); - assert( - (client.descriptors.page.viewIndexedAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with viewIndexedAssets without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ViewIndexedAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ViewIndexedAssetsRequest', ['index']); - request.index = defaultValue1; - const expectedHeaderRequestParams = `index=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexedAsset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexedAsset()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexedAsset()), - ]; - client.descriptors.page.viewIndexedAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IIndexedAsset[] = []; - const iterable = client.viewIndexedAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.viewIndexedAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.viewIndexedAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with viewIndexedAssets with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ViewIndexedAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ViewIndexedAssetsRequest', ['index']); - request.index = defaultValue1; - const expectedHeaderRequestParams = `index=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.viewIndexedAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.viewIndexedAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IIndexedAsset[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.viewIndexedAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.viewIndexedAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listDataSchemas with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListDataSchemasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListDataSchemasRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDataSchemas = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listDataSchemas(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listDataSchemas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDataSchemas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listIndexes', () => { - it('invokes listIndexes without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListIndexesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListIndexesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), - ]; - client.innerApiCalls.listIndexes = stubSimpleCall(expectedResponse); - const [response] = await client.listIndexes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listIndexes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIndexes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listIndexes without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListIndexesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListIndexesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), - ]; - client.innerApiCalls.listIndexes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listIndexes( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IIndex[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listIndexes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIndexes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listIndexes with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListIndexesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListIndexesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listIndexes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listIndexes(request), expectedError); - const actualRequest = (client.innerApiCalls.listIndexes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIndexes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listIndexesStream without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListIndexesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListIndexesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), - ]; - client.descriptors.page.listIndexes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listIndexesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Index[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Index) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listIndexes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listIndexes, request)); - assert( - (client.descriptors.page.listIndexes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listIndexesStream with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListIndexesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListIndexesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listIndexes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listIndexesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Index[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Index) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listIndexes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listIndexes, request)); - assert( - (client.descriptors.page.listIndexes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listIndexes without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListIndexesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListIndexesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Index()), - ]; - client.descriptors.page.listIndexes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IIndex[] = []; - const iterable = client.listIndexesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listIndexes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listIndexes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listIndexes with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListIndexesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListIndexesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listIndexes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listIndexesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IIndex[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listIndexes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listIndexes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listDataSchemasStream without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListDataSchemasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListDataSchemasRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), + generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), + generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), + ]; + client.descriptors.page.listDataSchemas.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listDataSchemasStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.DataSchema[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.DataSchema) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listDataSchemas.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDataSchemas, request), + ); + assert( + (client.descriptors.page.listDataSchemas.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('listCorpora', () => { - it('invokes listCorpora without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListCorporaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListCorporaRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), - ]; - client.innerApiCalls.listCorpora = stubSimpleCall(expectedResponse); - const [response] = await client.listCorpora(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCorpora as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCorpora as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCorpora without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListCorporaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListCorporaRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), - ]; - client.innerApiCalls.listCorpora = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCorpora( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ICorpus[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCorpora as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCorpora as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCorpora with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListCorporaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListCorporaRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCorpora = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCorpora(request), expectedError); - const actualRequest = (client.innerApiCalls.listCorpora as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCorpora as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCorporaStream without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListCorporaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListCorporaRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), - ]; - client.descriptors.page.listCorpora.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCorporaStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Corpus[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Corpus) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCorpora.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCorpora, request)); - assert( - (client.descriptors.page.listCorpora.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCorporaStream with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListCorporaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListCorporaRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCorpora.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCorporaStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Corpus[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Corpus) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCorpora.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCorpora, request)); - assert( - (client.descriptors.page.listCorpora.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCorpora without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListCorporaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListCorporaRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Corpus()), - ]; - client.descriptors.page.listCorpora.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.ICorpus[] = []; - const iterable = client.listCorporaAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCorpora.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCorpora.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCorpora with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListCorporaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListCorporaRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCorpora.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCorporaAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.ICorpus[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCorpora.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCorpora.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listDataSchemasStream with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListDataSchemasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListDataSchemasRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDataSchemas.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listDataSchemasStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.DataSchema[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.DataSchema) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listDataSchemas.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDataSchemas, request), + ); + assert( + (client.descriptors.page.listDataSchemas.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('listDataSchemas', () => { - it('invokes listDataSchemas without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListDataSchemasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListDataSchemasRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), - generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), - generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), - ]; - client.innerApiCalls.listDataSchemas = stubSimpleCall(expectedResponse); - const [response] = await client.listDataSchemas(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDataSchemas as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDataSchemas as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDataSchemas without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListDataSchemasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListDataSchemasRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), - generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), - generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), - ]; - client.innerApiCalls.listDataSchemas = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDataSchemas( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IDataSchema[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDataSchemas as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDataSchemas as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDataSchemas with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListDataSchemasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListDataSchemasRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDataSchemas = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDataSchemas(request), expectedError); - const actualRequest = (client.innerApiCalls.listDataSchemas as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDataSchemas as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDataSchemasStream without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListDataSchemasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListDataSchemasRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), - generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), - generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), - ]; - client.descriptors.page.listDataSchemas.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDataSchemasStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.DataSchema[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.DataSchema) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listDataSchemas.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDataSchemas, request)); - assert( - (client.descriptors.page.listDataSchemas.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listDataSchemas without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListDataSchemasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListDataSchemasRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), + generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), + generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), + ]; + client.descriptors.page.listDataSchemas.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IDataSchema[] = []; + const iterable = client.listDataSchemasAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listDataSchemas.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listDataSchemas.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listDataSchemasStream with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListDataSchemasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListDataSchemasRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDataSchemas.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDataSchemasStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.DataSchema[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.DataSchema) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDataSchemas.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDataSchemas, request)); - assert( - (client.descriptors.page.listDataSchemas.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listDataSchemas with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListDataSchemasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListDataSchemasRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDataSchemas.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDataSchemasAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IDataSchema[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listDataSchemas.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listDataSchemas.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listAnnotations', () => { + it('invokes listAnnotations without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAnnotationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAnnotationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), + ]; + client.innerApiCalls.listAnnotations = stubSimpleCall(expectedResponse); + const [response] = await client.listAnnotations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAnnotations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAnnotations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listDataSchemas without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListDataSchemasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListDataSchemasRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), - generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), - generateSampleMessage(new protos.google.cloud.visionai.v1.DataSchema()), - ]; - client.descriptors.page.listDataSchemas.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IDataSchema[] = []; - const iterable = client.listDataSchemasAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listAnnotations without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAnnotationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAnnotationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), + ]; + client.innerApiCalls.listAnnotations = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAnnotations( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IAnnotation[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDataSchemas.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDataSchemas.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDataSchemas with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListDataSchemasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListDataSchemasRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDataSchemas.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDataSchemasAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IDataSchema[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDataSchemas.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDataSchemas.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAnnotations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAnnotations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listAnnotations', () => { - it('invokes listAnnotations without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAnnotationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAnnotationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), - ]; - client.innerApiCalls.listAnnotations = stubSimpleCall(expectedResponse); - const [response] = await client.listAnnotations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAnnotations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAnnotations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAnnotations with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAnnotationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAnnotationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAnnotations = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listAnnotations(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listAnnotations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAnnotations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listAnnotations without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAnnotationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAnnotationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), - ]; - client.innerApiCalls.listAnnotations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAnnotations( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IAnnotation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAnnotations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAnnotations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAnnotationsStream without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAnnotationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAnnotationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), + ]; + client.descriptors.page.listAnnotations.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAnnotationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Annotation[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Annotation) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listAnnotations.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAnnotations, request), + ); + assert( + (client.descriptors.page.listAnnotations.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listAnnotations with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAnnotationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAnnotationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAnnotations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAnnotations(request), expectedError); - const actualRequest = (client.innerApiCalls.listAnnotations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAnnotations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listAnnotationsStream with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAnnotationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAnnotationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAnnotations.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAnnotationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Annotation[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Annotation) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAnnotations.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAnnotations, request), + ); + assert( + (client.descriptors.page.listAnnotations.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listAnnotationsStream without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAnnotationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAnnotationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), - ]; - client.descriptors.page.listAnnotations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAnnotationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Annotation[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Annotation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAnnotations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAnnotations, request)); - assert( - (client.descriptors.page.listAnnotations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAnnotations without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAnnotationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAnnotationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), + ]; + client.descriptors.page.listAnnotations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IAnnotation[] = []; + const iterable = client.listAnnotationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAnnotations.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listAnnotations.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listAnnotationsStream with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAnnotationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAnnotationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAnnotations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAnnotationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Annotation[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Annotation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAnnotations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAnnotations, request)); - assert( - (client.descriptors.page.listAnnotations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listAnnotations with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListAnnotationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListAnnotationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAnnotations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAnnotationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IAnnotation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAnnotations.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listAnnotations.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listSearchConfigs', () => { + it('invokes listSearchConfigs without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSearchConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSearchConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ), + ]; + client.innerApiCalls.listSearchConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listSearchConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSearchConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSearchConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listAnnotations without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAnnotationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAnnotationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Annotation()), - ]; - client.descriptors.page.listAnnotations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IAnnotation[] = []; - const iterable = client.listAnnotationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listSearchConfigs without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSearchConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSearchConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ), + ]; + client.innerApiCalls.listSearchConfigs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSearchConfigs( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ISearchConfig[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAnnotations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAnnotations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAnnotations with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListAnnotationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListAnnotationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAnnotations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAnnotationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IAnnotation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAnnotations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAnnotations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSearchConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSearchConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listSearchConfigs', () => { - it('invokes listSearchConfigs without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSearchConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSearchConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchConfig()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchConfig()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchConfig()), - ]; - client.innerApiCalls.listSearchConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listSearchConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSearchConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSearchConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSearchConfigs with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSearchConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSearchConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSearchConfigs = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listSearchConfigs(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listSearchConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSearchConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listSearchConfigs without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSearchConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSearchConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchConfig()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchConfig()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchConfig()), - ]; - client.innerApiCalls.listSearchConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSearchConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ISearchConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSearchConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSearchConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSearchConfigsStream without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSearchConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSearchConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ), + ]; + client.descriptors.page.listSearchConfigs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSearchConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.SearchConfig[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.SearchConfig) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listSearchConfigs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSearchConfigs, request), + ); + assert( + (client.descriptors.page.listSearchConfigs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSearchConfigs with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSearchConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSearchConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSearchConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSearchConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listSearchConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSearchConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSearchConfigsStream with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSearchConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSearchConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSearchConfigs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSearchConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.SearchConfig[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.SearchConfig) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSearchConfigs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSearchConfigs, request), + ); + assert( + (client.descriptors.page.listSearchConfigs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSearchConfigsStream without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSearchConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSearchConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchConfig()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchConfig()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchConfig()), - ]; - client.descriptors.page.listSearchConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSearchConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.SearchConfig[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.SearchConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSearchConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSearchConfigs, request)); - assert( - (client.descriptors.page.listSearchConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSearchConfigs without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSearchConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSearchConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchConfig(), + ), + ]; + client.descriptors.page.listSearchConfigs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.ISearchConfig[] = []; + const iterable = client.listSearchConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSearchConfigs.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSearchConfigs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSearchConfigsStream with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSearchConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSearchConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSearchConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSearchConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.SearchConfig[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.SearchConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSearchConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSearchConfigs, request)); - assert( - (client.descriptors.page.listSearchConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSearchConfigs with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSearchConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSearchConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSearchConfigs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSearchConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.ISearchConfig[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSearchConfigs.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSearchConfigs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listSearchHypernyms', () => { + it('invokes listSearchHypernyms without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSearchHypernymsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSearchHypernymsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ), + ]; + client.innerApiCalls.listSearchHypernyms = + stubSimpleCall(expectedResponse); + const [response] = await client.listSearchHypernyms(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSearchHypernyms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSearchHypernyms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listSearchConfigs without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSearchConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSearchConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchConfig()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchConfig()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchConfig()), - ]; - client.descriptors.page.listSearchConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.ISearchConfig[] = []; - const iterable = client.listSearchConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listSearchHypernyms without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSearchHypernymsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSearchHypernymsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ), + ]; + client.innerApiCalls.listSearchHypernyms = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSearchHypernyms( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ISearchHypernym[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSearchConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSearchConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSearchConfigs with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSearchConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSearchConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSearchConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSearchConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.ISearchConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSearchConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSearchConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSearchHypernyms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSearchHypernyms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listSearchHypernyms', () => { - it('invokes listSearchHypernyms without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSearchHypernymsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSearchHypernymsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchHypernym()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchHypernym()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchHypernym()), - ]; - client.innerApiCalls.listSearchHypernyms = stubSimpleCall(expectedResponse); - const [response] = await client.listSearchHypernyms(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSearchHypernyms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSearchHypernyms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSearchHypernyms with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSearchHypernymsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSearchHypernymsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSearchHypernyms = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listSearchHypernyms(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listSearchHypernyms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSearchHypernyms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listSearchHypernyms without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSearchHypernymsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSearchHypernymsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchHypernym()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchHypernym()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchHypernym()), - ]; - client.innerApiCalls.listSearchHypernyms = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSearchHypernyms( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ISearchHypernym[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSearchHypernyms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSearchHypernyms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSearchHypernymsStream without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSearchHypernymsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSearchHypernymsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ), + ]; + client.descriptors.page.listSearchHypernyms.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSearchHypernymsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.SearchHypernym[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.SearchHypernym) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listSearchHypernyms.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSearchHypernyms, request), + ); + assert( + (client.descriptors.page.listSearchHypernyms.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSearchHypernyms with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSearchHypernymsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSearchHypernymsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSearchHypernyms = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSearchHypernyms(request), expectedError); - const actualRequest = (client.innerApiCalls.listSearchHypernyms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSearchHypernyms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSearchHypernymsStream with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSearchHypernymsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSearchHypernymsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSearchHypernyms.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSearchHypernymsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.SearchHypernym[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.SearchHypernym) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSearchHypernyms.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSearchHypernyms, request), + ); + assert( + (client.descriptors.page.listSearchHypernyms.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSearchHypernymsStream without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSearchHypernymsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSearchHypernymsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchHypernym()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchHypernym()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchHypernym()), - ]; - client.descriptors.page.listSearchHypernyms.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSearchHypernymsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.SearchHypernym[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.SearchHypernym) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSearchHypernyms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSearchHypernyms, request)); - assert( - (client.descriptors.page.listSearchHypernyms.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSearchHypernyms without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSearchHypernymsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSearchHypernymsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchHypernym(), + ), + ]; + client.descriptors.page.listSearchHypernyms.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.ISearchHypernym[] = []; + const iterable = client.listSearchHypernymsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSearchHypernyms.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSearchHypernyms.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSearchHypernymsStream with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSearchHypernymsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSearchHypernymsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSearchHypernyms.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSearchHypernymsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.SearchHypernym[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.SearchHypernym) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSearchHypernyms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSearchHypernyms, request)); - assert( - (client.descriptors.page.listSearchHypernyms.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSearchHypernyms with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListSearchHypernymsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListSearchHypernymsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSearchHypernyms.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSearchHypernymsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.ISearchHypernym[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSearchHypernyms.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSearchHypernyms.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('searchAssets', () => { + it('invokes searchAssets without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.SearchAssetsRequest', + ['corpus'], + ); + request.corpus = defaultValue1; + const expectedHeaderRequestParams = `corpus=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + ]; + client.innerApiCalls.searchAssets = stubSimpleCall(expectedResponse); + const [response] = await client.searchAssets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.searchAssets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchAssets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listSearchHypernyms without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSearchHypernymsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSearchHypernymsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchHypernym()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchHypernym()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchHypernym()), - ]; - client.descriptors.page.listSearchHypernyms.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.ISearchHypernym[] = []; - const iterable = client.listSearchHypernymsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes searchAssets without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.SearchAssetsRequest', + ['corpus'], + ); + request.corpus = defaultValue1; + const expectedHeaderRequestParams = `corpus=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + ]; + client.innerApiCalls.searchAssets = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchAssets( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ISearchResultItem[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSearchHypernyms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSearchHypernyms.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSearchHypernyms with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListSearchHypernymsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListSearchHypernymsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSearchHypernyms.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSearchHypernymsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.ISearchHypernym[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSearchHypernyms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSearchHypernyms.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.searchAssets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchAssets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('searchAssets', () => { - it('invokes searchAssets without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.SearchAssetsRequest', ['corpus']); - request.corpus = defaultValue1; - const expectedHeaderRequestParams = `corpus=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - ]; - client.innerApiCalls.searchAssets = stubSimpleCall(expectedResponse); - const [response] = await client.searchAssets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes searchAssets with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.SearchAssetsRequest', + ['corpus'], + ); + request.corpus = defaultValue1; + const expectedHeaderRequestParams = `corpus=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAssets = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.searchAssets(request), expectedError); + const actualRequest = ( + client.innerApiCalls.searchAssets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchAssets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes searchAssets without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.SearchAssetsRequest', ['corpus']); - request.corpus = defaultValue1; - const expectedHeaderRequestParams = `corpus=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - ]; - client.innerApiCalls.searchAssets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchAssets( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ISearchResultItem[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes searchAssetsStream without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.SearchAssetsRequest', + ['corpus'], + ); + request.corpus = defaultValue1; + const expectedHeaderRequestParams = `corpus=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + ]; + client.descriptors.page.searchAssets.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.searchAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.SearchResultItem[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.SearchResultItem) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.searchAssets.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.searchAssets, request), + ); + assert( + (client.descriptors.page.searchAssets.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes searchAssets with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.SearchAssetsRequest', ['corpus']); - request.corpus = defaultValue1; - const expectedHeaderRequestParams = `corpus=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchAssets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.searchAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes searchAssetsStream with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.SearchAssetsRequest', + ['corpus'], + ); + request.corpus = defaultValue1; + const expectedHeaderRequestParams = `corpus=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAssets.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.searchAssetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.SearchResultItem[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.SearchResultItem) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.searchAssets.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.searchAssets, request), + ); + assert( + (client.descriptors.page.searchAssets.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes searchAssetsStream without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.SearchAssetsRequest', ['corpus']); - request.corpus = defaultValue1; - const expectedHeaderRequestParams = `corpus=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - ]; - client.descriptors.page.searchAssets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.searchAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.SearchResultItem[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.SearchResultItem) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.searchAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAssets, request)); - assert( - (client.descriptors.page.searchAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with searchAssets without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.SearchAssetsRequest', + ['corpus'], + ); + request.corpus = defaultValue1; + const expectedHeaderRequestParams = `corpus=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + ]; + client.descriptors.page.searchAssets.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.ISearchResultItem[] = []; + const iterable = client.searchAssetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.searchAssets.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.searchAssets.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes searchAssetsStream with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.SearchAssetsRequest', ['corpus']); - request.corpus = defaultValue1; - const expectedHeaderRequestParams = `corpus=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.searchAssets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.searchAssetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.SearchResultItem[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.SearchResultItem) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.searchAssets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchAssets, request)); - assert( - (client.descriptors.page.searchAssets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with searchAssets with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchAssetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.SearchAssetsRequest', + ['corpus'], + ); + request.corpus = defaultValue1; + const expectedHeaderRequestParams = `corpus=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAssets.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchAssetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.ISearchResultItem[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.searchAssets.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.searchAssets.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('searchIndexEndpoint', () => { + it('invokes searchIndexEndpoint without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.SearchIndexEndpointRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + ]; + client.innerApiCalls.searchIndexEndpoint = + stubSimpleCall(expectedResponse); + const [response] = await client.searchIndexEndpoint(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.searchIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with searchAssets without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.SearchAssetsRequest', ['corpus']); - request.corpus = defaultValue1; - const expectedHeaderRequestParams = `corpus=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - ]; - client.descriptors.page.searchAssets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.ISearchResultItem[] = []; - const iterable = client.searchAssetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes searchIndexEndpoint without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.SearchIndexEndpointRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + ]; + client.innerApiCalls.searchIndexEndpoint = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchIndexEndpoint( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ISearchResultItem[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.searchAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchAssets with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.SearchAssetsRequest', ['corpus']); - request.corpus = defaultValue1; - const expectedHeaderRequestParams = `corpus=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.searchAssets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.searchAssetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.ISearchResultItem[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.searchAssets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchAssets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.searchIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('searchIndexEndpoint', () => { - it('invokes searchIndexEndpoint without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.SearchIndexEndpointRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - ]; - client.innerApiCalls.searchIndexEndpoint = stubSimpleCall(expectedResponse); - const [response] = await client.searchIndexEndpoint(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes searchIndexEndpoint with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.SearchIndexEndpointRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.searchIndexEndpoint = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.searchIndexEndpoint(request), expectedError); + const actualRequest = ( + client.innerApiCalls.searchIndexEndpoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchIndexEndpoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes searchIndexEndpoint without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.SearchIndexEndpointRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - ]; - client.innerApiCalls.searchIndexEndpoint = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchIndexEndpoint( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ISearchResultItem[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes searchIndexEndpointStream without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.SearchIndexEndpointRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + ]; + client.descriptors.page.searchIndexEndpoint.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.searchIndexEndpointStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.SearchResultItem[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.SearchResultItem) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.searchIndexEndpoint.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.searchIndexEndpoint, request), + ); + assert( + (client.descriptors.page.searchIndexEndpoint.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes searchIndexEndpoint with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.SearchIndexEndpointRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchIndexEndpoint = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchIndexEndpoint(request), expectedError); - const actualRequest = (client.innerApiCalls.searchIndexEndpoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchIndexEndpoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes searchIndexEndpointStream with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.SearchIndexEndpointRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchIndexEndpoint.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.searchIndexEndpointStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.SearchResultItem[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.SearchResultItem) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.searchIndexEndpoint.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.searchIndexEndpoint, request), + ); + assert( + (client.descriptors.page.searchIndexEndpoint.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes searchIndexEndpointStream without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.SearchIndexEndpointRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - ]; - client.descriptors.page.searchIndexEndpoint.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.searchIndexEndpointStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.SearchResultItem[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.SearchResultItem) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.searchIndexEndpoint.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchIndexEndpoint, request)); - assert( - (client.descriptors.page.searchIndexEndpoint.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with searchIndexEndpoint without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.SearchIndexEndpointRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchResultItem(), + ), + ]; + client.descriptors.page.searchIndexEndpoint.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.ISearchResultItem[] = []; + const iterable = client.searchIndexEndpointAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.searchIndexEndpoint.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.searchIndexEndpoint.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes searchIndexEndpointStream with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.SearchIndexEndpointRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.searchIndexEndpoint.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.searchIndexEndpointStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.SearchResultItem[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.SearchResultItem) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.searchIndexEndpoint.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.searchIndexEndpoint, request)); - assert( - (client.descriptors.page.searchIndexEndpoint.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with searchIndexEndpoint with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.SearchIndexEndpointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.SearchIndexEndpointRequest', + ['indexEndpoint'], + ); + request.indexEndpoint = defaultValue1; + const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchIndexEndpoint.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchIndexEndpointAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.ISearchResultItem[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.searchIndexEndpoint.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.searchIndexEndpoint.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listIndexEndpoints', () => { + it('invokes listIndexEndpoints without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListIndexEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListIndexEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexEndpoint(), + ), + ]; + client.innerApiCalls.listIndexEndpoints = + stubSimpleCall(expectedResponse); + const [response] = await client.listIndexEndpoints(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listIndexEndpoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIndexEndpoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with searchIndexEndpoint without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.SearchIndexEndpointRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.SearchResultItem()), - ]; - client.descriptors.page.searchIndexEndpoint.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.ISearchResultItem[] = []; - const iterable = client.searchIndexEndpointAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listIndexEndpoints without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListIndexEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListIndexEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexEndpoint(), + ), + ]; + client.innerApiCalls.listIndexEndpoints = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listIndexEndpoints( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.IIndexEndpoint[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.searchIndexEndpoint.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchIndexEndpoint.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with searchIndexEndpoint with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.SearchIndexEndpointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.SearchIndexEndpointRequest', ['indexEndpoint']); - request.indexEndpoint = defaultValue1; - const expectedHeaderRequestParams = `index_endpoint=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.searchIndexEndpoint.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.searchIndexEndpointAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.ISearchResultItem[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.searchIndexEndpoint.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.searchIndexEndpoint.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listIndexEndpoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIndexEndpoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listIndexEndpoints', () => { - it('invokes listIndexEndpoints without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListIndexEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListIndexEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexEndpoint()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexEndpoint()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexEndpoint()), - ]; - client.innerApiCalls.listIndexEndpoints = stubSimpleCall(expectedResponse); - const [response] = await client.listIndexEndpoints(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listIndexEndpoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIndexEndpoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listIndexEndpoints with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListIndexEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListIndexEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listIndexEndpoints = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listIndexEndpoints(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listIndexEndpoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIndexEndpoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listIndexEndpoints without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListIndexEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListIndexEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexEndpoint()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexEndpoint()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexEndpoint()), - ]; - client.innerApiCalls.listIndexEndpoints = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listIndexEndpoints( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.IIndexEndpoint[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listIndexEndpoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIndexEndpoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listIndexEndpointsStream without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListIndexEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListIndexEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexEndpoint(), + ), + ]; + client.descriptors.page.listIndexEndpoints.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listIndexEndpointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.IndexEndpoint[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.IndexEndpoint) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listIndexEndpoints.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listIndexEndpoints, request), + ); + assert( + (client.descriptors.page.listIndexEndpoints.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listIndexEndpoints with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListIndexEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListIndexEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listIndexEndpoints = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listIndexEndpoints(request), expectedError); - const actualRequest = (client.innerApiCalls.listIndexEndpoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listIndexEndpoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listIndexEndpointsStream with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListIndexEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListIndexEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listIndexEndpoints.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listIndexEndpointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.IndexEndpoint[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.IndexEndpoint) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listIndexEndpoints.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listIndexEndpoints, request), + ); + assert( + (client.descriptors.page.listIndexEndpoints.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listIndexEndpointsStream without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListIndexEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListIndexEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexEndpoint()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexEndpoint()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexEndpoint()), - ]; - client.descriptors.page.listIndexEndpoints.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listIndexEndpointsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.IndexEndpoint[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.IndexEndpoint) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listIndexEndpoints.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listIndexEndpoints, request)); - assert( - (client.descriptors.page.listIndexEndpoints.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listIndexEndpoints without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListIndexEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListIndexEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexEndpoint(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.IndexEndpoint(), + ), + ]; + client.descriptors.page.listIndexEndpoints.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.IIndexEndpoint[] = []; + const iterable = client.listIndexEndpointsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listIndexEndpoints.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listIndexEndpoints.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listIndexEndpointsStream with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListIndexEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListIndexEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listIndexEndpoints.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listIndexEndpointsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.IndexEndpoint[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.IndexEndpoint) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listIndexEndpoints.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listIndexEndpoints, request)); - assert( - (client.descriptors.page.listIndexEndpoints.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listIndexEndpoints with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListIndexEndpointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListIndexEndpointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listIndexEndpoints.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listIndexEndpointsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.IIndexEndpoint[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listIndexEndpoints.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listIndexEndpoints.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listCollections', () => { + it('invokes listCollections without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListCollectionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListCollectionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), + ]; + client.innerApiCalls.listCollections = stubSimpleCall(expectedResponse); + const [response] = await client.listCollections(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCollections as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCollections as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listIndexEndpoints without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListIndexEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListIndexEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexEndpoint()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexEndpoint()), - generateSampleMessage(new protos.google.cloud.visionai.v1.IndexEndpoint()), - ]; - client.descriptors.page.listIndexEndpoints.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.IIndexEndpoint[] = []; - const iterable = client.listIndexEndpointsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listCollections without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListCollectionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListCollectionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), + ]; + client.innerApiCalls.listCollections = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCollections( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ICollection[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listIndexEndpoints.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listIndexEndpoints.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listIndexEndpoints with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListIndexEndpointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListIndexEndpointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listIndexEndpoints.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listIndexEndpointsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.IIndexEndpoint[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listIndexEndpoints.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listIndexEndpoints.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCollections as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCollections as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listCollections', () => { - it('invokes listCollections without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListCollectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListCollectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), - ]; - client.innerApiCalls.listCollections = stubSimpleCall(expectedResponse); - const [response] = await client.listCollections(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCollections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCollections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listCollections with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListCollectionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListCollectionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCollections = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listCollections(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listCollections as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCollections as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listCollections without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListCollectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListCollectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), - ]; - client.innerApiCalls.listCollections = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCollections( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ICollection[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCollections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCollections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listCollectionsStream without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListCollectionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListCollectionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), + ]; + client.descriptors.page.listCollections.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listCollectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Collection[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Collection) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listCollections.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCollections, request), + ); + assert( + (client.descriptors.page.listCollections.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listCollections with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListCollectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListCollectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCollections = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCollections(request), expectedError); - const actualRequest = (client.innerApiCalls.listCollections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCollections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listCollectionsStream with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListCollectionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListCollectionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCollections.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listCollectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.Collection[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.Collection) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listCollections.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCollections, request), + ); + assert( + (client.descriptors.page.listCollections.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listCollectionsStream without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListCollectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListCollectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), - ]; - client.descriptors.page.listCollections.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCollectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Collection[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Collection) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCollections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCollections, request)); - assert( - (client.descriptors.page.listCollections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listCollections without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListCollectionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListCollectionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), + generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), + ]; + client.descriptors.page.listCollections.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.ICollection[] = []; + const iterable = client.listCollectionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listCollections.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCollections.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listCollectionsStream with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListCollectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListCollectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCollections.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCollectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.Collection[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.Collection) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCollections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCollections, request)); - assert( - (client.descriptors.page.listCollections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listCollections with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ListCollectionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ListCollectionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCollections.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCollectionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.ICollection[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listCollections.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCollections.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('viewCollectionItems', () => { + it('invokes viewCollectionItems without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ViewCollectionItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ViewCollectionItemsRequest', + ['collection'], + ); + request.collection = defaultValue1; + const expectedHeaderRequestParams = `collection=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.CollectionItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.CollectionItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.CollectionItem(), + ), + ]; + client.innerApiCalls.viewCollectionItems = + stubSimpleCall(expectedResponse); + const [response] = await client.viewCollectionItems(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.viewCollectionItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.viewCollectionItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listCollections without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListCollectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListCollectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), - generateSampleMessage(new protos.google.cloud.visionai.v1.Collection()), - ]; - client.descriptors.page.listCollections.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.ICollection[] = []; - const iterable = client.listCollectionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes viewCollectionItems without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ViewCollectionItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ViewCollectionItemsRequest', + ['collection'], + ); + request.collection = defaultValue1; + const expectedHeaderRequestParams = `collection=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.CollectionItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.CollectionItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.CollectionItem(), + ), + ]; + client.innerApiCalls.viewCollectionItems = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.viewCollectionItems( + request, + ( + err?: Error | null, + result?: protos.google.cloud.visionai.v1.ICollectionItem[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCollections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCollections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCollections with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ListCollectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ListCollectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCollections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCollectionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.ICollection[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCollections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCollections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.viewCollectionItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.viewCollectionItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('viewCollectionItems', () => { - it('invokes viewCollectionItems without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ViewCollectionItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ViewCollectionItemsRequest', ['collection']); - request.collection = defaultValue1; - const expectedHeaderRequestParams = `collection=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.CollectionItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.CollectionItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.CollectionItem()), - ]; - client.innerApiCalls.viewCollectionItems = stubSimpleCall(expectedResponse); - const [response] = await client.viewCollectionItems(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.viewCollectionItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.viewCollectionItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes viewCollectionItems without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ViewCollectionItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ViewCollectionItemsRequest', ['collection']); - request.collection = defaultValue1; - const expectedHeaderRequestParams = `collection=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.CollectionItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.CollectionItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.CollectionItem()), - ]; - client.innerApiCalls.viewCollectionItems = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.viewCollectionItems( - request, - (err?: Error|null, result?: protos.google.cloud.visionai.v1.ICollectionItem[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.viewCollectionItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.viewCollectionItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes viewCollectionItems with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ViewCollectionItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ViewCollectionItemsRequest', ['collection']); - request.collection = defaultValue1; - const expectedHeaderRequestParams = `collection=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.viewCollectionItems = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.viewCollectionItems(request), expectedError); - const actualRequest = (client.innerApiCalls.viewCollectionItems as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.viewCollectionItems as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes viewCollectionItems with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ViewCollectionItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ViewCollectionItemsRequest', + ['collection'], + ); + request.collection = defaultValue1; + const expectedHeaderRequestParams = `collection=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.viewCollectionItems = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.viewCollectionItems(request), expectedError); + const actualRequest = ( + client.innerApiCalls.viewCollectionItems as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.viewCollectionItems as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes viewCollectionItemsStream without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ViewCollectionItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ViewCollectionItemsRequest', ['collection']); - request.collection = defaultValue1; - const expectedHeaderRequestParams = `collection=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.CollectionItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.CollectionItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.CollectionItem()), - ]; - client.descriptors.page.viewCollectionItems.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.viewCollectionItemsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.CollectionItem[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.CollectionItem) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.viewCollectionItems.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.viewCollectionItems, request)); - assert( - (client.descriptors.page.viewCollectionItems.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes viewCollectionItemsStream without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ViewCollectionItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ViewCollectionItemsRequest', + ['collection'], + ); + request.collection = defaultValue1; + const expectedHeaderRequestParams = `collection=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.CollectionItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.CollectionItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.CollectionItem(), + ), + ]; + client.descriptors.page.viewCollectionItems.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.viewCollectionItemsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.CollectionItem[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.CollectionItem) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.viewCollectionItems.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.viewCollectionItems, request), + ); + assert( + (client.descriptors.page.viewCollectionItems.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes viewCollectionItemsStream with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ViewCollectionItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ViewCollectionItemsRequest', ['collection']); - request.collection = defaultValue1; - const expectedHeaderRequestParams = `collection=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.viewCollectionItems.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.viewCollectionItemsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.visionai.v1.CollectionItem[] = []; - stream.on('data', (response: protos.google.cloud.visionai.v1.CollectionItem) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.viewCollectionItems.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.viewCollectionItems, request)); - assert( - (client.descriptors.page.viewCollectionItems.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes viewCollectionItemsStream with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ViewCollectionItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ViewCollectionItemsRequest', + ['collection'], + ); + request.collection = defaultValue1; + const expectedHeaderRequestParams = `collection=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.viewCollectionItems.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.viewCollectionItemsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.visionai.v1.CollectionItem[] = []; + stream.on( + 'data', + (response: protos.google.cloud.visionai.v1.CollectionItem) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.viewCollectionItems.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.viewCollectionItems, request), + ); + assert( + (client.descriptors.page.viewCollectionItems.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with viewCollectionItems without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ViewCollectionItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ViewCollectionItemsRequest', ['collection']); - request.collection = defaultValue1; - const expectedHeaderRequestParams = `collection=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.visionai.v1.CollectionItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.CollectionItem()), - generateSampleMessage(new protos.google.cloud.visionai.v1.CollectionItem()), - ]; - client.descriptors.page.viewCollectionItems.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.visionai.v1.ICollectionItem[] = []; - const iterable = client.viewCollectionItemsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.viewCollectionItems.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.viewCollectionItems.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with viewCollectionItems without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ViewCollectionItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ViewCollectionItemsRequest', + ['collection'], + ); + request.collection = defaultValue1; + const expectedHeaderRequestParams = `collection=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.visionai.v1.CollectionItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.CollectionItem(), + ), + generateSampleMessage( + new protos.google.cloud.visionai.v1.CollectionItem(), + ), + ]; + client.descriptors.page.viewCollectionItems.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.visionai.v1.ICollectionItem[] = []; + const iterable = client.viewCollectionItemsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.viewCollectionItems.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.viewCollectionItems.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with viewCollectionItems with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.visionai.v1.ViewCollectionItemsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.visionai.v1.ViewCollectionItemsRequest', ['collection']); - request.collection = defaultValue1; - const expectedHeaderRequestParams = `collection=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.viewCollectionItems.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.viewCollectionItemsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.visionai.v1.ICollectionItem[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.viewCollectionItems.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.viewCollectionItems.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with viewCollectionItems with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.visionai.v1.ViewCollectionItemsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.visionai.v1.ViewCollectionItemsRequest', + ['collection'], + ); + request.collection = defaultValue1; + const expectedHeaderRequestParams = `collection=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.viewCollectionItems.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.viewCollectionItemsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.visionai.v1.ICollectionItem[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.viewCollectionItems.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.viewCollectionItems.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.getIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .getIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getIamPolicy(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.setIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .setIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('invokes setIamPolicy with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.setIamPolicy(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse(), + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions( + request, + expectedOptions, + ); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse(), + ); + client.iamClient.testIamPermissions = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .testIamPermissions( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.TestIamPermissionsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.testIamPermissions(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.IOperation[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.IOperation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + }); + + describe('Path templates', () => { + describe('analysis', async () => { + const fakePath = '/rendered/path/analysis'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + analysis: 'analysisValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.analysisPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.analysisPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('analysisPath', () => { + const result = client.analysisPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'analysisValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.analysisPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromAnalysisName', () => { + const result = client.matchProjectFromAnalysisName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAnalysisName', () => { + const result = client.matchLocationFromAnalysisName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromAnalysisName', () => { + const result = client.matchClusterFromAnalysisName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAnalysisFromAnalysisName', () => { + const result = client.matchAnalysisFromAnalysisName(fakePath); + assert.strictEqual(result, 'analysisValue'); + assert( + (client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('analysis', async () => { - const fakePath = "/rendered/path/analysis"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - analysis: "analysisValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.analysisPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.analysisPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('analysisPath', () => { - const result = client.analysisPath("projectValue", "locationValue", "clusterValue", "analysisValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.analysisPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAnalysisName', () => { - const result = client.matchProjectFromAnalysisName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAnalysisName', () => { - const result = client.matchLocationFromAnalysisName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromAnalysisName', () => { - const result = client.matchClusterFromAnalysisName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnalysisFromAnalysisName', () => { - const result = client.matchAnalysisFromAnalysisName(fakePath); - assert.strictEqual(result, "analysisValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('annotation', async () => { - const fakePath = "/rendered/path/annotation"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - asset: "assetValue", - annotation: "annotationValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.annotationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.annotationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('annotationPath', () => { - const result = client.annotationPath("projectNumberValue", "locationValue", "corpusValue", "assetValue", "annotationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.annotationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromAnnotationName', () => { - const result = client.matchProjectNumberFromAnnotationName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAnnotationName', () => { - const result = client.matchLocationFromAnnotationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromAnnotationName', () => { - const result = client.matchCorpusFromAnnotationName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAnnotationName', () => { - const result = client.matchAssetFromAnnotationName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnnotationFromAnnotationName', () => { - const result = client.matchAnnotationFromAnnotationName(fakePath); - assert.strictEqual(result, "annotationValue"); - assert((client.pathTemplates.annotationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('annotation', async () => { + const fakePath = '/rendered/path/annotation'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + asset: 'assetValue', + annotation: 'annotationValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.annotationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.annotationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('annotationPath', () => { + const result = client.annotationPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'assetValue', + 'annotationValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.annotationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromAnnotationName', () => { + const result = client.matchProjectNumberFromAnnotationName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAnnotationName', () => { + const result = client.matchLocationFromAnnotationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromAnnotationName', () => { + const result = client.matchCorpusFromAnnotationName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAssetFromAnnotationName', () => { + const result = client.matchAssetFromAnnotationName(fakePath); + assert.strictEqual(result, 'assetValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAnnotationFromAnnotationName', () => { + const result = client.matchAnnotationFromAnnotationName(fakePath); + assert.strictEqual(result, 'annotationValue'); + assert( + (client.pathTemplates.annotationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('application', async () => { - const fakePath = "/rendered/path/application"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.applicationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.applicationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('applicationPath', () => { - const result = client.applicationPath("projectValue", "locationValue", "applicationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.applicationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromApplicationName', () => { - const result = client.matchProjectFromApplicationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromApplicationName', () => { - const result = client.matchLocationFromApplicationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromApplicationName', () => { - const result = client.matchApplicationFromApplicationName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.applicationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('application', async () => { + const fakePath = '/rendered/path/application'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.applicationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.applicationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('applicationPath', () => { + const result = client.applicationPath( + 'projectValue', + 'locationValue', + 'applicationValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.applicationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromApplicationName', () => { + const result = client.matchProjectFromApplicationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromApplicationName', () => { + const result = client.matchLocationFromApplicationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromApplicationName', () => { + const result = client.matchApplicationFromApplicationName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.applicationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('asset', async () => { - const fakePath = "/rendered/path/asset"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - asset: "assetValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.assetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.assetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('assetPath', () => { - const result = client.assetPath("projectNumberValue", "locationValue", "corpusValue", "assetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.assetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromAssetName', () => { - const result = client.matchProjectNumberFromAssetName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAssetName', () => { - const result = client.matchLocationFromAssetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromAssetName', () => { - const result = client.matchCorpusFromAssetName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAssetFromAssetName', () => { - const result = client.matchAssetFromAssetName(fakePath); - assert.strictEqual(result, "assetValue"); - assert((client.pathTemplates.assetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('asset', async () => { + const fakePath = '/rendered/path/asset'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + asset: 'assetValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.assetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.assetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('assetPath', () => { + const result = client.assetPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'assetValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.assetPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromAssetName', () => { + const result = client.matchProjectNumberFromAssetName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromAssetName', () => { + const result = client.matchLocationFromAssetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromAssetName', () => { + const result = client.matchCorpusFromAssetName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchAssetFromAssetName', () => { + const result = client.matchAssetFromAssetName(fakePath); + assert.strictEqual(result, 'assetValue'); + assert( + (client.pathTemplates.assetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('channel', async () => { - const fakePath = "/rendered/path/channel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - channel: "channelValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.channelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.channelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('channelPath', () => { - const result = client.channelPath("projectValue", "locationValue", "clusterValue", "channelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.channelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromChannelName', () => { - const result = client.matchProjectFromChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromChannelName', () => { - const result = client.matchLocationFromChannelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromChannelName', () => { - const result = client.matchClusterFromChannelName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelFromChannelName', () => { - const result = client.matchChannelFromChannelName(fakePath); - assert.strictEqual(result, "channelValue"); - assert((client.pathTemplates.channelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('channel', async () => { + const fakePath = '/rendered/path/channel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + channel: 'channelValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.channelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.channelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('channelPath', () => { + const result = client.channelPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'channelValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.channelPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromChannelName', () => { + const result = client.matchProjectFromChannelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromChannelName', () => { + const result = client.matchLocationFromChannelName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromChannelName', () => { + const result = client.matchClusterFromChannelName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchChannelFromChannelName', () => { + const result = client.matchChannelFromChannelName(fakePath); + assert.strictEqual(result, 'channelValue'); + assert( + (client.pathTemplates.channelPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('cluster', async () => { - const fakePath = "/rendered/path/cluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clusterPath', () => { - const result = client.clusterPath("projectValue", "locationValue", "clusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClusterName', () => { - const result = client.matchProjectFromClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClusterName', () => { - const result = client.matchLocationFromClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromClusterName', () => { - const result = client.matchClusterFromClusterName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('cluster', async () => { + const fakePath = '/rendered/path/cluster'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clusterPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clusterPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clusterPath', () => { + const result = client.clusterPath( + 'projectValue', + 'locationValue', + 'clusterValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clusterPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClusterName', () => { + const result = client.matchProjectFromClusterName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClusterName', () => { + const result = client.matchLocationFromClusterName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromClusterName', () => { + const result = client.matchClusterFromClusterName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('collection', async () => { - const fakePath = "/rendered/path/collection"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - collection: "collectionValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.collectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.collectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('collectionPath', () => { - const result = client.collectionPath("projectNumberValue", "locationValue", "corpusValue", "collectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.collectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromCollectionName', () => { - const result = client.matchProjectNumberFromCollectionName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCollectionName', () => { - const result = client.matchLocationFromCollectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromCollectionName', () => { - const result = client.matchCorpusFromCollectionName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCollectionFromCollectionName', () => { - const result = client.matchCollectionFromCollectionName(fakePath); - assert.strictEqual(result, "collectionValue"); - assert((client.pathTemplates.collectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('collection', async () => { + const fakePath = '/rendered/path/collection'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + collection: 'collectionValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.collectionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.collectionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('collectionPath', () => { + const result = client.collectionPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'collectionValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.collectionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromCollectionName', () => { + const result = client.matchProjectNumberFromCollectionName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCollectionName', () => { + const result = client.matchLocationFromCollectionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromCollectionName', () => { + const result = client.matchCorpusFromCollectionName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCollectionFromCollectionName', () => { + const result = client.matchCollectionFromCollectionName(fakePath); + assert.strictEqual(result, 'collectionValue'); + assert( + (client.pathTemplates.collectionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('corpus', async () => { - const fakePath = "/rendered/path/corpus"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.corpusPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.corpusPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('corpusPath', () => { - const result = client.corpusPath("projectNumberValue", "locationValue", "corpusValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.corpusPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromCorpusName', () => { - const result = client.matchProjectNumberFromCorpusName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCorpusName', () => { - const result = client.matchLocationFromCorpusName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromCorpusName', () => { - const result = client.matchCorpusFromCorpusName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.corpusPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('corpus', async () => { + const fakePath = '/rendered/path/corpus'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.corpusPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.corpusPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('corpusPath', () => { + const result = client.corpusPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.corpusPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromCorpusName', () => { + const result = client.matchProjectNumberFromCorpusName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCorpusName', () => { + const result = client.matchLocationFromCorpusName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromCorpusName', () => { + const result = client.matchCorpusFromCorpusName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.corpusPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dataSchema', async () => { - const fakePath = "/rendered/path/dataSchema"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - data_schema: "dataSchemaValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dataSchemaPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dataSchemaPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dataSchemaPath', () => { - const result = client.dataSchemaPath("projectNumberValue", "locationValue", "corpusValue", "dataSchemaValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dataSchemaPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromDataSchemaName', () => { - const result = client.matchProjectNumberFromDataSchemaName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDataSchemaName', () => { - const result = client.matchLocationFromDataSchemaName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromDataSchemaName', () => { - const result = client.matchCorpusFromDataSchemaName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDataSchemaFromDataSchemaName', () => { - const result = client.matchDataSchemaFromDataSchemaName(fakePath); - assert.strictEqual(result, "dataSchemaValue"); - assert((client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dataSchema', async () => { + const fakePath = '/rendered/path/dataSchema'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + data_schema: 'dataSchemaValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dataSchemaPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dataSchemaPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dataSchemaPath', () => { + const result = client.dataSchemaPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'dataSchemaValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.dataSchemaPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromDataSchemaName', () => { + const result = client.matchProjectNumberFromDataSchemaName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDataSchemaName', () => { + const result = client.matchLocationFromDataSchemaName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromDataSchemaName', () => { + const result = client.matchCorpusFromDataSchemaName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataSchemaFromDataSchemaName', () => { + const result = client.matchDataSchemaFromDataSchemaName(fakePath); + assert.strictEqual(result, 'dataSchemaValue'); + assert( + (client.pathTemplates.dataSchemaPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('draft', async () => { - const fakePath = "/rendered/path/draft"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - draft: "draftValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.draftPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.draftPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('draftPath', () => { - const result = client.draftPath("projectValue", "locationValue", "applicationValue", "draftValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.draftPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDraftName', () => { - const result = client.matchProjectFromDraftName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDraftName', () => { - const result = client.matchLocationFromDraftName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromDraftName', () => { - const result = client.matchApplicationFromDraftName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDraftFromDraftName', () => { - const result = client.matchDraftFromDraftName(fakePath); - assert.strictEqual(result, "draftValue"); - assert((client.pathTemplates.draftPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('draft', async () => { + const fakePath = '/rendered/path/draft'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + draft: 'draftValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.draftPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.draftPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('draftPath', () => { + const result = client.draftPath( + 'projectValue', + 'locationValue', + 'applicationValue', + 'draftValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.draftPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDraftName', () => { + const result = client.matchProjectFromDraftName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDraftName', () => { + const result = client.matchLocationFromDraftName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromDraftName', () => { + const result = client.matchApplicationFromDraftName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDraftFromDraftName', () => { + const result = client.matchDraftFromDraftName(fakePath); + assert.strictEqual(result, 'draftValue'); + assert( + (client.pathTemplates.draftPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('event', async () => { - const fakePath = "/rendered/path/event"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - event: "eventValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.eventPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.eventPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('eventPath', () => { - const result = client.eventPath("projectValue", "locationValue", "clusterValue", "eventValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.eventPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromEventName', () => { - const result = client.matchProjectFromEventName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromEventName', () => { - const result = client.matchLocationFromEventName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromEventName', () => { - const result = client.matchClusterFromEventName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEventFromEventName', () => { - const result = client.matchEventFromEventName(fakePath); - assert.strictEqual(result, "eventValue"); - assert((client.pathTemplates.eventPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('event', async () => { + const fakePath = '/rendered/path/event'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + event: 'eventValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.eventPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.eventPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('eventPath', () => { + const result = client.eventPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'eventValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.eventPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromEventName', () => { + const result = client.matchProjectFromEventName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromEventName', () => { + const result = client.matchLocationFromEventName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromEventName', () => { + const result = client.matchClusterFromEventName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchEventFromEventName', () => { + const result = client.matchEventFromEventName(fakePath); + assert.strictEqual(result, 'eventValue'); + assert( + (client.pathTemplates.eventPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('index', async () => { - const fakePath = "/rendered/path/index"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - index: "indexValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.indexPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.indexPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('indexPath', () => { - const result = client.indexPath("projectNumberValue", "locationValue", "corpusValue", "indexValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.indexPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromIndexName', () => { - const result = client.matchProjectNumberFromIndexName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromIndexName', () => { - const result = client.matchLocationFromIndexName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromIndexName', () => { - const result = client.matchCorpusFromIndexName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIndexFromIndexName', () => { - const result = client.matchIndexFromIndexName(fakePath); - assert.strictEqual(result, "indexValue"); - assert((client.pathTemplates.indexPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('index', async () => { + const fakePath = '/rendered/path/index'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + index: 'indexValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.indexPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.indexPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('indexPath', () => { + const result = client.indexPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'indexValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.indexPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromIndexName', () => { + const result = client.matchProjectNumberFromIndexName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromIndexName', () => { + const result = client.matchLocationFromIndexName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromIndexName', () => { + const result = client.matchCorpusFromIndexName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchIndexFromIndexName', () => { + const result = client.matchIndexFromIndexName(fakePath); + assert.strictEqual(result, 'indexValue'); + assert( + (client.pathTemplates.indexPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('indexEndpoint', async () => { - const fakePath = "/rendered/path/indexEndpoint"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - index_endpoint: "indexEndpointValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.indexEndpointPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.indexEndpointPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('indexEndpointPath', () => { - const result = client.indexEndpointPath("projectValue", "locationValue", "indexEndpointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.indexEndpointPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromIndexEndpointName', () => { - const result = client.matchProjectFromIndexEndpointName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromIndexEndpointName', () => { - const result = client.matchLocationFromIndexEndpointName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIndexEndpointFromIndexEndpointName', () => { - const result = client.matchIndexEndpointFromIndexEndpointName(fakePath); - assert.strictEqual(result, "indexEndpointValue"); - assert((client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('indexEndpoint', async () => { + const fakePath = '/rendered/path/indexEndpoint'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + index_endpoint: 'indexEndpointValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.indexEndpointPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.indexEndpointPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('indexEndpointPath', () => { + const result = client.indexEndpointPath( + 'projectValue', + 'locationValue', + 'indexEndpointValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.indexEndpointPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromIndexEndpointName', () => { + const result = client.matchProjectFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromIndexEndpointName', () => { + const result = client.matchLocationFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchIndexEndpointFromIndexEndpointName', () => { + const result = client.matchIndexEndpointFromIndexEndpointName(fakePath); + assert.strictEqual(result, 'indexEndpointValue'); + assert( + (client.pathTemplates.indexEndpointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('instance', async () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - application: "applicationValue", - instance: "instanceValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "applicationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchApplicationFromInstanceName', () => { - const result = client.matchApplicationFromInstanceName(fakePath); - assert.strictEqual(result, "applicationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('instance', async () => { + const fakePath = '/rendered/path/instance'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + application: 'applicationValue', + instance: 'instanceValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.instancePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.instancePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath( + 'projectValue', + 'locationValue', + 'applicationValue', + 'instanceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromInstanceName', () => { + const result = client.matchLocationFromInstanceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchApplicationFromInstanceName', () => { + const result = client.matchApplicationFromInstanceName(fakePath); + assert.strictEqual(result, 'applicationValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, 'instanceValue'); + assert( + (client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('operator', async () => { - const fakePath = "/rendered/path/operator"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - operator: "operatorValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.operatorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.operatorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('operatorPath', () => { - const result = client.operatorPath("projectValue", "locationValue", "operatorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.operatorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromOperatorName', () => { - const result = client.matchProjectFromOperatorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOperatorName', () => { - const result = client.matchLocationFromOperatorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchOperatorFromOperatorName', () => { - const result = client.matchOperatorFromOperatorName(fakePath); - assert.strictEqual(result, "operatorValue"); - assert((client.pathTemplates.operatorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('operator', async () => { + const fakePath = '/rendered/path/operator'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + operator: 'operatorValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.operatorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.operatorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('operatorPath', () => { + const result = client.operatorPath( + 'projectValue', + 'locationValue', + 'operatorValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.operatorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromOperatorName', () => { + const result = client.matchProjectFromOperatorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromOperatorName', () => { + const result = client.matchLocationFromOperatorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchOperatorFromOperatorName', () => { + const result = client.matchOperatorFromOperatorName(fakePath); + assert.strictEqual(result, 'operatorValue'); + assert( + (client.pathTemplates.operatorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('process', async () => { - const fakePath = "/rendered/path/process"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - process: "processValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.processPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.processPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('processPath', () => { - const result = client.processPath("projectValue", "locationValue", "clusterValue", "processValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.processPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProcessName', () => { - const result = client.matchProjectFromProcessName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProcessName', () => { - const result = client.matchLocationFromProcessName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromProcessName', () => { - const result = client.matchClusterFromProcessName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProcessFromProcessName', () => { - const result = client.matchProcessFromProcessName(fakePath); - assert.strictEqual(result, "processValue"); - assert((client.pathTemplates.processPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('process', async () => { + const fakePath = '/rendered/path/process'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + process: 'processValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.processPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processPath', () => { + const result = client.processPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'processValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProcessName', () => { + const result = client.matchProjectFromProcessName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProcessName', () => { + const result = client.matchLocationFromProcessName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromProcessName', () => { + const result = client.matchClusterFromProcessName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchProcessFromProcessName', () => { + const result = client.matchProcessFromProcessName(fakePath); + assert.strictEqual(result, 'processValue'); + assert( + (client.pathTemplates.processPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('processor', async () => { - const fakePath = "/rendered/path/processor"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - processor: "processorValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.processorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.processorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('processorPath', () => { - const result = client.processorPath("projectValue", "locationValue", "processorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.processorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProcessorName', () => { - const result = client.matchProjectFromProcessorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProcessorName', () => { - const result = client.matchLocationFromProcessorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProcessorFromProcessorName', () => { - const result = client.matchProcessorFromProcessorName(fakePath); - assert.strictEqual(result, "processorValue"); - assert((client.pathTemplates.processorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('processor', async () => { + const fakePath = '/rendered/path/processor'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor: 'processorValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.processorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processorPath', () => { + const result = client.processorPath( + 'projectValue', + 'locationValue', + 'processorValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProcessorName', () => { + const result = client.matchProjectFromProcessorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromProcessorName', () => { + const result = client.matchLocationFromProcessorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchProcessorFromProcessorName', () => { + const result = client.matchProcessorFromProcessorName(fakePath); + assert.strictEqual(result, 'processorValue'); + assert( + (client.pathTemplates.processorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('searchConfig', async () => { - const fakePath = "/rendered/path/searchConfig"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - search_config: "searchConfigValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.searchConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.searchConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('searchConfigPath', () => { - const result = client.searchConfigPath("projectNumberValue", "locationValue", "corpusValue", "searchConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.searchConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromSearchConfigName', () => { - const result = client.matchProjectNumberFromSearchConfigName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSearchConfigName', () => { - const result = client.matchLocationFromSearchConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromSearchConfigName', () => { - const result = client.matchCorpusFromSearchConfigName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSearchConfigFromSearchConfigName', () => { - const result = client.matchSearchConfigFromSearchConfigName(fakePath); - assert.strictEqual(result, "searchConfigValue"); - assert((client.pathTemplates.searchConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('searchConfig', async () => { + const fakePath = '/rendered/path/searchConfig'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + search_config: 'searchConfigValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.searchConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.searchConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('searchConfigPath', () => { + const result = client.searchConfigPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'searchConfigValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.searchConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromSearchConfigName', () => { + const result = client.matchProjectNumberFromSearchConfigName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSearchConfigName', () => { + const result = client.matchLocationFromSearchConfigName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromSearchConfigName', () => { + const result = client.matchCorpusFromSearchConfigName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSearchConfigFromSearchConfigName', () => { + const result = client.matchSearchConfigFromSearchConfigName(fakePath); + assert.strictEqual(result, 'searchConfigValue'); + assert( + (client.pathTemplates.searchConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('searchHypernym', async () => { - const fakePath = "/rendered/path/searchHypernym"; - const expectedParameters = { - project_number: "projectNumberValue", - location: "locationValue", - corpus: "corpusValue", - search_hypernym: "searchHypernymValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.searchHypernymPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.searchHypernymPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('searchHypernymPath', () => { - const result = client.searchHypernymPath("projectNumberValue", "locationValue", "corpusValue", "searchHypernymValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.searchHypernymPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectNumberFromSearchHypernymName', () => { - const result = client.matchProjectNumberFromSearchHypernymName(fakePath); - assert.strictEqual(result, "projectNumberValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSearchHypernymName', () => { - const result = client.matchLocationFromSearchHypernymName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCorpusFromSearchHypernymName', () => { - const result = client.matchCorpusFromSearchHypernymName(fakePath); - assert.strictEqual(result, "corpusValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSearchHypernymFromSearchHypernymName', () => { - const result = client.matchSearchHypernymFromSearchHypernymName(fakePath); - assert.strictEqual(result, "searchHypernymValue"); - assert((client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('searchHypernym', async () => { + const fakePath = '/rendered/path/searchHypernym'; + const expectedParameters = { + project_number: 'projectNumberValue', + location: 'locationValue', + corpus: 'corpusValue', + search_hypernym: 'searchHypernymValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.searchHypernymPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.searchHypernymPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('searchHypernymPath', () => { + const result = client.searchHypernymPath( + 'projectNumberValue', + 'locationValue', + 'corpusValue', + 'searchHypernymValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.searchHypernymPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectNumberFromSearchHypernymName', () => { + const result = + client.matchProjectNumberFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'projectNumberValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSearchHypernymName', () => { + const result = client.matchLocationFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCorpusFromSearchHypernymName', () => { + const result = client.matchCorpusFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'corpusValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSearchHypernymFromSearchHypernymName', () => { + const result = + client.matchSearchHypernymFromSearchHypernymName(fakePath); + assert.strictEqual(result, 'searchHypernymValue'); + assert( + (client.pathTemplates.searchHypernymPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('series', async () => { - const fakePath = "/rendered/path/series"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - series: "seriesValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.seriesPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.seriesPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('seriesPath', () => { - const result = client.seriesPath("projectValue", "locationValue", "clusterValue", "seriesValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.seriesPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSeriesName', () => { - const result = client.matchProjectFromSeriesName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSeriesName', () => { - const result = client.matchLocationFromSeriesName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromSeriesName', () => { - const result = client.matchClusterFromSeriesName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSeriesFromSeriesName', () => { - const result = client.matchSeriesFromSeriesName(fakePath); - assert.strictEqual(result, "seriesValue"); - assert((client.pathTemplates.seriesPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('series', async () => { + const fakePath = '/rendered/path/series'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + series: 'seriesValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.seriesPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.seriesPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('seriesPath', () => { + const result = client.seriesPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'seriesValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.seriesPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSeriesName', () => { + const result = client.matchProjectFromSeriesName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSeriesName', () => { + const result = client.matchLocationFromSeriesName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromSeriesName', () => { + const result = client.matchClusterFromSeriesName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSeriesFromSeriesName', () => { + const result = client.matchSeriesFromSeriesName(fakePath); + assert.strictEqual(result, 'seriesValue'); + assert( + (client.pathTemplates.seriesPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('stream', async () => { - const fakePath = "/rendered/path/stream"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - cluster: "clusterValue", - stream: "streamValue", - }; - const client = new warehouseModule.v1.WarehouseClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.streamPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.streamPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('streamPath', () => { - const result = client.streamPath("projectValue", "locationValue", "clusterValue", "streamValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.streamPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromStreamName', () => { - const result = client.matchProjectFromStreamName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromStreamName', () => { - const result = client.matchLocationFromStreamName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromStreamName', () => { - const result = client.matchClusterFromStreamName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStreamFromStreamName', () => { - const result = client.matchStreamFromStreamName(fakePath); - assert.strictEqual(result, "streamValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('stream', async () => { + const fakePath = '/rendered/path/stream'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + cluster: 'clusterValue', + stream: 'streamValue', + }; + const client = new warehouseModule.v1.WarehouseClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.streamPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.streamPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('streamPath', () => { + const result = client.streamPath( + 'projectValue', + 'locationValue', + 'clusterValue', + 'streamValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.streamPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromStreamName', () => { + const result = client.matchProjectFromStreamName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromStreamName', () => { + const result = client.matchLocationFromStreamName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromStreamName', () => { + const result = client.matchClusterFromStreamName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchStreamFromStreamName', () => { + const result = client.matchStreamFromStreamName(fakePath); + assert.strictEqual(result, 'streamValue'); + assert( + (client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-visionai/webpack.config.js b/packages/google-cloud-visionai/webpack.config.js index e46921c46995..a59dfd54e8ba 100644 --- a/packages/google-cloud-visionai/webpack.config.js +++ b/packages/google-cloud-visionai/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2026 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. diff --git a/packages/google-cloud-vmmigration/.eslintignore b/packages/google-cloud-vmmigration/.eslintignore new file mode 100644 index 000000000000..cfc348ec4d11 --- /dev/null +++ b/packages/google-cloud-vmmigration/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/packages/google-cloud-vmmigration/.eslintrc.json b/packages/google-cloud-vmmigration/.eslintrc.json new file mode 100644 index 000000000000..3e8d97ccb390 --- /dev/null +++ b/packages/google-cloud-vmmigration/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "./node_modules/gts", + "root": true +} diff --git a/packages/google-cloud-vmmigration/README.md b/packages/google-cloud-vmmigration/README.md index 63f198cec8ea..640564686578 100644 --- a/packages/google-cloud-vmmigration/README.md +++ b/packages/google-cloud-vmmigration/README.md @@ -154,7 +154,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-vmmigration/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). Please note that this `README.md` and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) @@ -164,7 +164,7 @@ are generated from a central template. Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-vmmigration/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project diff --git a/packages/google-cloud-vmmigration/protos/protos.d.ts b/packages/google-cloud-vmmigration/protos/protos.d.ts index 73ef6335eb18..0f9633359fb2 100644 --- a/packages/google-cloud-vmmigration/protos/protos.d.ts +++ b/packages/google-cloud-vmmigration/protos/protos.d.ts @@ -23194,6 +23194,9 @@ export namespace google { /** CommonLanguageSettings destinations */ destinations?: (google.api.ClientLibraryDestination[]|null); + + /** CommonLanguageSettings selectiveGapicGeneration */ + selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); } /** Represents a CommonLanguageSettings. */ @@ -23211,6 +23214,9 @@ export namespace google { /** CommonLanguageSettings destinations. */ public destinations: google.api.ClientLibraryDestination[]; + /** CommonLanguageSettings selectiveGapicGeneration. */ + public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @param [properties] Properties to set @@ -23911,6 +23917,9 @@ export namespace google { /** PythonSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures */ + experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); } /** Represents a PythonSettings. */ @@ -23925,6 +23934,9 @@ export namespace google { /** PythonSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** PythonSettings experimentalFeatures. */ + public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + /** * Creates a new PythonSettings instance using the specified properties. * @param [properties] Properties to set @@ -24003,6 +24015,118 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace PythonSettings { + + /** Properties of an ExperimentalFeatures. */ + interface IExperimentalFeatures { + + /** ExperimentalFeatures restAsyncIoEnabled */ + restAsyncIoEnabled?: (boolean|null); + + /** ExperimentalFeatures protobufPythonicTypesEnabled */ + protobufPythonicTypesEnabled?: (boolean|null); + + /** ExperimentalFeatures unversionedPackageDisabled */ + unversionedPackageDisabled?: (boolean|null); + } + + /** Represents an ExperimentalFeatures. */ + class ExperimentalFeatures implements IExperimentalFeatures { + + /** + * Constructs a new ExperimentalFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); + + /** ExperimentalFeatures restAsyncIoEnabled. */ + public restAsyncIoEnabled: boolean; + + /** ExperimentalFeatures protobufPythonicTypesEnabled. */ + public protobufPythonicTypesEnabled: boolean; + + /** ExperimentalFeatures unversionedPackageDisabled. */ + public unversionedPackageDisabled: boolean; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns ExperimentalFeatures instance + */ + public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Verifies an ExperimentalFeatures 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 an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExperimentalFeatures + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @param message ExperimentalFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExperimentalFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Properties of a NodeSettings. */ interface INodeSettings { @@ -24329,6 +24453,9 @@ export namespace google { /** GoSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); } /** Represents a GoSettings. */ @@ -24343,6 +24470,9 @@ export namespace google { /** GoSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** GoSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + /** * Creates a new GoSettings instance using the specified properties. * @param [properties] Properties to set @@ -24667,6 +24797,109 @@ export namespace google { PACKAGE_MANAGER = 20 } + /** Properties of a SelectiveGapicGeneration. */ + interface ISelectiveGapicGeneration { + + /** SelectiveGapicGeneration methods */ + methods?: (string[]|null); + + /** SelectiveGapicGeneration generateOmittedAsInternal */ + generateOmittedAsInternal?: (boolean|null); + } + + /** Represents a SelectiveGapicGeneration. */ + class SelectiveGapicGeneration implements ISelectiveGapicGeneration { + + /** + * Constructs a new SelectiveGapicGeneration. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ISelectiveGapicGeneration); + + /** SelectiveGapicGeneration methods. */ + public methods: string[]; + + /** SelectiveGapicGeneration generateOmittedAsInternal. */ + public generateOmittedAsInternal: boolean; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectiveGapicGeneration instance + */ + public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Verifies a SelectiveGapicGeneration 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 SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectiveGapicGeneration + */ + public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @param message SelectiveGapicGeneration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** LaunchStage enum. */ enum LaunchStage { LAUNCH_STAGE_UNSPECIFIED = 0, @@ -24697,6 +24930,9 @@ export namespace google { /** FieldInfo format */ format?: (google.api.FieldInfo.Format|keyof typeof google.api.FieldInfo.Format|null); + + /** FieldInfo referencedTypes */ + referencedTypes?: (google.api.ITypeReference[]|null); } /** Represents a FieldInfo. */ @@ -24711,6 +24947,9 @@ export namespace google { /** FieldInfo format. */ public format: (google.api.FieldInfo.Format|keyof typeof google.api.FieldInfo.Format); + /** FieldInfo referencedTypes. */ + public referencedTypes: google.api.ITypeReference[]; + /** * Creates a new FieldInfo instance using the specified properties. * @param [properties] Properties to set @@ -24801,6 +25040,103 @@ export namespace google { } } + /** Properties of a TypeReference. */ + interface ITypeReference { + + /** TypeReference typeName */ + typeName?: (string|null); + } + + /** Represents a TypeReference. */ + class TypeReference implements ITypeReference { + + /** + * Constructs a new TypeReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ITypeReference); + + /** TypeReference typeName. */ + public typeName: string; + + /** + * Creates a new TypeReference instance using the specified properties. + * @param [properties] Properties to set + * @returns TypeReference instance + */ + public static create(properties?: google.api.ITypeReference): google.api.TypeReference; + + /** + * Encodes the specified TypeReference message. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @param message TypeReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ITypeReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TypeReference message, length delimited. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @param message TypeReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ITypeReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TypeReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TypeReference + * @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.api.TypeReference; + + /** + * Decodes a TypeReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TypeReference + * @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.api.TypeReference; + + /** + * Verifies a TypeReference 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 TypeReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TypeReference + */ + public static fromObject(object: { [k: string]: any }): google.api.TypeReference; + + /** + * Creates a plain object from a TypeReference message. Also converts values to other types if specified. + * @param message TypeReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.TypeReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TypeReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TypeReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a ResourceDescriptor. */ interface IResourceDescriptor { @@ -25157,6 +25493,7 @@ export namespace google { /** Edition enum. */ enum Edition { EDITION_UNKNOWN = 0, + EDITION_LEGACY = 900, EDITION_PROTO2 = 998, EDITION_PROTO3 = 999, EDITION_2023 = 1000, @@ -25187,6 +25524,9 @@ export namespace google { /** FileDescriptorProto weakDependency */ weakDependency?: (number[]|null); + /** FileDescriptorProto optionDependency */ + optionDependency?: (string[]|null); + /** FileDescriptorProto messageType */ messageType?: (google.protobuf.IDescriptorProto[]|null); @@ -25236,6 +25576,9 @@ export namespace google { /** FileDescriptorProto weakDependency. */ public weakDependency: number[]; + /** FileDescriptorProto optionDependency. */ + public optionDependency: string[]; + /** FileDescriptorProto messageType. */ public messageType: google.protobuf.IDescriptorProto[]; @@ -25370,6 +25713,9 @@ export namespace google { /** DescriptorProto reservedName */ reservedName?: (string[]|null); + + /** DescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents a DescriptorProto. */ @@ -25411,6 +25757,9 @@ export namespace google { /** DescriptorProto reservedName. */ public reservedName: string[]; + /** DescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new DescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -26258,6 +26607,9 @@ export namespace google { /** EnumDescriptorProto reservedName */ reservedName?: (string[]|null); + + /** EnumDescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents an EnumDescriptorProto. */ @@ -26284,6 +26636,9 @@ export namespace google { /** EnumDescriptorProto reservedName. */ public reservedName: string[]; + /** EnumDescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -27218,6 +27573,9 @@ export namespace google { /** FieldOptions features */ features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); @@ -27276,6 +27634,9 @@ export namespace google { /** FieldOptions features. */ public features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -27496,6 +27857,121 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a FeatureSupport. */ + interface IFeatureSupport { + + /** FeatureSupport editionIntroduced */ + editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport editionDeprecated */ + editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport deprecationWarning */ + deprecationWarning?: (string|null); + + /** FeatureSupport editionRemoved */ + editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSupport. */ + class FeatureSupport implements IFeatureSupport { + + /** + * Constructs a new FeatureSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); + + /** FeatureSupport editionIntroduced. */ + public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport editionDeprecated. */ + public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport deprecationWarning. */ + public deprecationWarning: string; + + /** FeatureSupport editionRemoved. */ + public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSupport instance + */ + public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Verifies a FeatureSupport 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 FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSupport + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @param message FeatureSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of an OneofOptions. */ @@ -27734,6 +28210,9 @@ export namespace google { /** EnumValueOptions debugRedact */ debugRedact?: (boolean|null); + /** EnumValueOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); } @@ -27756,6 +28235,9 @@ export namespace google { /** EnumValueOptions debugRedact. */ public debugRedact: boolean; + /** EnumValueOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -28348,6 +28830,12 @@ export namespace google { /** FeatureSet jsonFormat */ jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); + + /** FeatureSet enforceNamingStyle */ + enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); + + /** FeatureSet defaultSymbolVisibility */ + defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); } /** Represents a FeatureSet. */ @@ -28377,6 +28865,12 @@ export namespace google { /** FeatureSet jsonFormat. */ public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); + /** FeatureSet enforceNamingStyle. */ + public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); + + /** FeatureSet defaultSymbolVisibility. */ + public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); + /** * Creates a new FeatureSet instance using the specified properties. * @param [properties] Properties to set @@ -28499,6 +28993,116 @@ export namespace google { ALLOW = 1, LEGACY_BEST_EFFORT = 2 } + + /** EnforceNamingStyle enum. */ + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2 + } + + /** Properties of a VisibilityFeature. */ + interface IVisibilityFeature { + } + + /** Represents a VisibilityFeature. */ + class VisibilityFeature implements IVisibilityFeature { + + /** + * Constructs a new VisibilityFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns VisibilityFeature instance + */ + public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Verifies a VisibilityFeature 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 VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisibilityFeature + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @param message VisibilityFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisibilityFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisibilityFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VisibilityFeature { + + /** DefaultSymbolVisibility enum. */ + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + EXPORT_ALL = 1, + EXPORT_TOP_LEVEL = 2, + LOCAL_ALL = 3, + STRICT = 4 + } + } } /** Properties of a FeatureSetDefaults. */ @@ -28618,8 +29222,11 @@ export namespace google { /** FeatureSetEditionDefault edition */ edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - /** FeatureSetEditionDefault features */ - features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures */ + overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures */ + fixedFeatures?: (google.protobuf.IFeatureSet|null); } /** Represents a FeatureSetEditionDefault. */ @@ -28634,8 +29241,11 @@ export namespace google { /** FeatureSetEditionDefault edition. */ public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - /** FeatureSetEditionDefault features. */ - public features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures. */ + public overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures. */ + public fixedFeatures?: (google.protobuf.IFeatureSet|null); /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -29168,6 +29778,13 @@ export namespace google { } } + /** SymbolVisibility enum. */ + enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2 + } + /** Properties of a Duration. */ interface IDuration { @@ -31166,6 +31783,24 @@ export namespace google { /** Violation description */ description?: (string|null); + + /** Violation apiService */ + apiService?: (string|null); + + /** Violation quotaMetric */ + quotaMetric?: (string|null); + + /** Violation quotaId */ + quotaId?: (string|null); + + /** Violation quotaDimensions */ + quotaDimensions?: ({ [k: string]: string }|null); + + /** Violation quotaValue */ + quotaValue?: (number|Long|string|null); + + /** Violation futureQuotaValue */ + futureQuotaValue?: (number|Long|string|null); } /** Represents a Violation. */ @@ -31183,6 +31818,24 @@ export namespace google { /** Violation description. */ public description: string; + /** Violation apiService. */ + public apiService: string; + + /** Violation quotaMetric. */ + public quotaMetric: string; + + /** Violation quotaId. */ + public quotaId: string; + + /** Violation quotaDimensions. */ + public quotaDimensions: { [k: string]: string }; + + /** Violation quotaValue. */ + public quotaValue: (number|Long|string); + + /** Violation futureQuotaValue. */ + public futureQuotaValue?: (number|Long|string|null); + /** * Creates a new Violation instance using the specified properties. * @param [properties] Properties to set @@ -31578,6 +32231,12 @@ export namespace google { /** FieldViolation description */ description?: (string|null); + + /** FieldViolation reason */ + reason?: (string|null); + + /** FieldViolation localizedMessage */ + localizedMessage?: (google.rpc.ILocalizedMessage|null); } /** Represents a FieldViolation. */ @@ -31595,6 +32254,12 @@ export namespace google { /** FieldViolation description. */ public description: string; + /** FieldViolation reason. */ + public reason: string; + + /** FieldViolation localizedMessage. */ + public localizedMessage?: (google.rpc.ILocalizedMessage|null); + /** * Creates a new FieldViolation instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-vmmigration/protos/protos.js b/packages/google-cloud-vmmigration/protos/protos.js index 18ace227d710..9fd59cb8908b 100644 --- a/packages/google-cloud-vmmigration/protos/protos.js +++ b/packages/google-cloud-vmmigration/protos/protos.js @@ -59033,6 +59033,7 @@ * @interface ICommonLanguageSettings * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri * @property {Array.|null} [destinations] CommonLanguageSettings destinations + * @property {google.api.ISelectiveGapicGeneration|null} [selectiveGapicGeneration] CommonLanguageSettings selectiveGapicGeneration */ /** @@ -59067,6 +59068,14 @@ */ CommonLanguageSettings.prototype.destinations = $util.emptyArray; + /** + * CommonLanguageSettings selectiveGapicGeneration. + * @member {google.api.ISelectiveGapicGeneration|null|undefined} selectiveGapicGeneration + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.selectiveGapicGeneration = null; + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @function create @@ -59099,6 +59108,8 @@ writer.int32(message.destinations[i]); writer.ldelim(); } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -59150,6 +59161,10 @@ message.destinations.push(reader.int32()); break; } + case 3: { + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -59201,6 +59216,11 @@ break; } } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { + var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration); + if (error) + return "selectiveGapicGeneration." + error; + } return null; }; @@ -59243,6 +59263,11 @@ break; } } + if (object.selectiveGapicGeneration != null) { + if (typeof object.selectiveGapicGeneration !== "object") + throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration); + } return message; }; @@ -59261,8 +59286,10 @@ var object = {}; if (options.arrays || options.defaults) object.destinations = []; - if (options.defaults) + if (options.defaults) { object.referenceDocsUri = ""; + object.selectiveGapicGeneration = null; + } if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) object.referenceDocsUri = message.referenceDocsUri; if (message.destinations && message.destinations.length) { @@ -59270,6 +59297,8 @@ for (var j = 0; j < message.destinations.length; ++j) object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) + object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options); return object; }; @@ -61092,6 +61121,7 @@ * @memberof google.api * @interface IPythonSettings * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common + * @property {google.api.PythonSettings.IExperimentalFeatures|null} [experimentalFeatures] PythonSettings experimentalFeatures */ /** @@ -61117,6 +61147,14 @@ */ PythonSettings.prototype.common = null; + /** + * PythonSettings experimentalFeatures. + * @member {google.api.PythonSettings.IExperimentalFeatures|null|undefined} experimentalFeatures + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.experimentalFeatures = null; + /** * Creates a new PythonSettings instance using the specified properties. * @function create @@ -61143,6 +61181,8 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -61183,6 +61223,10 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -61223,6 +61267,11 @@ if (error) return "common." + error; } + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { + var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures); + if (error) + return "experimentalFeatures." + error; + } return null; }; @@ -61243,6 +61292,11 @@ throw TypeError(".google.api.PythonSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.experimentalFeatures != null) { + if (typeof object.experimentalFeatures !== "object") + throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures); + } return message; }; @@ -61259,10 +61313,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.common = null; + object.experimentalFeatures = null; + } if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) + object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options); return object; }; @@ -61292,6 +61350,258 @@ return typeUrlPrefix + "/google.api.PythonSettings"; }; + PythonSettings.ExperimentalFeatures = (function() { + + /** + * Properties of an ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @interface IExperimentalFeatures + * @property {boolean|null} [restAsyncIoEnabled] ExperimentalFeatures restAsyncIoEnabled + * @property {boolean|null} [protobufPythonicTypesEnabled] ExperimentalFeatures protobufPythonicTypesEnabled + * @property {boolean|null} [unversionedPackageDisabled] ExperimentalFeatures unversionedPackageDisabled + */ + + /** + * Constructs a new ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @classdesc Represents an ExperimentalFeatures. + * @implements IExperimentalFeatures + * @constructor + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + */ + function ExperimentalFeatures(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]]; + } + + /** + * ExperimentalFeatures restAsyncIoEnabled. + * @member {boolean} restAsyncIoEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.restAsyncIoEnabled = false; + + /** + * ExperimentalFeatures protobufPythonicTypesEnabled. + * @member {boolean} protobufPythonicTypesEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.protobufPythonicTypesEnabled = false; + + /** + * ExperimentalFeatures unversionedPackageDisabled. + * @member {boolean} unversionedPackageDisabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.unversionedPackageDisabled = false; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures instance + */ + ExperimentalFeatures.create = function create(properties) { + return new ExperimentalFeatures(properties); + }; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.protobufPythonicTypesEnabled); + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unversionedPackageDisabled); + return writer; + }; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restAsyncIoEnabled = reader.bool(); + break; + } + case 2: { + message.protobufPythonicTypesEnabled = reader.bool(); + break; + } + case 3: { + message.unversionedPackageDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExperimentalFeatures message. + * @function verify + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExperimentalFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + if (typeof message.restAsyncIoEnabled !== "boolean") + return "restAsyncIoEnabled: boolean expected"; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + if (typeof message.protobufPythonicTypesEnabled !== "boolean") + return "protobufPythonicTypesEnabled: boolean expected"; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + if (typeof message.unversionedPackageDisabled !== "boolean") + return "unversionedPackageDisabled: boolean expected"; + return null; + }; + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + */ + ExperimentalFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) + return object; + var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + if (object.restAsyncIoEnabled != null) + message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); + if (object.protobufPythonicTypesEnabled != null) + message.protobufPythonicTypesEnabled = Boolean(object.protobufPythonicTypesEnabled); + if (object.unversionedPackageDisabled != null) + message.unversionedPackageDisabled = Boolean(object.unversionedPackageDisabled); + return message; + }; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.ExperimentalFeatures} message ExperimentalFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExperimentalFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.restAsyncIoEnabled = false; + object.protobufPythonicTypesEnabled = false; + object.unversionedPackageDisabled = false; + } + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + object.restAsyncIoEnabled = message.restAsyncIoEnabled; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + object.unversionedPackageDisabled = message.unversionedPackageDisabled; + return object; + }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @function toJSON + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + * @returns {Object.} JSON object + */ + ExperimentalFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExperimentalFeatures + * @function getTypeUrl + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExperimentalFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings.ExperimentalFeatures"; + }; + + return ExperimentalFeatures; + })(); + return PythonSettings; })(); @@ -62168,6 +62478,7 @@ * @memberof google.api * @interface IGoSettings * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common + * @property {Object.|null} [renamedServices] GoSettings renamedServices */ /** @@ -62179,6 +62490,7 @@ * @param {google.api.IGoSettings=} [properties] Properties to set */ function GoSettings(properties) { + this.renamedServices = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -62193,6 +62505,14 @@ */ GoSettings.prototype.common = null; + /** + * GoSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.renamedServices = $util.emptyObject; + /** * Creates a new GoSettings instance using the specified properties. * @function create @@ -62219,6 +62539,9 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); return writer; }; @@ -62249,7 +62572,7 @@ GoSettings.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) @@ -62259,6 +62582,29 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedServices[key] = value; + break; + } default: reader.skipType(tag & 7); break; @@ -62299,6 +62645,14 @@ if (error) return "common." + error; } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } return null; }; @@ -62319,6 +62673,13 @@ throw TypeError(".google.api.GoSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.GoSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } return message; }; @@ -62335,10 +62696,18 @@ if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) + object.renamedServices = {}; if (options.defaults) object.common = null; if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } return object; }; @@ -62977,29 +63346,274 @@ return values; })(); - /** - * LaunchStage enum. - * @name google.api.LaunchStage - * @enum {number} - * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value - * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value - * @property {number} PRELAUNCH=7 PRELAUNCH value - * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value - * @property {number} ALPHA=2 ALPHA value - * @property {number} BETA=3 BETA value - * @property {number} GA=4 GA value - * @property {number} DEPRECATED=5 DEPRECATED value - */ - api.LaunchStage = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; - values[valuesById[6] = "UNIMPLEMENTED"] = 6; - values[valuesById[7] = "PRELAUNCH"] = 7; - values[valuesById[1] = "EARLY_ACCESS"] = 1; - values[valuesById[2] = "ALPHA"] = 2; - values[valuesById[3] = "BETA"] = 3; - values[valuesById[4] = "GA"] = 4; - values[valuesById[5] = "DEPRECATED"] = 5; + api.SelectiveGapicGeneration = (function() { + + /** + * Properties of a SelectiveGapicGeneration. + * @memberof google.api + * @interface ISelectiveGapicGeneration + * @property {Array.|null} [methods] SelectiveGapicGeneration methods + * @property {boolean|null} [generateOmittedAsInternal] SelectiveGapicGeneration generateOmittedAsInternal + */ + + /** + * Constructs a new SelectiveGapicGeneration. + * @memberof google.api + * @classdesc Represents a SelectiveGapicGeneration. + * @implements ISelectiveGapicGeneration + * @constructor + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + */ + function SelectiveGapicGeneration(properties) { + this.methods = []; + 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]]; + } + + /** + * SelectiveGapicGeneration methods. + * @member {Array.} methods + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.methods = $util.emptyArray; + + /** + * SelectiveGapicGeneration generateOmittedAsInternal. + * @member {boolean} generateOmittedAsInternal + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.generateOmittedAsInternal = false; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @function create + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration instance + */ + SelectiveGapicGeneration.create = function create(properties) { + return new SelectiveGapicGeneration(properties); + }; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methods != null && message.methods.length) + for (var i = 0; i < message.methods.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.generateOmittedAsInternal); + return writer; + }; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @function decode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.methods && message.methods.length)) + message.methods = []; + message.methods.push(reader.string()); + break; + } + case 2: { + message.generateOmittedAsInternal = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectiveGapicGeneration message. + * @function verify + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectiveGapicGeneration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methods != null && message.hasOwnProperty("methods")) { + if (!Array.isArray(message.methods)) + return "methods: array expected"; + for (var i = 0; i < message.methods.length; ++i) + if (!$util.isString(message.methods[i])) + return "methods: string[] expected"; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + if (typeof message.generateOmittedAsInternal !== "boolean") + return "generateOmittedAsInternal: boolean expected"; + return null; + }; + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} object Plain object + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + */ + SelectiveGapicGeneration.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.SelectiveGapicGeneration) + return object; + var message = new $root.google.api.SelectiveGapicGeneration(); + if (object.methods) { + if (!Array.isArray(object.methods)) + throw TypeError(".google.api.SelectiveGapicGeneration.methods: array expected"); + message.methods = []; + for (var i = 0; i < object.methods.length; ++i) + message.methods[i] = String(object.methods[i]); + } + if (object.generateOmittedAsInternal != null) + message.generateOmittedAsInternal = Boolean(object.generateOmittedAsInternal); + return message; + }; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.SelectiveGapicGeneration} message SelectiveGapicGeneration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectiveGapicGeneration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.methods = []; + if (options.defaults) + object.generateOmittedAsInternal = false; + if (message.methods && message.methods.length) { + object.methods = []; + for (var j = 0; j < message.methods.length; ++j) + object.methods[j] = message.methods[j]; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + object.generateOmittedAsInternal = message.generateOmittedAsInternal; + return object; + }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @function toJSON + * @memberof google.api.SelectiveGapicGeneration + * @instance + * @returns {Object.} JSON object + */ + SelectiveGapicGeneration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @function getTypeUrl + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectiveGapicGeneration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.SelectiveGapicGeneration"; + }; + + return SelectiveGapicGeneration; + })(); + + /** + * LaunchStage enum. + * @name google.api.LaunchStage + * @enum {number} + * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value + * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value + * @property {number} PRELAUNCH=7 PRELAUNCH value + * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + */ + api.LaunchStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; + values[valuesById[6] = "UNIMPLEMENTED"] = 6; + values[valuesById[7] = "PRELAUNCH"] = 7; + values[valuesById[1] = "EARLY_ACCESS"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; return values; })(); @@ -63038,6 +63652,7 @@ * @memberof google.api * @interface IFieldInfo * @property {google.api.FieldInfo.Format|null} [format] FieldInfo format + * @property {Array.|null} [referencedTypes] FieldInfo referencedTypes */ /** @@ -63049,6 +63664,7 @@ * @param {google.api.IFieldInfo=} [properties] Properties to set */ function FieldInfo(properties) { + this.referencedTypes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -63063,6 +63679,14 @@ */ FieldInfo.prototype.format = 0; + /** + * FieldInfo referencedTypes. + * @member {Array.} referencedTypes + * @memberof google.api.FieldInfo + * @instance + */ + FieldInfo.prototype.referencedTypes = $util.emptyArray; + /** * Creates a new FieldInfo instance using the specified properties. * @function create @@ -63089,6 +63713,9 @@ writer = $Writer.create(); if (message.format != null && Object.hasOwnProperty.call(message, "format")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.format); + if (message.referencedTypes != null && message.referencedTypes.length) + for (var i = 0; i < message.referencedTypes.length; ++i) + $root.google.api.TypeReference.encode(message.referencedTypes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -63129,6 +63756,12 @@ message.format = reader.int32(); break; } + case 2: { + if (!(message.referencedTypes && message.referencedTypes.length)) + message.referencedTypes = []; + message.referencedTypes.push($root.google.api.TypeReference.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -63175,6 +63808,15 @@ case 4: break; } + if (message.referencedTypes != null && message.hasOwnProperty("referencedTypes")) { + if (!Array.isArray(message.referencedTypes)) + return "referencedTypes: array expected"; + for (var i = 0; i < message.referencedTypes.length; ++i) { + var error = $root.google.api.TypeReference.verify(message.referencedTypes[i]); + if (error) + return "referencedTypes." + error; + } + } return null; }; @@ -63218,6 +63860,16 @@ message.format = 4; break; } + if (object.referencedTypes) { + if (!Array.isArray(object.referencedTypes)) + throw TypeError(".google.api.FieldInfo.referencedTypes: array expected"); + message.referencedTypes = []; + for (var i = 0; i < object.referencedTypes.length; ++i) { + if (typeof object.referencedTypes[i] !== "object") + throw TypeError(".google.api.FieldInfo.referencedTypes: object expected"); + message.referencedTypes[i] = $root.google.api.TypeReference.fromObject(object.referencedTypes[i]); + } + } return message; }; @@ -63234,10 +63886,17 @@ if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.referencedTypes = []; if (options.defaults) object.format = options.enums === String ? "FORMAT_UNSPECIFIED" : 0; if (message.format != null && message.hasOwnProperty("format")) object.format = options.enums === String ? $root.google.api.FieldInfo.Format[message.format] === undefined ? message.format : $root.google.api.FieldInfo.Format[message.format] : message.format; + if (message.referencedTypes && message.referencedTypes.length) { + object.referencedTypes = []; + for (var j = 0; j < message.referencedTypes.length; ++j) + object.referencedTypes[j] = $root.google.api.TypeReference.toObject(message.referencedTypes[j], options); + } return object; }; @@ -63290,32 +63949,24 @@ return FieldInfo; })(); - api.ResourceDescriptor = (function() { + api.TypeReference = (function() { /** - * Properties of a ResourceDescriptor. + * Properties of a TypeReference. * @memberof google.api - * @interface IResourceDescriptor - * @property {string|null} [type] ResourceDescriptor type - * @property {Array.|null} [pattern] ResourceDescriptor pattern - * @property {string|null} [nameField] ResourceDescriptor nameField - * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history - * @property {string|null} [plural] ResourceDescriptor plural - * @property {string|null} [singular] ResourceDescriptor singular - * @property {Array.|null} [style] ResourceDescriptor style + * @interface ITypeReference + * @property {string|null} [typeName] TypeReference typeName */ /** - * Constructs a new ResourceDescriptor. + * Constructs a new TypeReference. * @memberof google.api - * @classdesc Represents a ResourceDescriptor. - * @implements IResourceDescriptor + * @classdesc Represents a TypeReference. + * @implements ITypeReference * @constructor - * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @param {google.api.ITypeReference=} [properties] Properties to set */ - function ResourceDescriptor(properties) { - this.pattern = []; - this.style = []; + function TypeReference(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -63323,48 +63974,261 @@ } /** - * ResourceDescriptor type. - * @member {string} type - * @memberof google.api.ResourceDescriptor + * TypeReference typeName. + * @member {string} typeName + * @memberof google.api.TypeReference * @instance */ - ResourceDescriptor.prototype.type = ""; + TypeReference.prototype.typeName = ""; /** - * ResourceDescriptor pattern. - * @member {Array.} pattern - * @memberof google.api.ResourceDescriptor - * @instance + * Creates a new TypeReference instance using the specified properties. + * @function create + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference=} [properties] Properties to set + * @returns {google.api.TypeReference} TypeReference instance */ - ResourceDescriptor.prototype.pattern = $util.emptyArray; + TypeReference.create = function create(properties) { + return new TypeReference(properties); + }; /** - * ResourceDescriptor nameField. - * @member {string} nameField - * @memberof google.api.ResourceDescriptor - * @instance + * Encodes the specified TypeReference message. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @function encode + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference} message TypeReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - ResourceDescriptor.prototype.nameField = ""; + TypeReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.typeName); + return writer; + }; /** - * ResourceDescriptor history. - * @member {google.api.ResourceDescriptor.History} history - * @memberof google.api.ResourceDescriptor - * @instance + * Encodes the specified TypeReference message, length delimited. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference} message TypeReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - ResourceDescriptor.prototype.history = 0; + TypeReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * ResourceDescriptor plural. - * @member {string} plural - * @memberof google.api.ResourceDescriptor - * @instance + * Decodes a TypeReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.TypeReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.TypeReference} TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceDescriptor.prototype.plural = ""; - - /** - * ResourceDescriptor singular. - * @member {string} singular + TypeReference.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.TypeReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.typeName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TypeReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.TypeReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.TypeReference} TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TypeReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TypeReference message. + * @function verify + * @memberof google.api.TypeReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TypeReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.typeName != null && message.hasOwnProperty("typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + return null; + }; + + /** + * Creates a TypeReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.TypeReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.TypeReference} TypeReference + */ + TypeReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.TypeReference) + return object; + var message = new $root.google.api.TypeReference(); + if (object.typeName != null) + message.typeName = String(object.typeName); + return message; + }; + + /** + * Creates a plain object from a TypeReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.TypeReference + * @static + * @param {google.api.TypeReference} message TypeReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TypeReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.typeName = ""; + if (message.typeName != null && message.hasOwnProperty("typeName")) + object.typeName = message.typeName; + return object; + }; + + /** + * Converts this TypeReference to JSON. + * @function toJSON + * @memberof google.api.TypeReference + * @instance + * @returns {Object.} JSON object + */ + TypeReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TypeReference + * @function getTypeUrl + * @memberof google.api.TypeReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TypeReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.TypeReference"; + }; + + return TypeReference; + })(); + + api.ResourceDescriptor = (function() { + + /** + * Properties of a ResourceDescriptor. + * @memberof google.api + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style + */ + + /** + * Constructs a new ResourceDescriptor. + * @memberof google.api + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor + * @constructor + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + */ + function ResourceDescriptor(properties) { + this.pattern = []; + this.style = []; + 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]]; + } + + /** + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.type = ""; + + /** + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.pattern = $util.emptyArray; + + /** + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.nameField = ""; + + /** + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.history = 0; + + /** + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.plural = ""; + + /** + * ResourceDescriptor singular. + * @member {string} singular * @memberof google.api.ResourceDescriptor * @instance */ @@ -64221,6 +65085,7 @@ * @name google.protobuf.Edition * @enum {number} * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_LEGACY=900 EDITION_LEGACY value * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value * @property {number} EDITION_2023=1000 EDITION_2023 value @@ -64235,6 +65100,7 @@ protobuf.Edition = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[900] = "EDITION_LEGACY"] = 900; values[valuesById[998] = "EDITION_PROTO2"] = 998; values[valuesById[999] = "EDITION_PROTO3"] = 999; values[valuesById[1000] = "EDITION_2023"] = 1000; @@ -64259,6 +65125,7 @@ * @property {Array.|null} [dependency] FileDescriptorProto dependency * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [optionDependency] FileDescriptorProto optionDependency * @property {Array.|null} [messageType] FileDescriptorProto messageType * @property {Array.|null} [enumType] FileDescriptorProto enumType * @property {Array.|null} [service] FileDescriptorProto service @@ -64281,6 +65148,7 @@ this.dependency = []; this.publicDependency = []; this.weakDependency = []; + this.optionDependency = []; this.messageType = []; this.enumType = []; this.service = []; @@ -64331,6 +65199,14 @@ */ FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + /** + * FileDescriptorProto optionDependency. + * @member {Array.} optionDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.optionDependency = $util.emptyArray; + /** * FileDescriptorProto messageType. * @member {Array.} messageType @@ -64452,6 +65328,9 @@ writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + if (message.optionDependency != null && message.optionDependency.length) + for (var i = 0; i < message.optionDependency.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.optionDependency[i]); return writer; }; @@ -64524,6 +65403,12 @@ message.weakDependency.push(reader.int32()); break; } + case 15: { + if (!(message.optionDependency && message.optionDependency.length)) + message.optionDependency = []; + message.optionDependency.push(reader.string()); + break; + } case 4: { if (!(message.messageType && message.messageType.length)) message.messageType = []; @@ -64626,6 +65511,13 @@ if (!$util.isInteger(message.weakDependency[i])) return "weakDependency: integer[] expected"; } + if (message.optionDependency != null && message.hasOwnProperty("optionDependency")) { + if (!Array.isArray(message.optionDependency)) + return "optionDependency: array expected"; + for (var i = 0; i < message.optionDependency.length; ++i) + if (!$util.isString(message.optionDependency[i])) + return "optionDependency: string[] expected"; + } if (message.messageType != null && message.hasOwnProperty("messageType")) { if (!Array.isArray(message.messageType)) return "messageType: array expected"; @@ -64680,6 +65572,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -64732,6 +65625,13 @@ for (var i = 0; i < object.weakDependency.length; ++i) message.weakDependency[i] = object.weakDependency[i] | 0; } + if (object.optionDependency) { + if (!Array.isArray(object.optionDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.optionDependency: array expected"); + message.optionDependency = []; + for (var i = 0; i < object.optionDependency.length; ++i) + message.optionDependency[i] = String(object.optionDependency[i]); + } if (object.messageType) { if (!Array.isArray(object.messageType)) throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); @@ -64795,6 +65695,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -64860,6 +65764,7 @@ object.extension = []; object.publicDependency = []; object.weakDependency = []; + object.optionDependency = []; } if (options.defaults) { object.name = ""; @@ -64916,6 +65821,11 @@ object.syntax = message.syntax; if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.optionDependency && message.optionDependency.length) { + object.optionDependency = []; + for (var j = 0; j < message.optionDependency.length; ++j) + object.optionDependency[j] = message.optionDependency[j]; + } return object; }; @@ -64964,6 +65874,7 @@ * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options * @property {Array.|null} [reservedRange] DescriptorProto reservedRange * @property {Array.|null} [reservedName] DescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] DescriptorProto visibility */ /** @@ -65069,6 +65980,14 @@ */ DescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * DescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.visibility = 0; + /** * Creates a new DescriptorProto instance using the specified properties. * @function create @@ -65121,6 +66040,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.visibility); return writer; }; @@ -65213,6 +66134,10 @@ message.reservedName.push(reader.string()); break; } + case 11: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -65326,6 +66251,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -65425,6 +66359,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -65454,6 +66408,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -65499,6 +66454,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -67543,6 +68500,7 @@ * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] EnumDescriptorProto visibility */ /** @@ -67603,6 +68561,14 @@ */ EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * EnumDescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.visibility = 0; + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @function create @@ -67640,6 +68606,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.visibility); return writer; }; @@ -67702,6 +68670,10 @@ message.reservedName.push(reader.string()); break; } + case 6: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -67770,6 +68742,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -67819,6 +68800,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -67843,6 +68844,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -67863,6 +68865,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -70181,6 +71185,7 @@ * @property {Array.|null} [targets] FieldOptions targets * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] FieldOptions featureSupport * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior * @property {google.api.IFieldInfo|null} [".google.api.fieldInfo"] FieldOptions .google.api.fieldInfo @@ -70302,6 +71307,14 @@ */ FieldOptions.prototype.features = null; + /** + * FieldOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.featureSupport = null; + /** * FieldOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -70384,6 +71397,8 @@ $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); if (message.features != null && Object.hasOwnProperty.call(message, "features")) $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -70487,6 +71502,10 @@ message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } + case 22: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -70626,6 +71645,11 @@ if (error) return "features." + error; } + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -70819,6 +71843,11 @@ throw TypeError(".google.protobuf.FieldOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); } + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); @@ -70921,6 +71950,7 @@ object.debugRedact = false; object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; object.features = null; + object.featureSupport = null; object[".google.api.resourceReference"] = null; object[".google.api.fieldInfo"] = null; } @@ -70954,6 +71984,8 @@ } if (message.features != null && message.hasOwnProperty("features")) object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -71150,42 +72182,370 @@ /** * Encodes the specified EditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EditionDefault.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EditionDefault message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EditionDefault.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.EditionDefault(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 3: { + message.edition = reader.int32(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EditionDefault message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EditionDefault.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EditionDefault message. + * @function verify + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EditionDefault.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates an EditionDefault message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + */ + EditionDefault.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.EditionDefault) + return object; + var message = new $root.google.protobuf.FieldOptions.EditionDefault(); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EditionDefault.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + return object; + }; + + /** + * Converts this EditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + * @returns {Object.} JSON object + */ + EditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + }; + + return EditionDefault; + })(); + + FieldOptions.FeatureSupport = (function() { + + /** + * Properties of a FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @interface IFeatureSupport + * @property {google.protobuf.Edition|null} [editionIntroduced] FeatureSupport editionIntroduced + * @property {google.protobuf.Edition|null} [editionDeprecated] FeatureSupport editionDeprecated + * @property {string|null} [deprecationWarning] FeatureSupport deprecationWarning + * @property {google.protobuf.Edition|null} [editionRemoved] FeatureSupport editionRemoved + */ + + /** + * Constructs a new FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents a FeatureSupport. + * @implements IFeatureSupport + * @constructor + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + */ + function FeatureSupport(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]]; + } + + /** + * FeatureSupport editionIntroduced. + * @member {google.protobuf.Edition} editionIntroduced + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionIntroduced = 0; + + /** + * FeatureSupport editionDeprecated. + * @member {google.protobuf.Edition} editionDeprecated + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionDeprecated = 0; + + /** + * FeatureSupport deprecationWarning. + * @member {string} deprecationWarning + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.deprecationWarning = ""; + + /** + * FeatureSupport editionRemoved. + * @member {google.protobuf.Edition} editionRemoved + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionRemoved = 0; + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport instance + */ + FeatureSupport.create = function create(properties) { + return new FeatureSupport(properties); + }; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editionDeprecated); + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.deprecationWarning); + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.editionRemoved); + return writer; + }; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EditionDefault.encodeDelimited = function encodeDelimited(message, writer) { + FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EditionDefault message from the specified reader or buffer. + * Decodes a FeatureSupport message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EditionDefault.decode = function decode(reader, length, error) { + FeatureSupport.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.EditionDefault(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { - case 3: { - message.edition = reader.int32(); + case 1: { + message.editionIntroduced = reader.int32(); break; } case 2: { - message.value = reader.string(); + message.editionDeprecated = reader.int32(); + break; + } + case 3: { + message.deprecationWarning = reader.string(); + break; + } + case 4: { + message.editionRemoved = reader.int32(); break; } default: @@ -71197,37 +72557,77 @@ }; /** - * Decodes an EditionDefault message from the specified reader or buffer, length delimited. + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EditionDefault.decodeDelimited = function decodeDelimited(reader) { + FeatureSupport.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EditionDefault message. + * Verifies a FeatureSupport message. * @function verify - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EditionDefault.verify = function verify(message) { + FeatureSupport.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.edition != null && message.hasOwnProperty("edition")) - switch (message.edition) { + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + switch (message.editionIntroduced) { default: - return "edition: enum value expected"; + return "editionIntroduced: enum value expected"; case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + switch (message.editionDeprecated) { + default: + return "editionDeprecated: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + if (!$util.isString(message.deprecationWarning)) + return "deprecationWarning: string expected"; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + switch (message.editionRemoved) { + default: + return "editionRemoved: enum value expected"; + case 0: + case 900: case 998: case 999: case 1000: @@ -71240,132 +72640,251 @@ case 2147483647: break; } - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; return null; }; /** - * Creates an EditionDefault message from a plain object. Also converts values to their respective internal types. + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport */ - EditionDefault.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldOptions.EditionDefault) + FeatureSupport.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) return object; - var message = new $root.google.protobuf.FieldOptions.EditionDefault(); - switch (object.edition) { + var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + switch (object.editionIntroduced) { default: - if (typeof object.edition === "number") { - message.edition = object.edition; + if (typeof object.editionIntroduced === "number") { + message.editionIntroduced = object.editionIntroduced; break; } break; case "EDITION_UNKNOWN": case 0: - message.edition = 0; + message.editionIntroduced = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionIntroduced = 900; break; case "EDITION_PROTO2": case 998: - message.edition = 998; + message.editionIntroduced = 998; break; case "EDITION_PROTO3": case 999: - message.edition = 999; + message.editionIntroduced = 999; break; case "EDITION_2023": case 1000: - message.edition = 1000; + message.editionIntroduced = 1000; break; case "EDITION_2024": case 1001: - message.edition = 1001; + message.editionIntroduced = 1001; break; case "EDITION_1_TEST_ONLY": case 1: - message.edition = 1; + message.editionIntroduced = 1; break; case "EDITION_2_TEST_ONLY": case 2: - message.edition = 2; + message.editionIntroduced = 2; break; case "EDITION_99997_TEST_ONLY": case 99997: - message.edition = 99997; + message.editionIntroduced = 99997; break; case "EDITION_99998_TEST_ONLY": case 99998: - message.edition = 99998; + message.editionIntroduced = 99998; break; case "EDITION_99999_TEST_ONLY": case 99999: - message.edition = 99999; + message.editionIntroduced = 99999; break; case "EDITION_MAX": case 2147483647: - message.edition = 2147483647; + message.editionIntroduced = 2147483647; + break; + } + switch (object.editionDeprecated) { + default: + if (typeof object.editionDeprecated === "number") { + message.editionDeprecated = object.editionDeprecated; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionDeprecated = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionDeprecated = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionDeprecated = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionDeprecated = 999; + break; + case "EDITION_2023": + case 1000: + message.editionDeprecated = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionDeprecated = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionDeprecated = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionDeprecated = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionDeprecated = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionDeprecated = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionDeprecated = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionDeprecated = 2147483647; + break; + } + if (object.deprecationWarning != null) + message.deprecationWarning = String(object.deprecationWarning); + switch (object.editionRemoved) { + default: + if (typeof object.editionRemoved === "number") { + message.editionRemoved = object.editionRemoved; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionRemoved = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionRemoved = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionRemoved = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionRemoved = 999; + break; + case "EDITION_2023": + case 1000: + message.editionRemoved = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionRemoved = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionRemoved = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionRemoved = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionRemoved = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionRemoved = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionRemoved = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionRemoved = 2147483647; break; } - if (object.value != null) - message.value = String(object.value); return message; }; /** - * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {google.protobuf.FieldOptions.FeatureSupport} message FeatureSupport * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EditionDefault.toObject = function toObject(message, options) { + FeatureSupport.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.value = ""; - object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionDeprecated = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.deprecationWarning = ""; + object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + object.deprecationWarning = message.deprecationWarning; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; return object; }; /** - * Converts this EditionDefault to JSON. + * Converts this FeatureSupport to JSON. * @function toJSON - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @instance * @returns {Object.} JSON object */ - EditionDefault.prototype.toJSON = function toJSON() { + FeatureSupport.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for EditionDefault + * Gets the default type url for FeatureSupport * @function getTypeUrl - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FeatureSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + return typeUrlPrefix + "/google.protobuf.FieldOptions.FeatureSupport"; }; - return EditionDefault; + return FeatureSupport; })(); return FieldOptions; @@ -71960,6 +73479,7 @@ * @property {boolean|null} [deprecated] EnumValueOptions deprecated * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] EnumValueOptions featureSupport * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption */ @@ -72003,6 +73523,14 @@ */ EnumValueOptions.prototype.debugRedact = false; + /** + * EnumValueOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.featureSupport = null; + /** * EnumValueOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -72041,6 +73569,8 @@ $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -72092,6 +73622,10 @@ message.debugRedact = reader.bool(); break; } + case 4: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -72144,6 +73678,11 @@ if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) if (typeof message.debugRedact !== "boolean") return "debugRedact: boolean expected"; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -72177,6 +73716,11 @@ } if (object.debugRedact != null) message.debugRedact = Boolean(object.debugRedact); + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); @@ -72209,6 +73753,7 @@ object.deprecated = false; object.features = null; object.debugRedact = false; + object.featureSupport = null; } if (message.deprecated != null && message.hasOwnProperty("deprecated")) object.deprecated = message.deprecated; @@ -72216,6 +73761,8 @@ object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) object.debugRedact = message.debugRedact; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -73683,6 +75230,8 @@ * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + * @property {google.protobuf.FeatureSet.EnforceNamingStyle|null} [enforceNamingStyle] FeatureSet enforceNamingStyle + * @property {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null} [defaultSymbolVisibility] FeatureSet defaultSymbolVisibility */ /** @@ -73748,6 +75297,22 @@ */ FeatureSet.prototype.jsonFormat = 0; + /** + * FeatureSet enforceNamingStyle. + * @member {google.protobuf.FeatureSet.EnforceNamingStyle} enforceNamingStyle + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enforceNamingStyle = 0; + + /** + * FeatureSet defaultSymbolVisibility. + * @member {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility} defaultSymbolVisibility + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.defaultSymbolVisibility = 0; + /** * Creates a new FeatureSet instance using the specified properties. * @function create @@ -73784,6 +75349,10 @@ writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enforceNamingStyle); + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.defaultSymbolVisibility); return writer; }; @@ -73844,6 +75413,14 @@ message.jsonFormat = reader.int32(); break; } + case 7: { + message.enforceNamingStyle = reader.int32(); + break; + } + case 8: { + message.defaultSymbolVisibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -73934,6 +75511,26 @@ case 2: break; } + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + switch (message.enforceNamingStyle) { + default: + return "enforceNamingStyle: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + switch (message.defaultSymbolVisibility) { + default: + return "defaultSymbolVisibility: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } return null; }; @@ -74040,37 +75637,85 @@ break; } break; - case "MESSAGE_ENCODING_UNKNOWN": + case "MESSAGE_ENCODING_UNKNOWN": + case 0: + message.messageEncoding = 0; + break; + case "LENGTH_PREFIXED": + case 1: + message.messageEncoding = 1; + break; + case "DELIMITED": + case 2: + message.messageEncoding = 2; + break; + } + switch (object.jsonFormat) { + default: + if (typeof object.jsonFormat === "number") { + message.jsonFormat = object.jsonFormat; + break; + } + break; + case "JSON_FORMAT_UNKNOWN": + case 0: + message.jsonFormat = 0; + break; + case "ALLOW": + case 1: + message.jsonFormat = 1; + break; + case "LEGACY_BEST_EFFORT": + case 2: + message.jsonFormat = 2; + break; + } + switch (object.enforceNamingStyle) { + default: + if (typeof object.enforceNamingStyle === "number") { + message.enforceNamingStyle = object.enforceNamingStyle; + break; + } + break; + case "ENFORCE_NAMING_STYLE_UNKNOWN": case 0: - message.messageEncoding = 0; + message.enforceNamingStyle = 0; break; - case "LENGTH_PREFIXED": + case "STYLE2024": case 1: - message.messageEncoding = 1; + message.enforceNamingStyle = 1; break; - case "DELIMITED": + case "STYLE_LEGACY": case 2: - message.messageEncoding = 2; + message.enforceNamingStyle = 2; break; } - switch (object.jsonFormat) { + switch (object.defaultSymbolVisibility) { default: - if (typeof object.jsonFormat === "number") { - message.jsonFormat = object.jsonFormat; + if (typeof object.defaultSymbolVisibility === "number") { + message.defaultSymbolVisibility = object.defaultSymbolVisibility; break; } break; - case "JSON_FORMAT_UNKNOWN": + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": case 0: - message.jsonFormat = 0; + message.defaultSymbolVisibility = 0; break; - case "ALLOW": + case "EXPORT_ALL": case 1: - message.jsonFormat = 1; + message.defaultSymbolVisibility = 1; break; - case "LEGACY_BEST_EFFORT": + case "EXPORT_TOP_LEVEL": case 2: - message.jsonFormat = 2; + message.defaultSymbolVisibility = 2; + break; + case "LOCAL_ALL": + case 3: + message.defaultSymbolVisibility = 3; + break; + case "STRICT": + case 4: + message.defaultSymbolVisibility = 4; break; } return message; @@ -74096,6 +75741,8 @@ object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; + object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; } if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; @@ -74109,6 +75756,10 @@ object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; return object; }; @@ -74236,6 +75887,219 @@ return values; })(); + /** + * EnforceNamingStyle enum. + * @name google.protobuf.FeatureSet.EnforceNamingStyle + * @enum {number} + * @property {number} ENFORCE_NAMING_STYLE_UNKNOWN=0 ENFORCE_NAMING_STYLE_UNKNOWN value + * @property {number} STYLE2024=1 STYLE2024 value + * @property {number} STYLE_LEGACY=2 STYLE_LEGACY value + */ + FeatureSet.EnforceNamingStyle = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENFORCE_NAMING_STYLE_UNKNOWN"] = 0; + values[valuesById[1] = "STYLE2024"] = 1; + values[valuesById[2] = "STYLE_LEGACY"] = 2; + return values; + })(); + + FeatureSet.VisibilityFeature = (function() { + + /** + * Properties of a VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @interface IVisibilityFeature + */ + + /** + * Constructs a new VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @classdesc Represents a VisibilityFeature. + * @implements IVisibilityFeature + * @constructor + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + */ + function VisibilityFeature(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]]; + } + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature instance + */ + VisibilityFeature.create = function create(properties) { + return new VisibilityFeature(properties); + }; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisibilityFeature message. + * @function verify + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisibilityFeature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + */ + VisibilityFeature.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) + return object; + return new $root.google.protobuf.FeatureSet.VisibilityFeature(); + }; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.VisibilityFeature} message VisibilityFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisibilityFeature.toObject = function toObject() { + return {}; + }; + + /** + * Converts this VisibilityFeature to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @instance + * @returns {Object.} JSON object + */ + VisibilityFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VisibilityFeature + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisibilityFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet.VisibilityFeature"; + }; + + /** + * DefaultSymbolVisibility enum. + * @name google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + * @enum {number} + * @property {number} DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN value + * @property {number} EXPORT_ALL=1 EXPORT_ALL value + * @property {number} EXPORT_TOP_LEVEL=2 EXPORT_TOP_LEVEL value + * @property {number} LOCAL_ALL=3 LOCAL_ALL value + * @property {number} STRICT=4 STRICT value + */ + VisibilityFeature.DefaultSymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0; + values[valuesById[1] = "EXPORT_ALL"] = 1; + values[valuesById[2] = "EXPORT_TOP_LEVEL"] = 2; + values[valuesById[3] = "LOCAL_ALL"] = 3; + values[valuesById[4] = "STRICT"] = 4; + return values; + })(); + + return VisibilityFeature; + })(); + return FeatureSet; })(); @@ -74420,6 +76284,7 @@ default: return "minimumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -74437,6 +76302,7 @@ default: return "maximumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -74485,6 +76351,10 @@ case 0: message.minimumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.minimumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.minimumEdition = 998; @@ -74537,6 +76407,10 @@ case 0: message.maximumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.maximumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.maximumEdition = 998; @@ -74645,7 +76519,8 @@ * @memberof google.protobuf.FeatureSetDefaults * @interface IFeatureSetEditionDefault * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition - * @property {google.protobuf.IFeatureSet|null} [features] FeatureSetEditionDefault features + * @property {google.protobuf.IFeatureSet|null} [overridableFeatures] FeatureSetEditionDefault overridableFeatures + * @property {google.protobuf.IFeatureSet|null} [fixedFeatures] FeatureSetEditionDefault fixedFeatures */ /** @@ -74672,12 +76547,20 @@ FeatureSetEditionDefault.prototype.edition = 0; /** - * FeatureSetEditionDefault features. - * @member {google.protobuf.IFeatureSet|null|undefined} features + * FeatureSetEditionDefault overridableFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} overridableFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.overridableFeatures = null; + + /** + * FeatureSetEditionDefault fixedFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} fixedFeatures * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @instance */ - FeatureSetEditionDefault.prototype.features = null; + FeatureSetEditionDefault.prototype.fixedFeatures = null; /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -74703,10 +76586,12 @@ FeatureSetEditionDefault.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -74747,8 +76632,12 @@ message.edition = reader.int32(); break; } - case 2: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + case 4: { + message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 5: { + message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } default: @@ -74791,6 +76680,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -74803,10 +76693,15 @@ case 2147483647: break; } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures); + if (error) + return "overridableFeatures." + error; + } + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures); if (error) - return "features." + error; + return "fixedFeatures." + error; } return null; }; @@ -74834,6 +76729,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -74875,10 +76774,15 @@ message.edition = 2147483647; break; } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + if (object.overridableFeatures != null) { + if (typeof object.overridableFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); + message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures); + } + if (object.fixedFeatures != null) { + if (typeof object.fixedFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); + message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures); } return message; }; @@ -74897,13 +76801,16 @@ options = {}; var object = {}; if (options.defaults) { - object.features = null; object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.overridableFeatures = null; + object.fixedFeatures = null; } - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) + object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options); + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) + object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options); return object; }; @@ -76118,6 +78025,22 @@ return GeneratedCodeInfo; })(); + /** + * SymbolVisibility enum. + * @name google.protobuf.SymbolVisibility + * @enum {number} + * @property {number} VISIBILITY_UNSET=0 VISIBILITY_UNSET value + * @property {number} VISIBILITY_LOCAL=1 VISIBILITY_LOCAL value + * @property {number} VISIBILITY_EXPORT=2 VISIBILITY_EXPORT value + */ + protobuf.SymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VISIBILITY_UNSET"] = 0; + values[valuesById[1] = "VISIBILITY_LOCAL"] = 1; + values[valuesById[2] = "VISIBILITY_EXPORT"] = 2; + return values; + })(); + protobuf.Duration = (function() { /** @@ -80655,6 +82578,12 @@ * @interface IViolation * @property {string|null} [subject] Violation subject * @property {string|null} [description] Violation description + * @property {string|null} [apiService] Violation apiService + * @property {string|null} [quotaMetric] Violation quotaMetric + * @property {string|null} [quotaId] Violation quotaId + * @property {Object.|null} [quotaDimensions] Violation quotaDimensions + * @property {number|Long|null} [quotaValue] Violation quotaValue + * @property {number|Long|null} [futureQuotaValue] Violation futureQuotaValue */ /** @@ -80666,6 +82595,7 @@ * @param {google.rpc.QuotaFailure.IViolation=} [properties] Properties to set */ function Violation(properties) { + this.quotaDimensions = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -80688,6 +82618,63 @@ */ Violation.prototype.description = ""; + /** + * Violation apiService. + * @member {string} apiService + * @memberof google.rpc.QuotaFailure.Violation + * @instance + */ + Violation.prototype.apiService = ""; + + /** + * Violation quotaMetric. + * @member {string} quotaMetric + * @memberof google.rpc.QuotaFailure.Violation + * @instance + */ + Violation.prototype.quotaMetric = ""; + + /** + * Violation quotaId. + * @member {string} quotaId + * @memberof google.rpc.QuotaFailure.Violation + * @instance + */ + Violation.prototype.quotaId = ""; + + /** + * Violation quotaDimensions. + * @member {Object.} quotaDimensions + * @memberof google.rpc.QuotaFailure.Violation + * @instance + */ + Violation.prototype.quotaDimensions = $util.emptyObject; + + /** + * Violation quotaValue. + * @member {number|Long} quotaValue + * @memberof google.rpc.QuotaFailure.Violation + * @instance + */ + Violation.prototype.quotaValue = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Violation futureQuotaValue. + * @member {number|Long|null|undefined} futureQuotaValue + * @memberof google.rpc.QuotaFailure.Violation + * @instance + */ + Violation.prototype.futureQuotaValue = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Violation.prototype, "_futureQuotaValue", { + get: $util.oneOfGetter($oneOfFields = ["futureQuotaValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new Violation instance using the specified properties. * @function create @@ -80716,6 +82703,19 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.subject); if (message.description != null && Object.hasOwnProperty.call(message, "description")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.apiService != null && Object.hasOwnProperty.call(message, "apiService")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.apiService); + if (message.quotaMetric != null && Object.hasOwnProperty.call(message, "quotaMetric")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.quotaMetric); + if (message.quotaId != null && Object.hasOwnProperty.call(message, "quotaId")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.quotaId); + if (message.quotaDimensions != null && Object.hasOwnProperty.call(message, "quotaDimensions")) + for (var keys = Object.keys(message.quotaDimensions), i = 0; i < keys.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.quotaDimensions[keys[i]]).ldelim(); + if (message.quotaValue != null && Object.hasOwnProperty.call(message, "quotaValue")) + writer.uint32(/* id 7, wireType 0 =*/56).int64(message.quotaValue); + if (message.futureQuotaValue != null && Object.hasOwnProperty.call(message, "futureQuotaValue")) + writer.uint32(/* id 8, wireType 0 =*/64).int64(message.futureQuotaValue); return writer; }; @@ -80746,7 +82746,7 @@ Violation.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.QuotaFailure.Violation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.QuotaFailure.Violation(), key, value; while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) @@ -80760,6 +82760,49 @@ message.description = reader.string(); break; } + case 3: { + message.apiService = reader.string(); + break; + } + case 4: { + message.quotaMetric = reader.string(); + break; + } + case 5: { + message.quotaId = reader.string(); + break; + } + case 6: { + if (message.quotaDimensions === $util.emptyObject) + message.quotaDimensions = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.quotaDimensions[key] = value; + break; + } + case 7: { + message.quotaValue = reader.int64(); + break; + } + case 8: { + message.futureQuotaValue = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -80795,12 +82838,38 @@ Violation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.subject != null && message.hasOwnProperty("subject")) if (!$util.isString(message.subject)) return "subject: string expected"; if (message.description != null && message.hasOwnProperty("description")) if (!$util.isString(message.description)) return "description: string expected"; + if (message.apiService != null && message.hasOwnProperty("apiService")) + if (!$util.isString(message.apiService)) + return "apiService: string expected"; + if (message.quotaMetric != null && message.hasOwnProperty("quotaMetric")) + if (!$util.isString(message.quotaMetric)) + return "quotaMetric: string expected"; + if (message.quotaId != null && message.hasOwnProperty("quotaId")) + if (!$util.isString(message.quotaId)) + return "quotaId: string expected"; + if (message.quotaDimensions != null && message.hasOwnProperty("quotaDimensions")) { + if (!$util.isObject(message.quotaDimensions)) + return "quotaDimensions: object expected"; + var key = Object.keys(message.quotaDimensions); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.quotaDimensions[key[i]])) + return "quotaDimensions: string{k:string} expected"; + } + if (message.quotaValue != null && message.hasOwnProperty("quotaValue")) + if (!$util.isInteger(message.quotaValue) && !(message.quotaValue && $util.isInteger(message.quotaValue.low) && $util.isInteger(message.quotaValue.high))) + return "quotaValue: integer|Long expected"; + if (message.futureQuotaValue != null && message.hasOwnProperty("futureQuotaValue")) { + properties._futureQuotaValue = 1; + if (!$util.isInteger(message.futureQuotaValue) && !(message.futureQuotaValue && $util.isInteger(message.futureQuotaValue.low) && $util.isInteger(message.futureQuotaValue.high))) + return "futureQuotaValue: integer|Long expected"; + } return null; }; @@ -80820,6 +82889,37 @@ message.subject = String(object.subject); if (object.description != null) message.description = String(object.description); + if (object.apiService != null) + message.apiService = String(object.apiService); + if (object.quotaMetric != null) + message.quotaMetric = String(object.quotaMetric); + if (object.quotaId != null) + message.quotaId = String(object.quotaId); + if (object.quotaDimensions) { + if (typeof object.quotaDimensions !== "object") + throw TypeError(".google.rpc.QuotaFailure.Violation.quotaDimensions: object expected"); + message.quotaDimensions = {}; + for (var keys = Object.keys(object.quotaDimensions), i = 0; i < keys.length; ++i) + message.quotaDimensions[keys[i]] = String(object.quotaDimensions[keys[i]]); + } + if (object.quotaValue != null) + if ($util.Long) + (message.quotaValue = $util.Long.fromValue(object.quotaValue)).unsigned = false; + else if (typeof object.quotaValue === "string") + message.quotaValue = parseInt(object.quotaValue, 10); + else if (typeof object.quotaValue === "number") + message.quotaValue = object.quotaValue; + else if (typeof object.quotaValue === "object") + message.quotaValue = new $util.LongBits(object.quotaValue.low >>> 0, object.quotaValue.high >>> 0).toNumber(); + if (object.futureQuotaValue != null) + if ($util.Long) + (message.futureQuotaValue = $util.Long.fromValue(object.futureQuotaValue)).unsigned = false; + else if (typeof object.futureQuotaValue === "string") + message.futureQuotaValue = parseInt(object.futureQuotaValue, 10); + else if (typeof object.futureQuotaValue === "number") + message.futureQuotaValue = object.futureQuotaValue; + else if (typeof object.futureQuotaValue === "object") + message.futureQuotaValue = new $util.LongBits(object.futureQuotaValue.low >>> 0, object.futureQuotaValue.high >>> 0).toNumber(); return message; }; @@ -80836,14 +82936,49 @@ if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) + object.quotaDimensions = {}; if (options.defaults) { object.subject = ""; object.description = ""; + object.apiService = ""; + object.quotaMetric = ""; + object.quotaId = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.quotaValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.quotaValue = options.longs === String ? "0" : 0; } if (message.subject != null && message.hasOwnProperty("subject")) object.subject = message.subject; if (message.description != null && message.hasOwnProperty("description")) object.description = message.description; + if (message.apiService != null && message.hasOwnProperty("apiService")) + object.apiService = message.apiService; + if (message.quotaMetric != null && message.hasOwnProperty("quotaMetric")) + object.quotaMetric = message.quotaMetric; + if (message.quotaId != null && message.hasOwnProperty("quotaId")) + object.quotaId = message.quotaId; + var keys2; + if (message.quotaDimensions && (keys2 = Object.keys(message.quotaDimensions)).length) { + object.quotaDimensions = {}; + for (var j = 0; j < keys2.length; ++j) + object.quotaDimensions[keys2[j]] = message.quotaDimensions[keys2[j]]; + } + if (message.quotaValue != null && message.hasOwnProperty("quotaValue")) + if (typeof message.quotaValue === "number") + object.quotaValue = options.longs === String ? String(message.quotaValue) : message.quotaValue; + else + object.quotaValue = options.longs === String ? $util.Long.prototype.toString.call(message.quotaValue) : options.longs === Number ? new $util.LongBits(message.quotaValue.low >>> 0, message.quotaValue.high >>> 0).toNumber() : message.quotaValue; + if (message.futureQuotaValue != null && message.hasOwnProperty("futureQuotaValue")) { + if (typeof message.futureQuotaValue === "number") + object.futureQuotaValue = options.longs === String ? String(message.futureQuotaValue) : message.futureQuotaValue; + else + object.futureQuotaValue = options.longs === String ? $util.Long.prototype.toString.call(message.futureQuotaValue) : options.longs === Number ? new $util.LongBits(message.futureQuotaValue.low >>> 0, message.futureQuotaValue.high >>> 0).toNumber() : message.futureQuotaValue; + if (options.oneofs) + object._futureQuotaValue = "futureQuotaValue"; + } return object; }; @@ -81588,6 +83723,8 @@ * @interface IFieldViolation * @property {string|null} [field] FieldViolation field * @property {string|null} [description] FieldViolation description + * @property {string|null} [reason] FieldViolation reason + * @property {google.rpc.ILocalizedMessage|null} [localizedMessage] FieldViolation localizedMessage */ /** @@ -81621,6 +83758,22 @@ */ FieldViolation.prototype.description = ""; + /** + * FieldViolation reason. + * @member {string} reason + * @memberof google.rpc.BadRequest.FieldViolation + * @instance + */ + FieldViolation.prototype.reason = ""; + + /** + * FieldViolation localizedMessage. + * @member {google.rpc.ILocalizedMessage|null|undefined} localizedMessage + * @memberof google.rpc.BadRequest.FieldViolation + * @instance + */ + FieldViolation.prototype.localizedMessage = null; + /** * Creates a new FieldViolation instance using the specified properties. * @function create @@ -81649,6 +83802,10 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.field); if (message.description != null && Object.hasOwnProperty.call(message, "description")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.reason); + if (message.localizedMessage != null && Object.hasOwnProperty.call(message, "localizedMessage")) + $root.google.rpc.LocalizedMessage.encode(message.localizedMessage, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; @@ -81693,6 +83850,14 @@ message.description = reader.string(); break; } + case 3: { + message.reason = reader.string(); + break; + } + case 4: { + message.localizedMessage = $root.google.rpc.LocalizedMessage.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -81734,6 +83899,14 @@ if (message.description != null && message.hasOwnProperty("description")) if (!$util.isString(message.description)) return "description: string expected"; + if (message.reason != null && message.hasOwnProperty("reason")) + if (!$util.isString(message.reason)) + return "reason: string expected"; + if (message.localizedMessage != null && message.hasOwnProperty("localizedMessage")) { + var error = $root.google.rpc.LocalizedMessage.verify(message.localizedMessage); + if (error) + return "localizedMessage." + error; + } return null; }; @@ -81753,6 +83926,13 @@ message.field = String(object.field); if (object.description != null) message.description = String(object.description); + if (object.reason != null) + message.reason = String(object.reason); + if (object.localizedMessage != null) { + if (typeof object.localizedMessage !== "object") + throw TypeError(".google.rpc.BadRequest.FieldViolation.localizedMessage: object expected"); + message.localizedMessage = $root.google.rpc.LocalizedMessage.fromObject(object.localizedMessage); + } return message; }; @@ -81772,11 +83952,17 @@ if (options.defaults) { object.field = ""; object.description = ""; + object.reason = ""; + object.localizedMessage = null; } if (message.field != null && message.hasOwnProperty("field")) object.field = message.field; if (message.description != null && message.hasOwnProperty("description")) object.description = message.description; + if (message.reason != null && message.hasOwnProperty("reason")) + object.reason = message.reason; + if (message.localizedMessage != null && message.hasOwnProperty("localizedMessage")) + object.localizedMessage = $root.google.rpc.LocalizedMessage.toObject(message.localizedMessage, options); return object; }; diff --git a/packages/google-cloud-vmmigration/protos/protos.json b/packages/google-cloud-vmmigration/protos/protos.json index 242b94e7496f..600ee6ac4fee 100644 --- a/packages/google-cloud-vmmigration/protos/protos.json +++ b/packages/google-cloud-vmmigration/protos/protos.json @@ -7135,8 +7135,7 @@ "java_multiple_files": true, "java_outer_classname": "ResourceProto", "java_package": "com.google.api", - "objc_class_prefix": "GAPI", - "cc_enable_arenas": true + "objc_class_prefix": "GAPI" }, "nested": { "http": { @@ -7260,6 +7259,10 @@ "rule": "repeated", "type": "ClientLibraryDestination", "id": 2 + }, + "selectiveGapicGeneration": { + "type": "SelectiveGapicGeneration", + "id": 3 } } }, @@ -7400,6 +7403,28 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "experimentalFeatures": { + "type": "ExperimentalFeatures", + "id": 2 + } + }, + "nested": { + "ExperimentalFeatures": { + "fields": { + "restAsyncIoEnabled": { + "type": "bool", + "id": 1 + }, + "protobufPythonicTypesEnabled": { + "type": "bool", + "id": 2 + }, + "unversionedPackageDisabled": { + "type": "bool", + "id": 3 + } + } } } }, @@ -7457,6 +7482,11 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 } } }, @@ -7518,6 +7548,19 @@ "PACKAGE_MANAGER": 20 } }, + "SelectiveGapicGeneration": { + "fields": { + "methods": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "generateOmittedAsInternal": { + "type": "bool", + "id": 2 + } + } + }, "LaunchStage": { "values": { "LAUNCH_STAGE_UNSPECIFIED": 0, @@ -7562,6 +7605,11 @@ "format": { "type": "Format", "id": 1 + }, + "referencedTypes": { + "rule": "repeated", + "type": "TypeReference", + "id": 2 } }, "nested": { @@ -7576,6 +7624,14 @@ } } }, + "TypeReference": { + "fields": { + "typeName": { + "type": "string", + "id": 1 + } + } + }, "resourceReference": { "type": "google.api.ResourceReference", "id": 1055, @@ -7674,12 +7730,19 @@ "type": "FileDescriptorProto", "id": 1 } - } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ] }, "Edition": { "edition": "proto2", "values": { "EDITION_UNKNOWN": 0, + "EDITION_LEGACY": 900, "EDITION_PROTO2": 998, "EDITION_PROTO3": 999, "EDITION_2023": 1000, @@ -7718,6 +7781,11 @@ "type": "int32", "id": 11 }, + "optionDependency": { + "rule": "repeated", + "type": "string", + "id": 15 + }, "messageType": { "rule": "repeated", "type": "DescriptorProto", @@ -7806,6 +7874,10 @@ "rule": "repeated", "type": "string", "id": 10 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 11 } }, "nested": { @@ -8031,6 +8103,10 @@ "rule": "repeated", "type": "string", "id": 5 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 6 } }, "nested": { @@ -8081,7 +8157,14 @@ "type": "ServiceOptions", "id": 3 } - } + }, + "reserved": [ + [ + 4, + 4 + ], + "stream" + ] }, "MethodDescriptorProto": { "edition": "proto2", @@ -8245,6 +8328,7 @@ 42, 42 ], + "php_generic_services", [ 38, 38 @@ -8380,7 +8464,8 @@ "type": "bool", "id": 10, "options": { - "default": false + "default": false, + "deprecated": true } }, "debugRedact": { @@ -8408,6 +8493,10 @@ "type": "FeatureSet", "id": 21 }, + "featureSupport": { + "type": "FeatureSupport", + "id": 22 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -8477,6 +8566,26 @@ "id": 2 } } + }, + "FeatureSupport": { + "fields": { + "editionIntroduced": { + "type": "Edition", + "id": 1 + }, + "editionDeprecated": { + "type": "Edition", + "id": 2 + }, + "deprecationWarning": { + "type": "string", + "id": 3 + }, + "editionRemoved": { + "type": "Edition", + "id": 4 + } + } } } }, @@ -8565,6 +8674,10 @@ "default": false } }, + "featureSupport": { + "type": "FieldOptions.FeatureSupport", + "id": 4 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -8707,6 +8820,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_2023", "edition_defaults.value": "EXPLICIT" } @@ -8717,6 +8831,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "OPEN" } @@ -8727,6 +8842,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "PACKED" } @@ -8737,6 +8853,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "VERIFY" } @@ -8747,7 +8864,8 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "EDITION_PROTO2", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_LEGACY", "edition_defaults.value": "LENGTH_PREFIXED" } }, @@ -8757,27 +8875,38 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "ALLOW" } + }, + "enforceNamingStyle": { + "type": "EnforceNamingStyle", + "id": 7, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_METHOD", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "STYLE2024" + } + }, + "defaultSymbolVisibility": { + "type": "VisibilityFeature.DefaultSymbolVisibility", + "id": 8, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "EXPORT_TOP_LEVEL" + } } }, "extensions": [ [ 1000, - 1000 - ], - [ - 1001, - 1001 - ], - [ - 1002, - 1002 - ], - [ - 9990, - 9990 + 9994 ], [ 9995, @@ -8822,7 +8951,13 @@ "UTF8_VALIDATION_UNKNOWN": 0, "VERIFY": 2, "NONE": 3 - } + }, + "reserved": [ + [ + 1, + 1 + ] + ] }, "MessageEncoding": { "values": { @@ -8837,6 +8972,33 @@ "ALLOW": 1, "LEGACY_BEST_EFFORT": 2 } + }, + "EnforceNamingStyle": { + "values": { + "ENFORCE_NAMING_STYLE_UNKNOWN": 0, + "STYLE2024": 1, + "STYLE_LEGACY": 2 + } + }, + "VisibilityFeature": { + "fields": {}, + "reserved": [ + [ + 1, + 536870911 + ] + ], + "nested": { + "DefaultSymbolVisibility": { + "values": { + "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, + "EXPORT_ALL": 1, + "EXPORT_TOP_LEVEL": 2, + "LOCAL_ALL": 3, + "STRICT": 4 + } + } + } } } }, @@ -8864,11 +9026,26 @@ "type": "Edition", "id": 3 }, - "features": { + "overridableFeatures": { "type": "FeatureSet", - "id": 2 + "id": 4 + }, + "fixedFeatures": { + "type": "FeatureSet", + "id": 5 } - } + }, + "reserved": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + "features" + ] } } }, @@ -8881,6 +9058,12 @@ "id": 1 } }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ], "nested": { "Location": { "fields": { @@ -8966,6 +9149,14 @@ } } }, + "SymbolVisibility": { + "edition": "proto2", + "values": { + "VISIBILITY_UNSET": 0, + "VISIBILITY_LOCAL": 1, + "VISIBILITY_EXPORT": 2 + } + }, "Duration": { "fields": { "seconds": { @@ -9024,6 +9215,7 @@ "java_multiple_files": true, "java_outer_classname": "OperationsProto", "java_package": "com.google.longrunning", + "objc_class_prefix": "GLRUN", "php_namespace": "Google\\LongRunning" }, "nested": { @@ -9307,6 +9499,13 @@ }, "nested": { "Violation": { + "oneofs": { + "_futureQuotaValue": { + "oneof": [ + "futureQuotaValue" + ] + } + }, "fields": { "subject": { "type": "string", @@ -9315,6 +9514,34 @@ "description": { "type": "string", "id": 2 + }, + "apiService": { + "type": "string", + "id": 3 + }, + "quotaMetric": { + "type": "string", + "id": 4 + }, + "quotaId": { + "type": "string", + "id": 5 + }, + "quotaDimensions": { + "keyType": "string", + "type": "string", + "id": 6 + }, + "quotaValue": { + "type": "int64", + "id": 7 + }, + "futureQuotaValue": { + "type": "int64", + "id": 8, + "options": { + "proto3_optional": true + } } } } @@ -9365,6 +9592,14 @@ "description": { "type": "string", "id": 2 + }, + "reason": { + "type": "string", + "id": 3 + }, + "localizedMessage": { + "type": "LocalizedMessage", + "id": 4 } } } diff --git a/packages/google-cloud-vmmigration/samples/generated/v1/snippet_metadata_google.cloud.vmmigration.v1.json b/packages/google-cloud-vmmigration/samples/generated/v1/snippet_metadata_google.cloud.vmmigration.v1.json index 27e63de0bbea..4ae7feae674e 100644 --- a/packages/google-cloud-vmmigration/samples/generated/v1/snippet_metadata_google.cloud.vmmigration.v1.json +++ b/packages/google-cloud-vmmigration/samples/generated/v1/snippet_metadata_google.cloud.vmmigration.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-vmmigration", - "version": "4.3.1", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-vmmigration/src/v1/index.ts b/packages/google-cloud-vmmigration/src/v1/index.ts index 96e38d08fde6..4227ac2a4817 100644 --- a/packages/google-cloud-vmmigration/src/v1/index.ts +++ b/packages/google-cloud-vmmigration/src/v1/index.ts @@ -16,4 +16,4 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {VmMigrationClient} from './vm_migration_client'; +export { VmMigrationClient } from './vm_migration_client'; diff --git a/packages/google-cloud-vmmigration/src/v1/vm_migration_client.ts b/packages/google-cloud-vmmigration/src/v1/vm_migration_client.ts index ebf9d167e467..3471b9fde454 100644 --- a/packages/google-cloud-vmmigration/src/v1/vm_migration_client.ts +++ b/packages/google-cloud-vmmigration/src/v1/vm_migration_client.ts @@ -18,11 +18,22 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +55,7 @@ export class VmMigrationClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('vmmigration'); @@ -57,11 +68,11 @@ export class VmMigrationClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - vmMigrationStub?: Promise<{[name: string]: Function}>; + vmMigrationStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of VmMigrationClient. @@ -102,21 +113,42 @@ export class VmMigrationClient { * const client = new VmMigrationClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof VmMigrationClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'vmmigration.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -141,7 +173,7 @@ export class VmMigrationClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,15 +187,11 @@ export class VmMigrationClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -185,52 +213,52 @@ export class VmMigrationClient { // Create useful helper objects for these. this.pathTemplates = { cloneJobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cloneJobs/{clone_job}' + 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cloneJobs/{clone_job}', ), cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}', ), cutoverJobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cutoverJobs/{cutover_job}' + 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/cutoverJobs/{cutover_job}', ), datacenterConnectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}/datacenterConnectors/{datacenter_connector}' + 'projects/{project}/locations/{location}/sources/{source}/datacenterConnectors/{datacenter_connector}', ), diskMigrationJobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}/diskMigrationJobs/{disk_migration_job}' + 'projects/{project}/locations/{location}/sources/{source}/diskMigrationJobs/{disk_migration_job}', ), groupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/groups/{group}' + 'projects/{project}/locations/{location}/groups/{group}', ), imageImportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/imageImports/{job}' + 'projects/{project}/locations/{location}/imageImports/{job}', ), imageImportJobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/imageImports/{job}/imageImportJobs/{result}' + 'projects/{project}/locations/{location}/imageImports/{job}/imageImportJobs/{result}', ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), migratingVmPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}' + 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), replicationCyclePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/replicationCycles/{replication_cycle}' + 'projects/{project}/locations/{location}/sources/{source}/migratingVms/{migrating_vm}/replicationCycles/{replication_cycle}', ), serviceAccountPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/serviceAccounts/{service_account}' + 'projects/{project}/serviceAccounts/{service_account}', ), sourcePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}' + 'projects/{project}/locations/{location}/sources/{source}', ), targetProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/targetProjects/{target_project}' + 'projects/{project}/locations/{location}/targetProjects/{target_project}', ), utilizationReportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sources/{source}/utilizationReports/{utilization_report}' + 'projects/{project}/locations/{location}/sources/{source}/utilizationReports/{utilization_report}', ), }; @@ -238,32 +266,71 @@ export class VmMigrationClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listSources: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sources'), - fetchStorageInventory: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resources'), - listUtilizationReports: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'utilizationReports'), - listDatacenterConnectors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'datacenterConnectors'), - listMigratingVms: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'migratingVms'), - listCloneJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'cloneJobs'), - listCutoverJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'cutoverJobs'), - listGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'groups'), - listTargetProjects: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'targetProjects'), - listReplicationCycles: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'replicationCycles'), - listImageImports: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'imageImports'), - listImageImportJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'imageImportJobs'), - listDiskMigrationJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'diskMigrationJobs') + listSources: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'sources', + ), + fetchStorageInventory: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'resources', + ), + listUtilizationReports: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'utilizationReports', + ), + listDatacenterConnectors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'datacenterConnectors', + ), + listMigratingVms: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'migratingVms', + ), + listCloneJobs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'cloneJobs', + ), + listCutoverJobs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'cutoverJobs', + ), + listGroups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'groups', + ), + listTargetProjects: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'targetProjects', + ), + listReplicationCycles: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'replicationCycles', + ), + listImageImports: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'imageImports', + ), + listImageImportJobs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'imageImportJobs', + ), + listDiskMigrationJobs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'diskMigrationJobs', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -272,309 +339,480 @@ export class VmMigrationClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createSourceResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.Source') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.Source', + ) as gax.protobuf.Type; const createSourceMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateSourceResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.Source') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.Source', + ) as gax.protobuf.Type; const updateSourceMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteSourceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteSourceMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const createUtilizationReportResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.UtilizationReport') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.UtilizationReport', + ) as gax.protobuf.Type; const createUtilizationReportMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteUtilizationReportResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteUtilizationReportMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const createDatacenterConnectorResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.DatacenterConnector') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.DatacenterConnector', + ) as gax.protobuf.Type; const createDatacenterConnectorMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteDatacenterConnectorResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteDatacenterConnectorMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const upgradeApplianceResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.UpgradeApplianceResponse') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.UpgradeApplianceResponse', + ) as gax.protobuf.Type; const upgradeApplianceMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const createMigratingVmResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.MigratingVm') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.MigratingVm', + ) as gax.protobuf.Type; const createMigratingVmMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateMigratingVmResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.MigratingVm') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.MigratingVm', + ) as gax.protobuf.Type; const updateMigratingVmMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteMigratingVmResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteMigratingVmMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const startMigrationResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.StartMigrationResponse') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.StartMigrationResponse', + ) as gax.protobuf.Type; const startMigrationMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const resumeMigrationResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.ResumeMigrationResponse') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.ResumeMigrationResponse', + ) as gax.protobuf.Type; const resumeMigrationMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const pauseMigrationResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.PauseMigrationResponse') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.PauseMigrationResponse', + ) as gax.protobuf.Type; const pauseMigrationMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const finalizeMigrationResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.FinalizeMigrationResponse') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.FinalizeMigrationResponse', + ) as gax.protobuf.Type; const finalizeMigrationMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const extendMigrationResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.ExtendMigrationResponse') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.ExtendMigrationResponse', + ) as gax.protobuf.Type; const extendMigrationMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const createCloneJobResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.CloneJob') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.CloneJob', + ) as gax.protobuf.Type; const createCloneJobMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const cancelCloneJobResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.CancelCloneJobResponse') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.CancelCloneJobResponse', + ) as gax.protobuf.Type; const cancelCloneJobMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const createCutoverJobResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.CutoverJob') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.CutoverJob', + ) as gax.protobuf.Type; const createCutoverJobMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const cancelCutoverJobResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.CancelCutoverJobResponse') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.CancelCutoverJobResponse', + ) as gax.protobuf.Type; const cancelCutoverJobMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const createGroupResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.Group') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.Group', + ) as gax.protobuf.Type; const createGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateGroupResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.Group') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.Group', + ) as gax.protobuf.Type; const updateGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteGroupResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteGroupMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const addGroupMigrationResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.AddGroupMigrationResponse') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.AddGroupMigrationResponse', + ) as gax.protobuf.Type; const addGroupMigrationMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const removeGroupMigrationResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.RemoveGroupMigrationResponse') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.RemoveGroupMigrationResponse', + ) as gax.protobuf.Type; const removeGroupMigrationMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const createTargetProjectResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.TargetProject') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.TargetProject', + ) as gax.protobuf.Type; const createTargetProjectMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateTargetProjectResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.TargetProject') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.TargetProject', + ) as gax.protobuf.Type; const updateTargetProjectMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteTargetProjectResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteTargetProjectMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const createImageImportResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.ImageImport') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.ImageImport', + ) as gax.protobuf.Type; const createImageImportMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteImageImportResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteImageImportMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const cancelImageImportJobResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.CancelImageImportJobResponse') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.CancelImageImportJobResponse', + ) as gax.protobuf.Type; const cancelImageImportJobMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const createDiskMigrationJobResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.DiskMigrationJob') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.DiskMigrationJob', + ) as gax.protobuf.Type; const createDiskMigrationJobMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateDiskMigrationJobResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.DiskMigrationJob') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.DiskMigrationJob', + ) as gax.protobuf.Type; const updateDiskMigrationJobMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteDiskMigrationJobResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteDiskMigrationJobMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const runDiskMigrationJobResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.RunDiskMigrationJobResponse') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.RunDiskMigrationJobResponse', + ) as gax.protobuf.Type; const runDiskMigrationJobMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; const cancelDiskMigrationJobResponse = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.CancelDiskMigrationJobResponse') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.CancelDiskMigrationJobResponse', + ) as gax.protobuf.Type; const cancelDiskMigrationJobMetadata = protoFilesRoot.lookup( - '.google.cloud.vmmigration.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmmigration.v1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createSource: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createSourceResponse.decode.bind(createSourceResponse), - createSourceMetadata.decode.bind(createSourceMetadata)), + createSourceMetadata.decode.bind(createSourceMetadata), + ), updateSource: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateSourceResponse.decode.bind(updateSourceResponse), - updateSourceMetadata.decode.bind(updateSourceMetadata)), + updateSourceMetadata.decode.bind(updateSourceMetadata), + ), deleteSource: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteSourceResponse.decode.bind(deleteSourceResponse), - deleteSourceMetadata.decode.bind(deleteSourceMetadata)), + deleteSourceMetadata.decode.bind(deleteSourceMetadata), + ), createUtilizationReport: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createUtilizationReportResponse.decode.bind(createUtilizationReportResponse), - createUtilizationReportMetadata.decode.bind(createUtilizationReportMetadata)), + createUtilizationReportResponse.decode.bind( + createUtilizationReportResponse, + ), + createUtilizationReportMetadata.decode.bind( + createUtilizationReportMetadata, + ), + ), deleteUtilizationReport: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteUtilizationReportResponse.decode.bind(deleteUtilizationReportResponse), - deleteUtilizationReportMetadata.decode.bind(deleteUtilizationReportMetadata)), + deleteUtilizationReportResponse.decode.bind( + deleteUtilizationReportResponse, + ), + deleteUtilizationReportMetadata.decode.bind( + deleteUtilizationReportMetadata, + ), + ), createDatacenterConnector: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createDatacenterConnectorResponse.decode.bind(createDatacenterConnectorResponse), - createDatacenterConnectorMetadata.decode.bind(createDatacenterConnectorMetadata)), + createDatacenterConnectorResponse.decode.bind( + createDatacenterConnectorResponse, + ), + createDatacenterConnectorMetadata.decode.bind( + createDatacenterConnectorMetadata, + ), + ), deleteDatacenterConnector: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteDatacenterConnectorResponse.decode.bind(deleteDatacenterConnectorResponse), - deleteDatacenterConnectorMetadata.decode.bind(deleteDatacenterConnectorMetadata)), + deleteDatacenterConnectorResponse.decode.bind( + deleteDatacenterConnectorResponse, + ), + deleteDatacenterConnectorMetadata.decode.bind( + deleteDatacenterConnectorMetadata, + ), + ), upgradeAppliance: new this._gaxModule.LongrunningDescriptor( this.operationsClient, upgradeApplianceResponse.decode.bind(upgradeApplianceResponse), - upgradeApplianceMetadata.decode.bind(upgradeApplianceMetadata)), + upgradeApplianceMetadata.decode.bind(upgradeApplianceMetadata), + ), createMigratingVm: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createMigratingVmResponse.decode.bind(createMigratingVmResponse), - createMigratingVmMetadata.decode.bind(createMigratingVmMetadata)), + createMigratingVmMetadata.decode.bind(createMigratingVmMetadata), + ), updateMigratingVm: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateMigratingVmResponse.decode.bind(updateMigratingVmResponse), - updateMigratingVmMetadata.decode.bind(updateMigratingVmMetadata)), + updateMigratingVmMetadata.decode.bind(updateMigratingVmMetadata), + ), deleteMigratingVm: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteMigratingVmResponse.decode.bind(deleteMigratingVmResponse), - deleteMigratingVmMetadata.decode.bind(deleteMigratingVmMetadata)), + deleteMigratingVmMetadata.decode.bind(deleteMigratingVmMetadata), + ), startMigration: new this._gaxModule.LongrunningDescriptor( this.operationsClient, startMigrationResponse.decode.bind(startMigrationResponse), - startMigrationMetadata.decode.bind(startMigrationMetadata)), + startMigrationMetadata.decode.bind(startMigrationMetadata), + ), resumeMigration: new this._gaxModule.LongrunningDescriptor( this.operationsClient, resumeMigrationResponse.decode.bind(resumeMigrationResponse), - resumeMigrationMetadata.decode.bind(resumeMigrationMetadata)), + resumeMigrationMetadata.decode.bind(resumeMigrationMetadata), + ), pauseMigration: new this._gaxModule.LongrunningDescriptor( this.operationsClient, pauseMigrationResponse.decode.bind(pauseMigrationResponse), - pauseMigrationMetadata.decode.bind(pauseMigrationMetadata)), + pauseMigrationMetadata.decode.bind(pauseMigrationMetadata), + ), finalizeMigration: new this._gaxModule.LongrunningDescriptor( this.operationsClient, finalizeMigrationResponse.decode.bind(finalizeMigrationResponse), - finalizeMigrationMetadata.decode.bind(finalizeMigrationMetadata)), + finalizeMigrationMetadata.decode.bind(finalizeMigrationMetadata), + ), extendMigration: new this._gaxModule.LongrunningDescriptor( this.operationsClient, extendMigrationResponse.decode.bind(extendMigrationResponse), - extendMigrationMetadata.decode.bind(extendMigrationMetadata)), + extendMigrationMetadata.decode.bind(extendMigrationMetadata), + ), createCloneJob: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createCloneJobResponse.decode.bind(createCloneJobResponse), - createCloneJobMetadata.decode.bind(createCloneJobMetadata)), + createCloneJobMetadata.decode.bind(createCloneJobMetadata), + ), cancelCloneJob: new this._gaxModule.LongrunningDescriptor( this.operationsClient, cancelCloneJobResponse.decode.bind(cancelCloneJobResponse), - cancelCloneJobMetadata.decode.bind(cancelCloneJobMetadata)), + cancelCloneJobMetadata.decode.bind(cancelCloneJobMetadata), + ), createCutoverJob: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createCutoverJobResponse.decode.bind(createCutoverJobResponse), - createCutoverJobMetadata.decode.bind(createCutoverJobMetadata)), + createCutoverJobMetadata.decode.bind(createCutoverJobMetadata), + ), cancelCutoverJob: new this._gaxModule.LongrunningDescriptor( this.operationsClient, cancelCutoverJobResponse.decode.bind(cancelCutoverJobResponse), - cancelCutoverJobMetadata.decode.bind(cancelCutoverJobMetadata)), + cancelCutoverJobMetadata.decode.bind(cancelCutoverJobMetadata), + ), createGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createGroupResponse.decode.bind(createGroupResponse), - createGroupMetadata.decode.bind(createGroupMetadata)), + createGroupMetadata.decode.bind(createGroupMetadata), + ), updateGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateGroupResponse.decode.bind(updateGroupResponse), - updateGroupMetadata.decode.bind(updateGroupMetadata)), + updateGroupMetadata.decode.bind(updateGroupMetadata), + ), deleteGroup: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteGroupResponse.decode.bind(deleteGroupResponse), - deleteGroupMetadata.decode.bind(deleteGroupMetadata)), + deleteGroupMetadata.decode.bind(deleteGroupMetadata), + ), addGroupMigration: new this._gaxModule.LongrunningDescriptor( this.operationsClient, addGroupMigrationResponse.decode.bind(addGroupMigrationResponse), - addGroupMigrationMetadata.decode.bind(addGroupMigrationMetadata)), + addGroupMigrationMetadata.decode.bind(addGroupMigrationMetadata), + ), removeGroupMigration: new this._gaxModule.LongrunningDescriptor( this.operationsClient, removeGroupMigrationResponse.decode.bind(removeGroupMigrationResponse), - removeGroupMigrationMetadata.decode.bind(removeGroupMigrationMetadata)), + removeGroupMigrationMetadata.decode.bind(removeGroupMigrationMetadata), + ), createTargetProject: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createTargetProjectResponse.decode.bind(createTargetProjectResponse), - createTargetProjectMetadata.decode.bind(createTargetProjectMetadata)), + createTargetProjectMetadata.decode.bind(createTargetProjectMetadata), + ), updateTargetProject: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateTargetProjectResponse.decode.bind(updateTargetProjectResponse), - updateTargetProjectMetadata.decode.bind(updateTargetProjectMetadata)), + updateTargetProjectMetadata.decode.bind(updateTargetProjectMetadata), + ), deleteTargetProject: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteTargetProjectResponse.decode.bind(deleteTargetProjectResponse), - deleteTargetProjectMetadata.decode.bind(deleteTargetProjectMetadata)), + deleteTargetProjectMetadata.decode.bind(deleteTargetProjectMetadata), + ), createImageImport: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createImageImportResponse.decode.bind(createImageImportResponse), - createImageImportMetadata.decode.bind(createImageImportMetadata)), + createImageImportMetadata.decode.bind(createImageImportMetadata), + ), deleteImageImport: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteImageImportResponse.decode.bind(deleteImageImportResponse), - deleteImageImportMetadata.decode.bind(deleteImageImportMetadata)), + deleteImageImportMetadata.decode.bind(deleteImageImportMetadata), + ), cancelImageImportJob: new this._gaxModule.LongrunningDescriptor( this.operationsClient, cancelImageImportJobResponse.decode.bind(cancelImageImportJobResponse), - cancelImageImportJobMetadata.decode.bind(cancelImageImportJobMetadata)), + cancelImageImportJobMetadata.decode.bind(cancelImageImportJobMetadata), + ), createDiskMigrationJob: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createDiskMigrationJobResponse.decode.bind(createDiskMigrationJobResponse), - createDiskMigrationJobMetadata.decode.bind(createDiskMigrationJobMetadata)), + createDiskMigrationJobResponse.decode.bind( + createDiskMigrationJobResponse, + ), + createDiskMigrationJobMetadata.decode.bind( + createDiskMigrationJobMetadata, + ), + ), updateDiskMigrationJob: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateDiskMigrationJobResponse.decode.bind(updateDiskMigrationJobResponse), - updateDiskMigrationJobMetadata.decode.bind(updateDiskMigrationJobMetadata)), + updateDiskMigrationJobResponse.decode.bind( + updateDiskMigrationJobResponse, + ), + updateDiskMigrationJobMetadata.decode.bind( + updateDiskMigrationJobMetadata, + ), + ), deleteDiskMigrationJob: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteDiskMigrationJobResponse.decode.bind(deleteDiskMigrationJobResponse), - deleteDiskMigrationJobMetadata.decode.bind(deleteDiskMigrationJobMetadata)), + deleteDiskMigrationJobResponse.decode.bind( + deleteDiskMigrationJobResponse, + ), + deleteDiskMigrationJobMetadata.decode.bind( + deleteDiskMigrationJobMetadata, + ), + ), runDiskMigrationJob: new this._gaxModule.LongrunningDescriptor( this.operationsClient, runDiskMigrationJobResponse.decode.bind(runDiskMigrationJobResponse), - runDiskMigrationJobMetadata.decode.bind(runDiskMigrationJobMetadata)), + runDiskMigrationJobMetadata.decode.bind(runDiskMigrationJobMetadata), + ), cancelDiskMigrationJob: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - cancelDiskMigrationJobResponse.decode.bind(cancelDiskMigrationJobResponse), - cancelDiskMigrationJobMetadata.decode.bind(cancelDiskMigrationJobMetadata)) + cancelDiskMigrationJobResponse.decode.bind( + cancelDiskMigrationJobResponse, + ), + cancelDiskMigrationJobMetadata.decode.bind( + cancelDiskMigrationJobMetadata, + ), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.vmmigration.v1.VmMigration', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.vmmigration.v1.VmMigration', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -605,28 +843,96 @@ export class VmMigrationClient { // Put together the "service stub" for // google.cloud.vmmigration.v1.VmMigration. this.vmMigrationStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.vmmigration.v1.VmMigration') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.vmmigration.v1.VmMigration', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.vmmigration.v1.VmMigration, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const vmMigrationStubMethods = - ['listSources', 'getSource', 'createSource', 'updateSource', 'deleteSource', 'fetchInventory', 'fetchStorageInventory', 'listUtilizationReports', 'getUtilizationReport', 'createUtilizationReport', 'deleteUtilizationReport', 'listDatacenterConnectors', 'getDatacenterConnector', 'createDatacenterConnector', 'deleteDatacenterConnector', 'upgradeAppliance', 'createMigratingVm', 'listMigratingVms', 'getMigratingVm', 'updateMigratingVm', 'deleteMigratingVm', 'startMigration', 'resumeMigration', 'pauseMigration', 'finalizeMigration', 'extendMigration', 'createCloneJob', 'cancelCloneJob', 'listCloneJobs', 'getCloneJob', 'createCutoverJob', 'cancelCutoverJob', 'listCutoverJobs', 'getCutoverJob', 'listGroups', 'getGroup', 'createGroup', 'updateGroup', 'deleteGroup', 'addGroupMigration', 'removeGroupMigration', 'listTargetProjects', 'getTargetProject', 'createTargetProject', 'updateTargetProject', 'deleteTargetProject', 'listReplicationCycles', 'getReplicationCycle', 'listImageImports', 'getImageImport', 'createImageImport', 'deleteImageImport', 'listImageImportJobs', 'getImageImportJob', 'cancelImageImportJob', 'createDiskMigrationJob', 'listDiskMigrationJobs', 'getDiskMigrationJob', 'updateDiskMigrationJob', 'deleteDiskMigrationJob', 'runDiskMigrationJob', 'cancelDiskMigrationJob']; + const vmMigrationStubMethods = [ + 'listSources', + 'getSource', + 'createSource', + 'updateSource', + 'deleteSource', + 'fetchInventory', + 'fetchStorageInventory', + 'listUtilizationReports', + 'getUtilizationReport', + 'createUtilizationReport', + 'deleteUtilizationReport', + 'listDatacenterConnectors', + 'getDatacenterConnector', + 'createDatacenterConnector', + 'deleteDatacenterConnector', + 'upgradeAppliance', + 'createMigratingVm', + 'listMigratingVms', + 'getMigratingVm', + 'updateMigratingVm', + 'deleteMigratingVm', + 'startMigration', + 'resumeMigration', + 'pauseMigration', + 'finalizeMigration', + 'extendMigration', + 'createCloneJob', + 'cancelCloneJob', + 'listCloneJobs', + 'getCloneJob', + 'createCutoverJob', + 'cancelCutoverJob', + 'listCutoverJobs', + 'getCutoverJob', + 'listGroups', + 'getGroup', + 'createGroup', + 'updateGroup', + 'deleteGroup', + 'addGroupMigration', + 'removeGroupMigration', + 'listTargetProjects', + 'getTargetProject', + 'createTargetProject', + 'updateTargetProject', + 'deleteTargetProject', + 'listReplicationCycles', + 'getReplicationCycle', + 'listImageImports', + 'getImageImport', + 'createImageImport', + 'deleteImageImport', + 'listImageImportJobs', + 'getImageImportJob', + 'cancelImageImportJob', + 'createDiskMigrationJob', + 'listDiskMigrationJobs', + 'getDiskMigrationJob', + 'updateDiskMigrationJob', + 'deleteDiskMigrationJob', + 'runDiskMigrationJob', + 'cancelDiskMigrationJob', + ]; for (const methodName of vmMigrationStubMethods) { const callPromise = this.vmMigrationStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); const descriptor = this.descriptors.page[methodName] || @@ -636,7 +942,7 @@ export class VmMigrationClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -651,8 +957,14 @@ export class VmMigrationClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'vmmigration.googleapis.com'; } @@ -663,8 +975,14 @@ export class VmMigrationClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'vmmigration.googleapis.com'; } @@ -695,9 +1013,7 @@ export class VmMigrationClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -706,8 +1022,9 @@ export class VmMigrationClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -718,5604 +1035,8405 @@ export class VmMigrationClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Source name. - * @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 protos.google.cloud.vmmigration.v1.Source|Source}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.get_source.js - * region_tag:vmmigration_v1_generated_VmMigration_GetSource_async - */ + /** + * Gets details of a single Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Source name. + * @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 protos.google.cloud.vmmigration.v1.Source|Source}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.get_source.js + * region_tag:vmmigration_v1_generated_VmMigration_GetSource_async + */ getSource( - request?: protos.google.cloud.vmmigration.v1.IGetSourceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.ISource, - protos.google.cloud.vmmigration.v1.IGetSourceRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IGetSourceRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IGetSourceRequest | undefined, + {} | undefined, + ] + >; getSource( - request: protos.google.cloud.vmmigration.v1.IGetSourceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmmigration.v1.ISource, - protos.google.cloud.vmmigration.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetSourceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IGetSourceRequest | null | undefined, + {} | null | undefined + >, + ): void; getSource( - request: protos.google.cloud.vmmigration.v1.IGetSourceRequest, - callback: Callback< - protos.google.cloud.vmmigration.v1.ISource, - protos.google.cloud.vmmigration.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetSourceRequest, + callback: Callback< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IGetSourceRequest | null | undefined, + {} | null | undefined + >, + ): void; getSource( - request?: protos.google.cloud.vmmigration.v1.IGetSourceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmmigration.v1.ISource, - protos.google.cloud.vmmigration.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmmigration.v1.IGetSourceRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmmigration.v1.ISource, - protos.google.cloud.vmmigration.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmmigration.v1.ISource, - protos.google.cloud.vmmigration.v1.IGetSourceRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmmigration.v1.IGetSourceRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IGetSourceRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IGetSourceRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getSource request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmmigration.v1.ISource, - protos.google.cloud.vmmigration.v1.IGetSourceRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmmigration.v1.ISource, + | protos.google.cloud.vmmigration.v1.IGetSourceRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getSource response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getSource(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmmigration.v1.ISource, - protos.google.cloud.vmmigration.v1.IGetSourceRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSource response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getSource(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IGetSourceRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getSource response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * List remote source's inventory of VMs. - * The remote source is the onprem vCenter (remote in the sense it's not in - * Compute Engine). The inventory describes the list of existing VMs in that - * source. Note that this operation lists the VMs on the remote source, as - * opposed to listing the MigratingVms resources in the vmmigration service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.source - * Required. The name of the Source. - * @param {boolean} request.forceRefresh - * If this flag is set to true, the source will be queried instead of using - * cached results. Using this flag will make the call slower. - * @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 protos.google.cloud.vmmigration.v1.FetchInventoryResponse|FetchInventoryResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.fetch_inventory.js - * region_tag:vmmigration_v1_generated_VmMigration_FetchInventory_async - */ + /** + * List remote source's inventory of VMs. + * The remote source is the onprem vCenter (remote in the sense it's not in + * Compute Engine). The inventory describes the list of existing VMs in that + * source. Note that this operation lists the VMs on the remote source, as + * opposed to listing the MigratingVms resources in the vmmigration service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.source + * Required. The name of the Source. + * @param {boolean} request.forceRefresh + * If this flag is set to true, the source will be queried instead of using + * cached results. Using this flag will make the call slower. + * @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 protos.google.cloud.vmmigration.v1.FetchInventoryResponse|FetchInventoryResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.fetch_inventory.js + * region_tag:vmmigration_v1_generated_VmMigration_FetchInventory_async + */ fetchInventory( - request?: protos.google.cloud.vmmigration.v1.IFetchInventoryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, - protos.google.cloud.vmmigration.v1.IFetchInventoryRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IFetchInventoryRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, + protos.google.cloud.vmmigration.v1.IFetchInventoryRequest | undefined, + {} | undefined, + ] + >; fetchInventory( - request: protos.google.cloud.vmmigration.v1.IFetchInventoryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, - protos.google.cloud.vmmigration.v1.IFetchInventoryRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IFetchInventoryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, + | protos.google.cloud.vmmigration.v1.IFetchInventoryRequest + | null + | undefined, + {} | null | undefined + >, + ): void; fetchInventory( - request: protos.google.cloud.vmmigration.v1.IFetchInventoryRequest, - callback: Callback< - protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, - protos.google.cloud.vmmigration.v1.IFetchInventoryRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IFetchInventoryRequest, + callback: Callback< + protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, + | protos.google.cloud.vmmigration.v1.IFetchInventoryRequest + | null + | undefined, + {} | null | undefined + >, + ): void; fetchInventory( - request?: protos.google.cloud.vmmigration.v1.IFetchInventoryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, - protos.google.cloud.vmmigration.v1.IFetchInventoryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmmigration.v1.IFetchInventoryRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, - protos.google.cloud.vmmigration.v1.IFetchInventoryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, - protos.google.cloud.vmmigration.v1.IFetchInventoryRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmmigration.v1.IFetchInventoryRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, + | protos.google.cloud.vmmigration.v1.IFetchInventoryRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, + protos.google.cloud.vmmigration.v1.IFetchInventoryRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'source': request.source ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + source: request.source ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('fetchInventory request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, - protos.google.cloud.vmmigration.v1.IFetchInventoryRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, + | protos.google.cloud.vmmigration.v1.IFetchInventoryRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('fetchInventory response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.fetchInventory(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, - protos.google.cloud.vmmigration.v1.IFetchInventoryRequest|undefined, - {}|undefined - ]) => { - this._log.info('fetchInventory response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .fetchInventory(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmmigration.v1.IFetchInventoryResponse, + protos.google.cloud.vmmigration.v1.IFetchInventoryRequest | undefined, + {} | undefined, + ]) => { + this._log.info('fetchInventory response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a single Utilization Report. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Utilization Report name. - * @param {google.cloud.vmmigration.v1.UtilizationReportView} [request.view] - * Optional. The level of details of the report. - * Defaults to FULL - * @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 protos.google.cloud.vmmigration.v1.UtilizationReport|UtilizationReport}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.get_utilization_report.js - * region_tag:vmmigration_v1_generated_VmMigration_GetUtilizationReport_async - */ + /** + * Gets a single Utilization Report. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Utilization Report name. + * @param {google.cloud.vmmigration.v1.UtilizationReportView} [request.view] + * Optional. The level of details of the report. + * Defaults to FULL + * @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 protos.google.cloud.vmmigration.v1.UtilizationReport|UtilizationReport}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.get_utilization_report.js + * region_tag:vmmigration_v1_generated_VmMigration_GetUtilizationReport_async + */ getUtilizationReport( - request?: protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IUtilizationReport, - protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IUtilizationReport, + ( + | protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest + | undefined + ), + {} | undefined, + ] + >; getUtilizationReport( - request: protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmmigration.v1.IUtilizationReport, - protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmmigration.v1.IUtilizationReport, + | protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getUtilizationReport( - request: protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest, - callback: Callback< - protos.google.cloud.vmmigration.v1.IUtilizationReport, - protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest, + callback: Callback< + protos.google.cloud.vmmigration.v1.IUtilizationReport, + | protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getUtilizationReport( - request?: protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmmigration.v1.IUtilizationReport, - protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmmigration.v1.IUtilizationReport, - protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmmigration.v1.IUtilizationReport, - protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmmigration.v1.IUtilizationReport, + | protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IUtilizationReport, + ( + | protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getUtilizationReport request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmmigration.v1.IUtilizationReport, - protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmmigration.v1.IUtilizationReport, + | protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getUtilizationReport response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getUtilizationReport(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmmigration.v1.IUtilizationReport, - protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest|undefined, - {}|undefined - ]) => { - this._log.info('getUtilizationReport response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getUtilizationReport(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmmigration.v1.IUtilizationReport, + ( + | protos.google.cloud.vmmigration.v1.IGetUtilizationReportRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getUtilizationReport response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single DatacenterConnector. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DatacenterConnector. - * @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 protos.google.cloud.vmmigration.v1.DatacenterConnector|DatacenterConnector}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.get_datacenter_connector.js - * region_tag:vmmigration_v1_generated_VmMigration_GetDatacenterConnector_async - */ + /** + * Gets details of a single DatacenterConnector. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the DatacenterConnector. + * @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 protos.google.cloud.vmmigration.v1.DatacenterConnector|DatacenterConnector}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.get_datacenter_connector.js + * region_tag:vmmigration_v1_generated_VmMigration_GetDatacenterConnector_async + */ getDatacenterConnector( - request?: protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IDatacenterConnector, - protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + ( + | protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest + | undefined + ), + {} | undefined, + ] + >; getDatacenterConnector( - request: protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmmigration.v1.IDatacenterConnector, - protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + | protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDatacenterConnector( - request: protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest, - callback: Callback< - protos.google.cloud.vmmigration.v1.IDatacenterConnector, - protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest, + callback: Callback< + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + | protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDatacenterConnector( - request?: protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmmigration.v1.IDatacenterConnector, - protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmmigration.v1.IDatacenterConnector, - protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmmigration.v1.IDatacenterConnector, - protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + | protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + ( + | protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getDatacenterConnector request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmmigration.v1.IDatacenterConnector, - protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + | protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getDatacenterConnector response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getDatacenterConnector(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmmigration.v1.IDatacenterConnector, - protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDatacenterConnector response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getDatacenterConnector(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + ( + | protos.google.cloud.vmmigration.v1.IGetDatacenterConnectorRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getDatacenterConnector response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single MigratingVm. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the MigratingVm. - * @param {google.cloud.vmmigration.v1.MigratingVmView} [request.view] - * Optional. The level of details of the migrating VM. - * @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 protos.google.cloud.vmmigration.v1.MigratingVm|MigratingVm}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.get_migrating_vm.js - * region_tag:vmmigration_v1_generated_VmMigration_GetMigratingVm_async - */ - getMigratingVm( - request?: protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IMigratingVm, - protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest|undefined, {}|undefined - ]>; + /** + * Gets details of a single MigratingVm. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the MigratingVm. + * @param {google.cloud.vmmigration.v1.MigratingVmView} [request.view] + * Optional. The level of details of the migrating VM. + * @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 protos.google.cloud.vmmigration.v1.MigratingVm|MigratingVm}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.get_migrating_vm.js + * region_tag:vmmigration_v1_generated_VmMigration_GetMigratingVm_async + */ getMigratingVm( - request: protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmmigration.v1.IMigratingVm, - protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest|null|undefined, - {}|null|undefined>): void; + request?: protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest | undefined, + {} | undefined, + ] + >; getMigratingVm( - request: protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest, - callback: Callback< - protos.google.cloud.vmmigration.v1.IMigratingVm, - protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmmigration.v1.IMigratingVm, + | protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getMigratingVm( - request?: protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmmigration.v1.IMigratingVm, - protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request: protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest, + callback: Callback< + protos.google.cloud.vmmigration.v1.IMigratingVm, + | protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getMigratingVm( + request?: protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmmigration.v1.IMigratingVm, - protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmmigration.v1.IMigratingVm, - protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmmigration.v1.IMigratingVm, + | protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getMigratingVm request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmmigration.v1.IMigratingVm, - protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmmigration.v1.IMigratingVm, + | protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getMigratingVm response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getMigratingVm(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmmigration.v1.IMigratingVm, - protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest|undefined, - {}|undefined - ]) => { - this._log.info('getMigratingVm response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getMigratingVm(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IGetMigratingVmRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getMigratingVm response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single CloneJob. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the CloneJob. - * @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 protos.google.cloud.vmmigration.v1.CloneJob|CloneJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.get_clone_job.js - * region_tag:vmmigration_v1_generated_VmMigration_GetCloneJob_async - */ + /** + * Gets details of a single CloneJob. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the CloneJob. + * @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 protos.google.cloud.vmmigration.v1.CloneJob|CloneJob}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.get_clone_job.js + * region_tag:vmmigration_v1_generated_VmMigration_GetCloneJob_async + */ getCloneJob( - request?: protos.google.cloud.vmmigration.v1.IGetCloneJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.ICloneJob, - protos.google.cloud.vmmigration.v1.IGetCloneJobRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IGetCloneJobRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IGetCloneJobRequest | undefined, + {} | undefined, + ] + >; getCloneJob( - request: protos.google.cloud.vmmigration.v1.IGetCloneJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmmigration.v1.ICloneJob, - protos.google.cloud.vmmigration.v1.IGetCloneJobRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetCloneJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IGetCloneJobRequest | null | undefined, + {} | null | undefined + >, + ): void; getCloneJob( - request: protos.google.cloud.vmmigration.v1.IGetCloneJobRequest, - callback: Callback< - protos.google.cloud.vmmigration.v1.ICloneJob, - protos.google.cloud.vmmigration.v1.IGetCloneJobRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetCloneJobRequest, + callback: Callback< + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IGetCloneJobRequest | null | undefined, + {} | null | undefined + >, + ): void; getCloneJob( - request?: protos.google.cloud.vmmigration.v1.IGetCloneJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmmigration.v1.ICloneJob, - protos.google.cloud.vmmigration.v1.IGetCloneJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmmigration.v1.IGetCloneJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmmigration.v1.ICloneJob, - protos.google.cloud.vmmigration.v1.IGetCloneJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmmigration.v1.ICloneJob, - protos.google.cloud.vmmigration.v1.IGetCloneJobRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmmigration.v1.IGetCloneJobRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IGetCloneJobRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IGetCloneJobRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getCloneJob request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmmigration.v1.ICloneJob, - protos.google.cloud.vmmigration.v1.IGetCloneJobRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmmigration.v1.ICloneJob, + | protos.google.cloud.vmmigration.v1.IGetCloneJobRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getCloneJob response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getCloneJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmmigration.v1.ICloneJob, - protos.google.cloud.vmmigration.v1.IGetCloneJobRequest|undefined, - {}|undefined - ]) => { - this._log.info('getCloneJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getCloneJob(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IGetCloneJobRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getCloneJob response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single CutoverJob. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the CutoverJob. - * @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 protos.google.cloud.vmmigration.v1.CutoverJob|CutoverJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.get_cutover_job.js - * region_tag:vmmigration_v1_generated_VmMigration_GetCutoverJob_async - */ + /** + * Gets details of a single CutoverJob. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the CutoverJob. + * @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 protos.google.cloud.vmmigration.v1.CutoverJob|CutoverJob}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.get_cutover_job.js + * region_tag:vmmigration_v1_generated_VmMigration_GetCutoverJob_async + */ getCutoverJob( - request?: protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.ICutoverJob, - protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ICutoverJob, + protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest | undefined, + {} | undefined, + ] + >; getCutoverJob( - request: protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmmigration.v1.ICutoverJob, - protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmmigration.v1.ICutoverJob, + | protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getCutoverJob( - request: protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest, - callback: Callback< - protos.google.cloud.vmmigration.v1.ICutoverJob, - protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest, + callback: Callback< + protos.google.cloud.vmmigration.v1.ICutoverJob, + | protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getCutoverJob( - request?: protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmmigration.v1.ICutoverJob, - protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmmigration.v1.ICutoverJob, - protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmmigration.v1.ICutoverJob, - protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmmigration.v1.ICutoverJob, + | protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ICutoverJob, + protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getCutoverJob request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmmigration.v1.ICutoverJob, - protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmmigration.v1.ICutoverJob, + | protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getCutoverJob response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getCutoverJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmmigration.v1.ICutoverJob, - protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest|undefined, - {}|undefined - ]) => { - this._log.info('getCutoverJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getCutoverJob(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmmigration.v1.ICutoverJob, + protos.google.cloud.vmmigration.v1.IGetCutoverJobRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getCutoverJob response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single Group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The group name. - * @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 protos.google.cloud.vmmigration.v1.Group|Group}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.get_group.js - * region_tag:vmmigration_v1_generated_VmMigration_GetGroup_async - */ + /** + * Gets details of a single Group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The group name. + * @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 protos.google.cloud.vmmigration.v1.Group|Group}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.get_group.js + * region_tag:vmmigration_v1_generated_VmMigration_GetGroup_async + */ getGroup( - request?: protos.google.cloud.vmmigration.v1.IGetGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IGroup, - protos.google.cloud.vmmigration.v1.IGetGroupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IGetGroupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IGetGroupRequest | undefined, + {} | undefined, + ] + >; getGroup( - request: protos.google.cloud.vmmigration.v1.IGetGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmmigration.v1.IGroup, - protos.google.cloud.vmmigration.v1.IGetGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetGroupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IGetGroupRequest | null | undefined, + {} | null | undefined + >, + ): void; getGroup( - request: protos.google.cloud.vmmigration.v1.IGetGroupRequest, - callback: Callback< - protos.google.cloud.vmmigration.v1.IGroup, - protos.google.cloud.vmmigration.v1.IGetGroupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetGroupRequest, + callback: Callback< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IGetGroupRequest | null | undefined, + {} | null | undefined + >, + ): void; getGroup( - request?: protos.google.cloud.vmmigration.v1.IGetGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmmigration.v1.IGroup, - protos.google.cloud.vmmigration.v1.IGetGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmmigration.v1.IGetGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmmigration.v1.IGroup, - protos.google.cloud.vmmigration.v1.IGetGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmmigration.v1.IGroup, - protos.google.cloud.vmmigration.v1.IGetGroupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmmigration.v1.IGetGroupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IGetGroupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IGetGroupRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getGroup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmmigration.v1.IGroup, - protos.google.cloud.vmmigration.v1.IGetGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmmigration.v1.IGroup, + | protos.google.cloud.vmmigration.v1.IGetGroupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getGroup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmmigration.v1.IGroup, - protos.google.cloud.vmmigration.v1.IGetGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getGroup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IGetGroupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getGroup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single TargetProject. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The TargetProject name. - * @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 protos.google.cloud.vmmigration.v1.TargetProject|TargetProject}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.get_target_project.js - * region_tag:vmmigration_v1_generated_VmMigration_GetTargetProject_async - */ + /** + * Gets details of a single TargetProject. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The TargetProject name. + * @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 protos.google.cloud.vmmigration.v1.TargetProject|TargetProject}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.get_target_project.js + * region_tag:vmmigration_v1_generated_VmMigration_GetTargetProject_async + */ getTargetProject( - request?: protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.ITargetProject, - protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest | undefined, + {} | undefined, + ] + >; getTargetProject( - request: protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmmigration.v1.ITargetProject, - protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmmigration.v1.ITargetProject, + | protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getTargetProject( - request: protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest, - callback: Callback< - protos.google.cloud.vmmigration.v1.ITargetProject, - protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest, + callback: Callback< + protos.google.cloud.vmmigration.v1.ITargetProject, + | protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getTargetProject( - request?: protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmmigration.v1.ITargetProject, - protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmmigration.v1.ITargetProject, - protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmmigration.v1.ITargetProject, - protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmmigration.v1.ITargetProject, + | protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getTargetProject request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmmigration.v1.ITargetProject, - protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmmigration.v1.ITargetProject, + | protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getTargetProject response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getTargetProject(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmmigration.v1.ITargetProject, - protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest|undefined, - {}|undefined - ]) => { - this._log.info('getTargetProject response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getTargetProject(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmmigration.v1.ITargetProject, + ( + | protos.google.cloud.vmmigration.v1.IGetTargetProjectRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getTargetProject response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single ReplicationCycle. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the ReplicationCycle. - * @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 protos.google.cloud.vmmigration.v1.ReplicationCycle|ReplicationCycle}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.get_replication_cycle.js - * region_tag:vmmigration_v1_generated_VmMigration_GetReplicationCycle_async - */ + /** + * Gets details of a single ReplicationCycle. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the ReplicationCycle. + * @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 protos.google.cloud.vmmigration.v1.ReplicationCycle|ReplicationCycle}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.get_replication_cycle.js + * region_tag:vmmigration_v1_generated_VmMigration_GetReplicationCycle_async + */ getReplicationCycle( - request?: protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IReplicationCycle, - protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IReplicationCycle, + ( + | protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest + | undefined + ), + {} | undefined, + ] + >; getReplicationCycle( - request: protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmmigration.v1.IReplicationCycle, - protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmmigration.v1.IReplicationCycle, + | protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getReplicationCycle( - request: protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest, - callback: Callback< - protos.google.cloud.vmmigration.v1.IReplicationCycle, - protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest, + callback: Callback< + protos.google.cloud.vmmigration.v1.IReplicationCycle, + | protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getReplicationCycle( - request?: protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmmigration.v1.IReplicationCycle, - protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmmigration.v1.IReplicationCycle, - protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmmigration.v1.IReplicationCycle, - protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmmigration.v1.IReplicationCycle, + | protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IReplicationCycle, + ( + | protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getReplicationCycle request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmmigration.v1.IReplicationCycle, - protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmmigration.v1.IReplicationCycle, + | protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getReplicationCycle response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getReplicationCycle(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmmigration.v1.IReplicationCycle, - protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest|undefined, - {}|undefined - ]) => { - this._log.info('getReplicationCycle response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getReplicationCycle(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmmigration.v1.IReplicationCycle, + ( + | protos.google.cloud.vmmigration.v1.IGetReplicationCycleRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getReplicationCycle response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single ImageImport. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The ImageImport name. - * @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 protos.google.cloud.vmmigration.v1.ImageImport|ImageImport}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.get_image_import.js - * region_tag:vmmigration_v1_generated_VmMigration_GetImageImport_async - */ + /** + * Gets details of a single ImageImport. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The ImageImport name. + * @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 protos.google.cloud.vmmigration.v1.ImageImport|ImageImport}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.get_image_import.js + * region_tag:vmmigration_v1_generated_VmMigration_GetImageImport_async + */ getImageImport( - request?: protos.google.cloud.vmmigration.v1.IGetImageImportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IImageImport, - protos.google.cloud.vmmigration.v1.IGetImageImportRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IGetImageImportRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IImageImport, + protos.google.cloud.vmmigration.v1.IGetImageImportRequest | undefined, + {} | undefined, + ] + >; getImageImport( - request: protos.google.cloud.vmmigration.v1.IGetImageImportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmmigration.v1.IImageImport, - protos.google.cloud.vmmigration.v1.IGetImageImportRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetImageImportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmmigration.v1.IImageImport, + | protos.google.cloud.vmmigration.v1.IGetImageImportRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getImageImport( - request: protos.google.cloud.vmmigration.v1.IGetImageImportRequest, - callback: Callback< - protos.google.cloud.vmmigration.v1.IImageImport, - protos.google.cloud.vmmigration.v1.IGetImageImportRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetImageImportRequest, + callback: Callback< + protos.google.cloud.vmmigration.v1.IImageImport, + | protos.google.cloud.vmmigration.v1.IGetImageImportRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getImageImport( - request?: protos.google.cloud.vmmigration.v1.IGetImageImportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmmigration.v1.IImageImport, - protos.google.cloud.vmmigration.v1.IGetImageImportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmmigration.v1.IGetImageImportRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmmigration.v1.IImageImport, - protos.google.cloud.vmmigration.v1.IGetImageImportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmmigration.v1.IImageImport, - protos.google.cloud.vmmigration.v1.IGetImageImportRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmmigration.v1.IGetImageImportRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmmigration.v1.IImageImport, + | protos.google.cloud.vmmigration.v1.IGetImageImportRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IImageImport, + protos.google.cloud.vmmigration.v1.IGetImageImportRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getImageImport request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmmigration.v1.IImageImport, - protos.google.cloud.vmmigration.v1.IGetImageImportRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmmigration.v1.IImageImport, + | protos.google.cloud.vmmigration.v1.IGetImageImportRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getImageImport response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getImageImport(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmmigration.v1.IImageImport, - protos.google.cloud.vmmigration.v1.IGetImageImportRequest|undefined, - {}|undefined - ]) => { - this._log.info('getImageImport response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getImageImport(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmmigration.v1.IImageImport, + protos.google.cloud.vmmigration.v1.IGetImageImportRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getImageImport response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single ImageImportJob. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The ImageImportJob name. - * @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 protos.google.cloud.vmmigration.v1.ImageImportJob|ImageImportJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.get_image_import_job.js - * region_tag:vmmigration_v1_generated_VmMigration_GetImageImportJob_async - */ + /** + * Gets details of a single ImageImportJob. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The ImageImportJob name. + * @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 protos.google.cloud.vmmigration.v1.ImageImportJob|ImageImportJob}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.get_image_import_job.js + * region_tag:vmmigration_v1_generated_VmMigration_GetImageImportJob_async + */ getImageImportJob( - request?: protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IImageImportJob, - protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IImageImportJob, + protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest | undefined, + {} | undefined, + ] + >; getImageImportJob( - request: protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmmigration.v1.IImageImportJob, - protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmmigration.v1.IImageImportJob, + | protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getImageImportJob( - request: protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest, - callback: Callback< - protos.google.cloud.vmmigration.v1.IImageImportJob, - protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest, + callback: Callback< + protos.google.cloud.vmmigration.v1.IImageImportJob, + | protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getImageImportJob( - request?: protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmmigration.v1.IImageImportJob, - protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmmigration.v1.IImageImportJob, - protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmmigration.v1.IImageImportJob, - protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmmigration.v1.IImageImportJob, + | protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IImageImportJob, + protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getImageImportJob request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmmigration.v1.IImageImportJob, - protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmmigration.v1.IImageImportJob, + | protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getImageImportJob response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getImageImportJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmmigration.v1.IImageImportJob, - protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest|undefined, - {}|undefined - ]) => { - this._log.info('getImageImportJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getImageImportJob(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmmigration.v1.IImageImportJob, + ( + | protos.google.cloud.vmmigration.v1.IGetImageImportJobRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getImageImportJob response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single DiskMigrationJob. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DiskMigrationJob. - * @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 protos.google.cloud.vmmigration.v1.DiskMigrationJob|DiskMigrationJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.get_disk_migration_job.js - * region_tag:vmmigration_v1_generated_VmMigration_GetDiskMigrationJob_async - */ + /** + * Gets details of a single DiskMigrationJob. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the DiskMigrationJob. + * @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 protos.google.cloud.vmmigration.v1.DiskMigrationJob|DiskMigrationJob}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.get_disk_migration_job.js + * region_tag:vmmigration_v1_generated_VmMigration_GetDiskMigrationJob_async + */ getDiskMigrationJob( - request?: protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IDiskMigrationJob, - protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + ( + | protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest + | undefined + ), + {} | undefined, + ] + >; getDiskMigrationJob( - request: protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmmigration.v1.IDiskMigrationJob, - protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + | protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDiskMigrationJob( - request: protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest, - callback: Callback< - protos.google.cloud.vmmigration.v1.IDiskMigrationJob, - protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest, + callback: Callback< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + | protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDiskMigrationJob( - request?: protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmmigration.v1.IDiskMigrationJob, - protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmmigration.v1.IDiskMigrationJob, - protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmmigration.v1.IDiskMigrationJob, - protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + | protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + ( + | protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getDiskMigrationJob request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmmigration.v1.IDiskMigrationJob, - protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + | protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getDiskMigrationJob response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getDiskMigrationJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmmigration.v1.IDiskMigrationJob, - protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDiskMigrationJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getDiskMigrationJob(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + ( + | protos.google.cloud.vmmigration.v1.IGetDiskMigrationJobRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getDiskMigrationJob response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new Source in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Source's parent. - * @param {string} request.sourceId - * Required. The source identifier. - * @param {google.cloud.vmmigration.v1.Source} request.source - * Required. The create request body. - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_source.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateSource_async - */ + /** + * Creates a new Source in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Source's parent. + * @param {string} request.sourceId + * Required. The source identifier. + * @param {google.cloud.vmmigration.v1.Source} request.source + * Required. The create request body. + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_source.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateSource_async + */ createSource( - request?: protos.google.cloud.vmmigration.v1.ICreateSourceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.ICreateSourceRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createSource( - request: protos.google.cloud.vmmigration.v1.ICreateSourceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateSourceRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSource( - request: protos.google.cloud.vmmigration.v1.ICreateSourceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateSourceRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createSource( - request?: protos.google.cloud.vmmigration.v1.ICreateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.ICreateSourceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createSource response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createSource request %j', request); - return this.innerApiCalls.createSource(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createSource response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createSource(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createSource response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createSource()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_source.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateSource_async - */ - async checkCreateSourceProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createSource()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_source.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateSource_async + */ + async checkCreateSourceProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.Source, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('createSource long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createSource, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createSource, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.Source, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Field mask is used to specify the fields to be overwritten in the - * Source resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.vmmigration.v1.Source} request.source - * Required. The update request body. - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.update_source.js - * region_tag:vmmigration_v1_generated_VmMigration_UpdateSource_async - */ + /** + * Updates the parameters of a single Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Field mask is used to specify the fields to be overwritten in the + * Source resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.vmmigration.v1.Source} request.source + * Required. The update request body. + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.update_source.js + * region_tag:vmmigration_v1_generated_VmMigration_UpdateSource_async + */ updateSource( - request?: protos.google.cloud.vmmigration.v1.IUpdateSourceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IUpdateSourceRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateSource( - request: protos.google.cloud.vmmigration.v1.IUpdateSourceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IUpdateSourceRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateSource( - request: protos.google.cloud.vmmigration.v1.IUpdateSourceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IUpdateSourceRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateSource( - request?: protos.google.cloud.vmmigration.v1.IUpdateSourceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IUpdateSourceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'source.name': request.source!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'source.name': request.source!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateSource response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateSource request %j', request); - return this.innerApiCalls.updateSource(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateSource response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateSource(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateSource response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateSource()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.update_source.js - * region_tag:vmmigration_v1_generated_VmMigration_UpdateSource_async - */ - async checkUpdateSourceProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateSource()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.update_source.js + * region_tag:vmmigration_v1_generated_VmMigration_UpdateSource_async + */ + async checkUpdateSourceProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.Source, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('updateSource long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateSource, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateSource, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.Source, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Deletes a single Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Source name. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_source.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteSource_async - */ + /** + * Deletes a single Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Source name. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_source.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteSource_async + */ deleteSource( - request?: protos.google.cloud.vmmigration.v1.IDeleteSourceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IDeleteSourceRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteSource( - request: protos.google.cloud.vmmigration.v1.IDeleteSourceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteSourceRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSource( - request: protos.google.cloud.vmmigration.v1.IDeleteSourceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteSourceRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteSource( - request?: protos.google.cloud.vmmigration.v1.IDeleteSourceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IDeleteSourceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteSource response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteSource request %j', request); - return this.innerApiCalls.deleteSource(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteSource response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteSource(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteSource response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteSource()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_source.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteSource_async - */ - async checkDeleteSourceProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteSource()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_source.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteSource_async + */ + async checkDeleteSourceProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('deleteSource long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteSource, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteSource, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Creates a new UtilizationReport. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Utilization Report's parent. - * @param {google.cloud.vmmigration.v1.UtilizationReport} request.utilizationReport - * Required. The report to create. - * @param {string} request.utilizationReportId - * Required. The ID to use for the report, which will become the final - * component of the reports's resource name. - * - * This value maximum length is 63 characters, and valid characters - * are /{@link protos.0-9|a-z}-/. It must start with an english letter and must not - * end with a hyphen. - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_utilization_report.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateUtilizationReport_async - */ + /** + * Creates a new UtilizationReport. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Utilization Report's parent. + * @param {google.cloud.vmmigration.v1.UtilizationReport} request.utilizationReport + * Required. The report to create. + * @param {string} request.utilizationReportId + * Required. The ID to use for the report, which will become the final + * component of the reports's resource name. + * + * This value maximum length is 63 characters, and valid characters + * are /{@link protos.0-9|a-z}-/. It must start with an english letter and must not + * end with a hyphen. + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_utilization_report.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateUtilizationReport_async + */ createUtilizationReport( - request?: protos.google.cloud.vmmigration.v1.ICreateUtilizationReportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.ICreateUtilizationReportRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IUtilizationReport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createUtilizationReport( - request: protos.google.cloud.vmmigration.v1.ICreateUtilizationReportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateUtilizationReportRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IUtilizationReport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createUtilizationReport( - request: protos.google.cloud.vmmigration.v1.ICreateUtilizationReportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateUtilizationReportRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IUtilizationReport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createUtilizationReport( - request?: protos.google.cloud.vmmigration.v1.ICreateUtilizationReportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.ICreateUtilizationReportRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IUtilizationReport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IUtilizationReport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IUtilizationReport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IUtilizationReport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createUtilizationReport response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createUtilizationReport request %j', request); - return this.innerApiCalls.createUtilizationReport(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createUtilizationReport response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createUtilizationReport(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IUtilizationReport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createUtilizationReport response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createUtilizationReport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_utilization_report.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateUtilizationReport_async - */ - async checkCreateUtilizationReportProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createUtilizationReport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_utilization_report.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateUtilizationReport_async + */ + async checkCreateUtilizationReportProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.UtilizationReport, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('createUtilizationReport long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createUtilizationReport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createUtilizationReport, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.UtilizationReport, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Deletes a single Utilization Report. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Utilization Report name. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_utilization_report.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteUtilizationReport_async - */ + /** + * Deletes a single Utilization Report. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Utilization Report name. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_utilization_report.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteUtilizationReport_async + */ deleteUtilizationReport( - request?: protos.google.cloud.vmmigration.v1.IDeleteUtilizationReportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IDeleteUtilizationReportRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteUtilizationReport( - request: protos.google.cloud.vmmigration.v1.IDeleteUtilizationReportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteUtilizationReportRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteUtilizationReport( - request: protos.google.cloud.vmmigration.v1.IDeleteUtilizationReportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteUtilizationReportRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteUtilizationReport( - request?: protos.google.cloud.vmmigration.v1.IDeleteUtilizationReportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IDeleteUtilizationReportRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteUtilizationReport response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteUtilizationReport request %j', request); - return this.innerApiCalls.deleteUtilizationReport(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteUtilizationReport response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteUtilizationReport(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteUtilizationReport response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteUtilizationReport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_utilization_report.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteUtilizationReport_async - */ - async checkDeleteUtilizationReportProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteUtilizationReport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_utilization_report.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteUtilizationReport_async + */ + async checkDeleteUtilizationReportProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('deleteUtilizationReport long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteUtilizationReport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteUtilizationReport, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Creates a new DatacenterConnector in a given Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The DatacenterConnector's parent. - * Required. The Source in where the new DatacenterConnector will be created. - * For example: - * `projects/my-project/locations/us-central1/sources/my-source` - * @param {string} request.datacenterConnectorId - * Required. The datacenterConnector identifier. - * @param {google.cloud.vmmigration.v1.DatacenterConnector} request.datacenterConnector - * Required. The create request body. - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_datacenter_connector.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateDatacenterConnector_async - */ + /** + * Creates a new DatacenterConnector in a given Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The DatacenterConnector's parent. + * Required. The Source in where the new DatacenterConnector will be created. + * For example: + * `projects/my-project/locations/us-central1/sources/my-source` + * @param {string} request.datacenterConnectorId + * Required. The datacenterConnector identifier. + * @param {google.cloud.vmmigration.v1.DatacenterConnector} request.datacenterConnector + * Required. The create request body. + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_datacenter_connector.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateDatacenterConnector_async + */ createDatacenterConnector( - request?: protos.google.cloud.vmmigration.v1.ICreateDatacenterConnectorRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.ICreateDatacenterConnectorRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createDatacenterConnector( - request: protos.google.cloud.vmmigration.v1.ICreateDatacenterConnectorRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateDatacenterConnectorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createDatacenterConnector( - request: protos.google.cloud.vmmigration.v1.ICreateDatacenterConnectorRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateDatacenterConnectorRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createDatacenterConnector( - request?: protos.google.cloud.vmmigration.v1.ICreateDatacenterConnectorRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.ICreateDatacenterConnectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createDatacenterConnector response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createDatacenterConnector request %j', request); - return this.innerApiCalls.createDatacenterConnector(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createDatacenterConnector response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createDatacenterConnector(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createDatacenterConnector response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createDatacenterConnector()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_datacenter_connector.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateDatacenterConnector_async - */ - async checkCreateDatacenterConnectorProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createDatacenterConnector()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_datacenter_connector.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateDatacenterConnector_async + */ + async checkCreateDatacenterConnectorProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.DatacenterConnector, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('createDatacenterConnector long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createDatacenterConnector, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createDatacenterConnector, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.DatacenterConnector, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Deletes a single DatacenterConnector. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The DatacenterConnector name. - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_datacenter_connector.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteDatacenterConnector_async - */ + /** + * Deletes a single DatacenterConnector. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The DatacenterConnector name. + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_datacenter_connector.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteDatacenterConnector_async + */ deleteDatacenterConnector( - request?: protos.google.cloud.vmmigration.v1.IDeleteDatacenterConnectorRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IDeleteDatacenterConnectorRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteDatacenterConnector( - request: protos.google.cloud.vmmigration.v1.IDeleteDatacenterConnectorRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteDatacenterConnectorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteDatacenterConnector( - request: protos.google.cloud.vmmigration.v1.IDeleteDatacenterConnectorRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteDatacenterConnectorRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteDatacenterConnector( - request?: protos.google.cloud.vmmigration.v1.IDeleteDatacenterConnectorRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IDeleteDatacenterConnectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteDatacenterConnector response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteDatacenterConnector request %j', request); - return this.innerApiCalls.deleteDatacenterConnector(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteDatacenterConnector response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteDatacenterConnector(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteDatacenterConnector response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteDatacenterConnector()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_datacenter_connector.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteDatacenterConnector_async - */ - async checkDeleteDatacenterConnectorProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteDatacenterConnector()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_datacenter_connector.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteDatacenterConnector_async + */ + async checkDeleteDatacenterConnectorProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('deleteDatacenterConnector long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteDatacenterConnector, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteDatacenterConnector, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Upgrades the appliance relate to this DatacenterConnector to the in-place - * updateable version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.datacenterConnector - * Required. The DatacenterConnector name. - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.upgrade_appliance.js - * region_tag:vmmigration_v1_generated_VmMigration_UpgradeAppliance_async - */ + /** + * Upgrades the appliance relate to this DatacenterConnector to the in-place + * updateable version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.datacenterConnector + * Required. The DatacenterConnector name. + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.upgrade_appliance.js + * region_tag:vmmigration_v1_generated_VmMigration_UpgradeAppliance_async + */ upgradeAppliance( - request?: protos.google.cloud.vmmigration.v1.IUpgradeApplianceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IUpgradeApplianceRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IUpgradeApplianceResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; upgradeAppliance( - request: protos.google.cloud.vmmigration.v1.IUpgradeApplianceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IUpgradeApplianceRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IUpgradeApplianceResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; upgradeAppliance( - request: protos.google.cloud.vmmigration.v1.IUpgradeApplianceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IUpgradeApplianceRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IUpgradeApplianceResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; upgradeAppliance( - request?: protos.google.cloud.vmmigration.v1.IUpgradeApplianceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IUpgradeApplianceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IUpgradeApplianceResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IUpgradeApplianceResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IUpgradeApplianceResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'datacenter_connector': request.datacenterConnector ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + datacenter_connector: request.datacenterConnector ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IUpgradeApplianceResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('upgradeAppliance response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('upgradeAppliance request %j', request); - return this.innerApiCalls.upgradeAppliance(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('upgradeAppliance response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .upgradeAppliance(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IUpgradeApplianceResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('upgradeAppliance response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `upgradeAppliance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.upgrade_appliance.js - * region_tag:vmmigration_v1_generated_VmMigration_UpgradeAppliance_async - */ - async checkUpgradeApplianceProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `upgradeAppliance()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.upgrade_appliance.js + * region_tag:vmmigration_v1_generated_VmMigration_UpgradeAppliance_async + */ + async checkUpgradeApplianceProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.UpgradeApplianceResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('upgradeAppliance long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.upgradeAppliance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.upgradeAppliance, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.UpgradeApplianceResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Creates a new MigratingVm in a given Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The MigratingVm's parent. - * @param {string} request.migratingVmId - * Required. The migratingVm identifier. - * @param {google.cloud.vmmigration.v1.MigratingVm} request.migratingVm - * Required. The create request body. - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_migrating_vm.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateMigratingVm_async - */ + /** + * Creates a new MigratingVm in a given Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The MigratingVm's parent. + * @param {string} request.migratingVmId + * Required. The migratingVm identifier. + * @param {google.cloud.vmmigration.v1.MigratingVm} request.migratingVm + * Required. The create request body. + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_migrating_vm.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateMigratingVm_async + */ createMigratingVm( - request?: protos.google.cloud.vmmigration.v1.ICreateMigratingVmRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.ICreateMigratingVmRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createMigratingVm( - request: protos.google.cloud.vmmigration.v1.ICreateMigratingVmRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateMigratingVmRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMigratingVm( - request: protos.google.cloud.vmmigration.v1.ICreateMigratingVmRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateMigratingVmRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createMigratingVm( - request?: protos.google.cloud.vmmigration.v1.ICreateMigratingVmRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.ICreateMigratingVmRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createMigratingVm response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createMigratingVm request %j', request); - return this.innerApiCalls.createMigratingVm(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createMigratingVm response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createMigratingVm(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createMigratingVm response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createMigratingVm()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_migrating_vm.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateMigratingVm_async - */ - async checkCreateMigratingVmProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createMigratingVm()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_migrating_vm.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateMigratingVm_async + */ + async checkCreateMigratingVmProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.MigratingVm, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('createMigratingVm long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMigratingVm, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createMigratingVm, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.MigratingVm, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single MigratingVm. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Field mask is used to specify the fields to be overwritten in the - * MigratingVm resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.vmmigration.v1.MigratingVm} request.migratingVm - * Required. The update request body. - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.update_migrating_vm.js - * region_tag:vmmigration_v1_generated_VmMigration_UpdateMigratingVm_async - */ + /** + * Updates the parameters of a single MigratingVm. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Field mask is used to specify the fields to be overwritten in the + * MigratingVm resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.vmmigration.v1.MigratingVm} request.migratingVm + * Required. The update request body. + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.update_migrating_vm.js + * region_tag:vmmigration_v1_generated_VmMigration_UpdateMigratingVm_async + */ updateMigratingVm( - request?: protos.google.cloud.vmmigration.v1.IUpdateMigratingVmRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IUpdateMigratingVmRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateMigratingVm( - request: protos.google.cloud.vmmigration.v1.IUpdateMigratingVmRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IUpdateMigratingVmRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMigratingVm( - request: protos.google.cloud.vmmigration.v1.IUpdateMigratingVmRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IUpdateMigratingVmRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateMigratingVm( - request?: protos.google.cloud.vmmigration.v1.IUpdateMigratingVmRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IUpdateMigratingVmRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'migrating_vm.name': request.migratingVm!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'migrating_vm.name': request.migratingVm!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateMigratingVm response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateMigratingVm request %j', request); - return this.innerApiCalls.updateMigratingVm(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateMigratingVm response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateMigratingVm(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateMigratingVm response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateMigratingVm()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.update_migrating_vm.js - * region_tag:vmmigration_v1_generated_VmMigration_UpdateMigratingVm_async - */ - async checkUpdateMigratingVmProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateMigratingVm()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.update_migrating_vm.js + * region_tag:vmmigration_v1_generated_VmMigration_UpdateMigratingVm_async + */ + async checkUpdateMigratingVmProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.MigratingVm, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('updateMigratingVm long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMigratingVm, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateMigratingVm, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.MigratingVm, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Deletes a single MigratingVm. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the MigratingVm. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_migrating_vm.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteMigratingVm_async - */ + /** + * Deletes a single MigratingVm. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the MigratingVm. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_migrating_vm.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteMigratingVm_async + */ deleteMigratingVm( - request?: protos.google.cloud.vmmigration.v1.IDeleteMigratingVmRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IDeleteMigratingVmRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteMigratingVm( - request: protos.google.cloud.vmmigration.v1.IDeleteMigratingVmRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteMigratingVmRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMigratingVm( - request: protos.google.cloud.vmmigration.v1.IDeleteMigratingVmRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteMigratingVmRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteMigratingVm( - request?: protos.google.cloud.vmmigration.v1.IDeleteMigratingVmRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IDeleteMigratingVmRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteMigratingVm response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteMigratingVm request %j', request); - return this.innerApiCalls.deleteMigratingVm(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteMigratingVm response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteMigratingVm(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteMigratingVm response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteMigratingVm()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_migrating_vm.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteMigratingVm_async - */ - async checkDeleteMigratingVmProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteMigratingVm()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_migrating_vm.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteMigratingVm_async + */ + async checkDeleteMigratingVmProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('deleteMigratingVm long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteMigratingVm, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteMigratingVm, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Starts migration for a VM. Starts the process of uploading - * data and creating snapshots, in replication cycles scheduled by the policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.migratingVm - * Required. The name of the MigratingVm. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.start_migration.js - * region_tag:vmmigration_v1_generated_VmMigration_StartMigration_async - */ + /** + * Starts migration for a VM. Starts the process of uploading + * data and creating snapshots, in replication cycles scheduled by the policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.migratingVm + * Required. The name of the MigratingVm. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.start_migration.js + * region_tag:vmmigration_v1_generated_VmMigration_StartMigration_async + */ startMigration( - request?: protos.google.cloud.vmmigration.v1.IStartMigrationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IStartMigrationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IStartMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; startMigration( - request: protos.google.cloud.vmmigration.v1.IStartMigrationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IStartMigrationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IStartMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; startMigration( - request: protos.google.cloud.vmmigration.v1.IStartMigrationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IStartMigrationRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IStartMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; startMigration( - request?: protos.google.cloud.vmmigration.v1.IStartMigrationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IStartMigrationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IStartMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IStartMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IStartMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'migrating_vm': request.migratingVm ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + migrating_vm: request.migratingVm ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IStartMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('startMigration response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('startMigration request %j', request); - return this.innerApiCalls.startMigration(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('startMigration response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .startMigration(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IStartMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('startMigration response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `startMigration()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.start_migration.js - * region_tag:vmmigration_v1_generated_VmMigration_StartMigration_async - */ - async checkStartMigrationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `startMigration()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.start_migration.js + * region_tag:vmmigration_v1_generated_VmMigration_StartMigration_async + */ + async checkStartMigrationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.StartMigrationResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('startMigration long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.startMigration, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.startMigration, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.StartMigrationResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Resumes a migration for a VM. When called on a paused migration, will start - * the process of uploading data and creating snapshots; when called on a - * completed cut-over migration, will update the migration to active state and - * start the process of uploading data and creating snapshots. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.migratingVm - * Required. The name of the MigratingVm. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.resume_migration.js - * region_tag:vmmigration_v1_generated_VmMigration_ResumeMigration_async - */ + /** + * Resumes a migration for a VM. When called on a paused migration, will start + * the process of uploading data and creating snapshots; when called on a + * completed cut-over migration, will update the migration to active state and + * start the process of uploading data and creating snapshots. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.migratingVm + * Required. The name of the MigratingVm. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.resume_migration.js + * region_tag:vmmigration_v1_generated_VmMigration_ResumeMigration_async + */ resumeMigration( - request?: protos.google.cloud.vmmigration.v1.IResumeMigrationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IResumeMigrationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IResumeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; resumeMigration( - request: protos.google.cloud.vmmigration.v1.IResumeMigrationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IResumeMigrationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IResumeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; resumeMigration( - request: protos.google.cloud.vmmigration.v1.IResumeMigrationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IResumeMigrationRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IResumeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; resumeMigration( - request?: protos.google.cloud.vmmigration.v1.IResumeMigrationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IResumeMigrationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IResumeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IResumeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IResumeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'migrating_vm': request.migratingVm ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + migrating_vm: request.migratingVm ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IResumeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('resumeMigration response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('resumeMigration request %j', request); - return this.innerApiCalls.resumeMigration(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('resumeMigration response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .resumeMigration(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IResumeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('resumeMigration response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `resumeMigration()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.resume_migration.js - * region_tag:vmmigration_v1_generated_VmMigration_ResumeMigration_async - */ - async checkResumeMigrationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `resumeMigration()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.resume_migration.js + * region_tag:vmmigration_v1_generated_VmMigration_ResumeMigration_async + */ + async checkResumeMigrationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.ResumeMigrationResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('resumeMigration long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.resumeMigration, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.resumeMigration, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.ResumeMigrationResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Pauses a migration for a VM. If cycle tasks are running they will be - * cancelled, preserving source task data. Further replication cycles will not - * be triggered while the VM is paused. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.migratingVm - * Required. The name of the MigratingVm. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.pause_migration.js - * region_tag:vmmigration_v1_generated_VmMigration_PauseMigration_async - */ + /** + * Pauses a migration for a VM. If cycle tasks are running they will be + * cancelled, preserving source task data. Further replication cycles will not + * be triggered while the VM is paused. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.migratingVm + * Required. The name of the MigratingVm. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.pause_migration.js + * region_tag:vmmigration_v1_generated_VmMigration_PauseMigration_async + */ pauseMigration( - request?: protos.google.cloud.vmmigration.v1.IPauseMigrationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IPauseMigrationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IPauseMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; pauseMigration( - request: protos.google.cloud.vmmigration.v1.IPauseMigrationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IPauseMigrationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IPauseMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; pauseMigration( - request: protos.google.cloud.vmmigration.v1.IPauseMigrationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IPauseMigrationRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IPauseMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; pauseMigration( - request?: protos.google.cloud.vmmigration.v1.IPauseMigrationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IPauseMigrationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IPauseMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IPauseMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IPauseMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'migrating_vm': request.migratingVm ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + migrating_vm: request.migratingVm ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IPauseMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('pauseMigration response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('pauseMigration request %j', request); - return this.innerApiCalls.pauseMigration(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('pauseMigration response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .pauseMigration(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IPauseMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('pauseMigration response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `pauseMigration()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.pause_migration.js - * region_tag:vmmigration_v1_generated_VmMigration_PauseMigration_async - */ - async checkPauseMigrationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `pauseMigration()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.pause_migration.js + * region_tag:vmmigration_v1_generated_VmMigration_PauseMigration_async + */ + async checkPauseMigrationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.PauseMigrationResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('pauseMigration long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.pauseMigration, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.pauseMigration, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.PauseMigrationResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Marks a migration as completed, deleting migration resources that are no - * longer being used. Only applicable after cutover is done. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.migratingVm - * Required. The name of the MigratingVm. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.finalize_migration.js - * region_tag:vmmigration_v1_generated_VmMigration_FinalizeMigration_async - */ + /** + * Marks a migration as completed, deleting migration resources that are no + * longer being used. Only applicable after cutover is done. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.migratingVm + * Required. The name of the MigratingVm. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.finalize_migration.js + * region_tag:vmmigration_v1_generated_VmMigration_FinalizeMigration_async + */ finalizeMigration( - request?: protos.google.cloud.vmmigration.v1.IFinalizeMigrationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IFinalizeMigrationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IFinalizeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; finalizeMigration( - request: protos.google.cloud.vmmigration.v1.IFinalizeMigrationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IFinalizeMigrationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IFinalizeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; finalizeMigration( - request: protos.google.cloud.vmmigration.v1.IFinalizeMigrationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IFinalizeMigrationRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IFinalizeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; finalizeMigration( - request?: protos.google.cloud.vmmigration.v1.IFinalizeMigrationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IFinalizeMigrationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IFinalizeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IFinalizeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IFinalizeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'migrating_vm': request.migratingVm ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + migrating_vm: request.migratingVm ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IFinalizeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('finalizeMigration response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('finalizeMigration request %j', request); - return this.innerApiCalls.finalizeMigration(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('finalizeMigration response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .finalizeMigration(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IFinalizeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('finalizeMigration response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `finalizeMigration()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.finalize_migration.js - * region_tag:vmmigration_v1_generated_VmMigration_FinalizeMigration_async - */ - async checkFinalizeMigrationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `finalizeMigration()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.finalize_migration.js + * region_tag:vmmigration_v1_generated_VmMigration_FinalizeMigration_async + */ + async checkFinalizeMigrationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.FinalizeMigrationResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('finalizeMigration long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.finalizeMigration, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.finalizeMigration, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.FinalizeMigrationResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Extend the migrating VM time to live. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.migratingVm - * Required. The name of the MigratingVm. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.extend_migration.js - * region_tag:vmmigration_v1_generated_VmMigration_ExtendMigration_async - */ + /** + * Extend the migrating VM time to live. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.migratingVm + * Required. The name of the MigratingVm. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.extend_migration.js + * region_tag:vmmigration_v1_generated_VmMigration_ExtendMigration_async + */ extendMigration( - request?: protos.google.cloud.vmmigration.v1.IExtendMigrationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IExtendMigrationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IExtendMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; extendMigration( - request: protos.google.cloud.vmmigration.v1.IExtendMigrationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IExtendMigrationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IExtendMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; extendMigration( - request: protos.google.cloud.vmmigration.v1.IExtendMigrationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IExtendMigrationRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IExtendMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; extendMigration( - request?: protos.google.cloud.vmmigration.v1.IExtendMigrationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IExtendMigrationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IExtendMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IExtendMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IExtendMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'migrating_vm': request.migratingVm ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + migrating_vm: request.migratingVm ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IExtendMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('extendMigration response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('extendMigration request %j', request); - return this.innerApiCalls.extendMigration(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('extendMigration response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .extendMigration(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IExtendMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('extendMigration response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `extendMigration()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.extend_migration.js - * region_tag:vmmigration_v1_generated_VmMigration_ExtendMigration_async - */ - async checkExtendMigrationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `extendMigration()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.extend_migration.js + * region_tag:vmmigration_v1_generated_VmMigration_ExtendMigration_async + */ + async checkExtendMigrationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.ExtendMigrationResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('extendMigration long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.extendMigration, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.extendMigration, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.ExtendMigrationResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Initiates a Clone of a specific migrating VM. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Clone's parent. - * @param {string} request.cloneJobId - * Required. The clone job identifier. - * @param {google.cloud.vmmigration.v1.CloneJob} request.cloneJob - * Required. The clone request body. - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_clone_job.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateCloneJob_async - */ + /** + * Initiates a Clone of a specific migrating VM. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Clone's parent. + * @param {string} request.cloneJobId + * Required. The clone job identifier. + * @param {google.cloud.vmmigration.v1.CloneJob} request.cloneJob + * Required. The clone request body. + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_clone_job.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateCloneJob_async + */ createCloneJob( - request?: protos.google.cloud.vmmigration.v1.ICreateCloneJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.ICreateCloneJobRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createCloneJob( - request: protos.google.cloud.vmmigration.v1.ICreateCloneJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateCloneJobRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createCloneJob( - request: protos.google.cloud.vmmigration.v1.ICreateCloneJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateCloneJobRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createCloneJob( - request?: protos.google.cloud.vmmigration.v1.ICreateCloneJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.ICreateCloneJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createCloneJob response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createCloneJob request %j', request); - return this.innerApiCalls.createCloneJob(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createCloneJob response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createCloneJob(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createCloneJob response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createCloneJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_clone_job.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateCloneJob_async - */ - async checkCreateCloneJobProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createCloneJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_clone_job.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateCloneJob_async + */ + async checkCreateCloneJobProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.CloneJob, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('createCloneJob long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createCloneJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createCloneJob, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.CloneJob, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Initiates the cancellation of a running clone job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The clone job id - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.cancel_clone_job.js - * region_tag:vmmigration_v1_generated_VmMigration_CancelCloneJob_async - */ + /** + * Initiates the cancellation of a running clone job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The clone job id + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.cancel_clone_job.js + * region_tag:vmmigration_v1_generated_VmMigration_CancelCloneJob_async + */ cancelCloneJob( - request?: protos.google.cloud.vmmigration.v1.ICancelCloneJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.ICancelCloneJobRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCloneJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; cancelCloneJob( - request: protos.google.cloud.vmmigration.v1.ICancelCloneJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICancelCloneJobRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCloneJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; cancelCloneJob( - request: protos.google.cloud.vmmigration.v1.ICancelCloneJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICancelCloneJobRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCloneJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; cancelCloneJob( - request?: protos.google.cloud.vmmigration.v1.ICancelCloneJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.ICancelCloneJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCloneJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCloneJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCloneJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCloneJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('cancelCloneJob response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('cancelCloneJob request %j', request); - return this.innerApiCalls.cancelCloneJob(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('cancelCloneJob response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .cancelCloneJob(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCloneJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('cancelCloneJob response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `cancelCloneJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.cancel_clone_job.js - * region_tag:vmmigration_v1_generated_VmMigration_CancelCloneJob_async - */ - async checkCancelCloneJobProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `cancelCloneJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.cancel_clone_job.js + * region_tag:vmmigration_v1_generated_VmMigration_CancelCloneJob_async + */ + async checkCancelCloneJobProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.CancelCloneJobResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('cancelCloneJob long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.cancelCloneJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.cancelCloneJob, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.CancelCloneJobResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Initiates a Cutover of a specific migrating VM. - * The returned LRO is completed when the cutover job resource is created - * and the job is initiated. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Cutover's parent. - * @param {string} request.cutoverJobId - * Required. The cutover job identifier. - * @param {google.cloud.vmmigration.v1.CutoverJob} request.cutoverJob - * Required. The cutover request body. - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_cutover_job.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateCutoverJob_async - */ + /** + * Initiates a Cutover of a specific migrating VM. + * The returned LRO is completed when the cutover job resource is created + * and the job is initiated. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Cutover's parent. + * @param {string} request.cutoverJobId + * Required. The cutover job identifier. + * @param {google.cloud.vmmigration.v1.CutoverJob} request.cutoverJob + * Required. The cutover request body. + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_cutover_job.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateCutoverJob_async + */ createCutoverJob( - request?: protos.google.cloud.vmmigration.v1.ICreateCutoverJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.ICreateCutoverJobRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ICutoverJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createCutoverJob( - request: protos.google.cloud.vmmigration.v1.ICreateCutoverJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateCutoverJobRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICutoverJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createCutoverJob( - request: protos.google.cloud.vmmigration.v1.ICreateCutoverJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateCutoverJobRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICutoverJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createCutoverJob( - request?: protos.google.cloud.vmmigration.v1.ICreateCutoverJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.ICreateCutoverJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICutoverJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICutoverJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ICutoverJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICutoverJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createCutoverJob response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createCutoverJob request %j', request); - return this.innerApiCalls.createCutoverJob(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createCutoverJob response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createCutoverJob(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.ICutoverJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createCutoverJob response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createCutoverJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_cutover_job.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateCutoverJob_async - */ - async checkCreateCutoverJobProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createCutoverJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_cutover_job.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateCutoverJob_async + */ + async checkCreateCutoverJobProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.CutoverJob, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('createCutoverJob long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createCutoverJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createCutoverJob, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.CutoverJob, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Initiates the cancellation of a running cutover job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The cutover job id - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.cancel_cutover_job.js - * region_tag:vmmigration_v1_generated_VmMigration_CancelCutoverJob_async - */ + /** + * Initiates the cancellation of a running cutover job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The cutover job id + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.cancel_cutover_job.js + * region_tag:vmmigration_v1_generated_VmMigration_CancelCutoverJob_async + */ cancelCutoverJob( - request?: protos.google.cloud.vmmigration.v1.ICancelCutoverJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.ICancelCutoverJobRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCutoverJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; cancelCutoverJob( - request: protos.google.cloud.vmmigration.v1.ICancelCutoverJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICancelCutoverJobRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCutoverJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; cancelCutoverJob( - request: protos.google.cloud.vmmigration.v1.ICancelCutoverJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICancelCutoverJobRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCutoverJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; cancelCutoverJob( - request?: protos.google.cloud.vmmigration.v1.ICancelCutoverJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.ICancelCutoverJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCutoverJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCutoverJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCutoverJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCutoverJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('cancelCutoverJob response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('cancelCutoverJob request %j', request); - return this.innerApiCalls.cancelCutoverJob(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('cancelCutoverJob response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .cancelCutoverJob(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.ICancelCutoverJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('cancelCutoverJob response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `cancelCutoverJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.cancel_cutover_job.js - * region_tag:vmmigration_v1_generated_VmMigration_CancelCutoverJob_async - */ - async checkCancelCutoverJobProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `cancelCutoverJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.cancel_cutover_job.js + * region_tag:vmmigration_v1_generated_VmMigration_CancelCutoverJob_async + */ + async checkCancelCutoverJobProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.CancelCutoverJobResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('cancelCutoverJob long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.cancelCutoverJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.cancelCutoverJob, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.CancelCutoverJobResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Creates a new Group in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Group's parent. - * @param {string} request.groupId - * Required. The group identifier. - * @param {google.cloud.vmmigration.v1.Group} request.group - * Required. The create request body. - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_group.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateGroup_async - */ + /** + * Creates a new Group in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Group's parent. + * @param {string} request.groupId + * Required. The group identifier. + * @param {google.cloud.vmmigration.v1.Group} request.group + * Required. The create request body. + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_group.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateGroup_async + */ createGroup( - request?: protos.google.cloud.vmmigration.v1.ICreateGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.ICreateGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createGroup( - request: protos.google.cloud.vmmigration.v1.ICreateGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createGroup( - request: protos.google.cloud.vmmigration.v1.ICreateGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createGroup( - request?: protos.google.cloud.vmmigration.v1.ICreateGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.ICreateGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createGroup request %j', request); - return this.innerApiCalls.createGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createGroup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_group.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateGroup_async - */ - async checkCreateGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createGroup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_group.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateGroup_async + */ + async checkCreateGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.Group, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('createGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.Group, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single Group. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Field mask is used to specify the fields to be overwritten in the - * Group resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.vmmigration.v1.Group} request.group - * Required. The update request body. - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.update_group.js - * region_tag:vmmigration_v1_generated_VmMigration_UpdateGroup_async - */ + /** + * Updates the parameters of a single Group. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Field mask is used to specify the fields to be overwritten in the + * Group resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.vmmigration.v1.Group} request.group + * Required. The update request body. + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.update_group.js + * region_tag:vmmigration_v1_generated_VmMigration_UpdateGroup_async + */ updateGroup( - request?: protos.google.cloud.vmmigration.v1.IUpdateGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IUpdateGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateGroup( - request: protos.google.cloud.vmmigration.v1.IUpdateGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IUpdateGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateGroup( - request: protos.google.cloud.vmmigration.v1.IUpdateGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IUpdateGroupRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateGroup( - request?: protos.google.cloud.vmmigration.v1.IUpdateGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IUpdateGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'group.name': request.group!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'group.name': request.group!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateGroup request %j', request); - return this.innerApiCalls.updateGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateGroup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.update_group.js - * region_tag:vmmigration_v1_generated_VmMigration_UpdateGroup_async - */ - async checkUpdateGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateGroup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.update_group.js + * region_tag:vmmigration_v1_generated_VmMigration_UpdateGroup_async + */ + async checkUpdateGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.Group, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('updateGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.Group, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Deletes a single Group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Group name. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_group.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteGroup_async - */ + /** + * Deletes a single Group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The Group name. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_group.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteGroup_async + */ deleteGroup( - request?: protos.google.cloud.vmmigration.v1.IDeleteGroupRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IDeleteGroupRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteGroup( - request: protos.google.cloud.vmmigration.v1.IDeleteGroupRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteGroupRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteGroup( - request: protos.google.cloud.vmmigration.v1.IDeleteGroupRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteGroupRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteGroup( - request?: protos.google.cloud.vmmigration.v1.IDeleteGroupRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IDeleteGroupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteGroup response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteGroup request %j', request); - return this.innerApiCalls.deleteGroup(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteGroup response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteGroup(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteGroup response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteGroup()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_group.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteGroup_async - */ - async checkDeleteGroupProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteGroup()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_group.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteGroup_async + */ + async checkDeleteGroupProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('deleteGroup long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteGroup, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteGroup, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Adds a MigratingVm to a Group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.group - * Required. The full path name of the Group to add to. - * @param {string} request.migratingVm - * The full path name of the MigratingVm to add. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.add_group_migration.js - * region_tag:vmmigration_v1_generated_VmMigration_AddGroupMigration_async - */ + /** + * Adds a MigratingVm to a Group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.group + * Required. The full path name of the Group to add to. + * @param {string} request.migratingVm + * The full path name of the MigratingVm to add. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.add_group_migration.js + * region_tag:vmmigration_v1_generated_VmMigration_AddGroupMigration_async + */ addGroupMigration( - request?: protos.google.cloud.vmmigration.v1.IAddGroupMigrationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IAddGroupMigrationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IAddGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; addGroupMigration( - request: protos.google.cloud.vmmigration.v1.IAddGroupMigrationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IAddGroupMigrationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IAddGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; addGroupMigration( - request: protos.google.cloud.vmmigration.v1.IAddGroupMigrationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IAddGroupMigrationRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IAddGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; addGroupMigration( - request?: protos.google.cloud.vmmigration.v1.IAddGroupMigrationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IAddGroupMigrationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IAddGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IAddGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IAddGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'group': request.group ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + group: request.group ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IAddGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('addGroupMigration response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('addGroupMigration request %j', request); - return this.innerApiCalls.addGroupMigration(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('addGroupMigration response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .addGroupMigration(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IAddGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('addGroupMigration response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `addGroupMigration()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.add_group_migration.js - * region_tag:vmmigration_v1_generated_VmMigration_AddGroupMigration_async - */ - async checkAddGroupMigrationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `addGroupMigration()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.add_group_migration.js + * region_tag:vmmigration_v1_generated_VmMigration_AddGroupMigration_async + */ + async checkAddGroupMigrationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.AddGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('addGroupMigration long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.addGroupMigration, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.addGroupMigration, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.AddGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Removes a MigratingVm from a Group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.group - * Required. The name of the Group. - * @param {string} request.migratingVm - * The MigratingVm to remove. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.remove_group_migration.js - * region_tag:vmmigration_v1_generated_VmMigration_RemoveGroupMigration_async - */ + /** + * Removes a MigratingVm from a Group. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.group + * Required. The name of the Group. + * @param {string} request.migratingVm + * The MigratingVm to remove. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.remove_group_migration.js + * region_tag:vmmigration_v1_generated_VmMigration_RemoveGroupMigration_async + */ removeGroupMigration( - request?: protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; removeGroupMigration( - request: protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; removeGroupMigration( - request: protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; removeGroupMigration( - request?: protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'group': request.group ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + group: request.group ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('removeGroupMigration response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('removeGroupMigration request %j', request); - return this.innerApiCalls.removeGroupMigration(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('removeGroupMigration response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .removeGroupMigration(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('removeGroupMigration response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `removeGroupMigration()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.remove_group_migration.js - * region_tag:vmmigration_v1_generated_VmMigration_RemoveGroupMigration_async - */ - async checkRemoveGroupMigrationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `removeGroupMigration()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.remove_group_migration.js + * region_tag:vmmigration_v1_generated_VmMigration_RemoveGroupMigration_async + */ + async checkRemoveGroupMigrationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.RemoveGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('removeGroupMigration long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.removeGroupMigration, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.removeGroupMigration, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.RemoveGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Creates a new TargetProject in a given project. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The TargetProject's parent. - * @param {string} request.targetProjectId - * Required. The target_project identifier. - * @param {google.cloud.vmmigration.v1.TargetProject} request.targetProject - * Required. The create request body. - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_target_project.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateTargetProject_async - */ + /** + * Creates a new TargetProject in a given project. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The TargetProject's parent. + * @param {string} request.targetProjectId + * Required. The target_project identifier. + * @param {google.cloud.vmmigration.v1.TargetProject} request.targetProject + * Required. The create request body. + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_target_project.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateTargetProject_async + */ createTargetProject( - request?: protos.google.cloud.vmmigration.v1.ICreateTargetProjectRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.ICreateTargetProjectRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createTargetProject( - request: protos.google.cloud.vmmigration.v1.ICreateTargetProjectRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateTargetProjectRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createTargetProject( - request: protos.google.cloud.vmmigration.v1.ICreateTargetProjectRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateTargetProjectRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createTargetProject( - request?: protos.google.cloud.vmmigration.v1.ICreateTargetProjectRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.ICreateTargetProjectRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createTargetProject response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createTargetProject request %j', request); - return this.innerApiCalls.createTargetProject(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createTargetProject response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createTargetProject(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createTargetProject response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createTargetProject()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_target_project.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateTargetProject_async - */ - async checkCreateTargetProjectProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createTargetProject()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_target_project.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateTargetProject_async + */ + async checkCreateTargetProjectProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.TargetProject, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('createTargetProject long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createTargetProject, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createTargetProject, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.TargetProject, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single TargetProject. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Field mask is used to specify the fields to be overwritten in the - * TargetProject resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.vmmigration.v1.TargetProject} request.targetProject - * Required. The update request body. - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.update_target_project.js - * region_tag:vmmigration_v1_generated_VmMigration_UpdateTargetProject_async - */ + /** + * Updates the parameters of a single TargetProject. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Field mask is used to specify the fields to be overwritten in the + * TargetProject resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.vmmigration.v1.TargetProject} request.targetProject + * Required. The update request body. + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.update_target_project.js + * region_tag:vmmigration_v1_generated_VmMigration_UpdateTargetProject_async + */ updateTargetProject( - request?: protos.google.cloud.vmmigration.v1.IUpdateTargetProjectRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IUpdateTargetProjectRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateTargetProject( - request: protos.google.cloud.vmmigration.v1.IUpdateTargetProjectRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IUpdateTargetProjectRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateTargetProject( - request: protos.google.cloud.vmmigration.v1.IUpdateTargetProjectRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IUpdateTargetProjectRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateTargetProject( - request?: protos.google.cloud.vmmigration.v1.IUpdateTargetProjectRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IUpdateTargetProjectRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'target_project.name': request.targetProject!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'target_project.name': request.targetProject!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateTargetProject response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateTargetProject request %j', request); - return this.innerApiCalls.updateTargetProject(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateTargetProject response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateTargetProject(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateTargetProject response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateTargetProject()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.update_target_project.js - * region_tag:vmmigration_v1_generated_VmMigration_UpdateTargetProject_async - */ - async checkUpdateTargetProjectProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateTargetProject()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.update_target_project.js + * region_tag:vmmigration_v1_generated_VmMigration_UpdateTargetProject_async + */ + async checkUpdateTargetProjectProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.TargetProject, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('updateTargetProject long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateTargetProject, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateTargetProject, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.TargetProject, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Deletes a single TargetProject. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The TargetProject name. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_target_project.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteTargetProject_async - */ + /** + * Deletes a single TargetProject. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The TargetProject name. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_target_project.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteTargetProject_async + */ deleteTargetProject( - request?: protos.google.cloud.vmmigration.v1.IDeleteTargetProjectRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IDeleteTargetProjectRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteTargetProject( - request: protos.google.cloud.vmmigration.v1.IDeleteTargetProjectRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteTargetProjectRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteTargetProject( - request: protos.google.cloud.vmmigration.v1.IDeleteTargetProjectRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteTargetProjectRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteTargetProject( - request?: protos.google.cloud.vmmigration.v1.IDeleteTargetProjectRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IDeleteTargetProjectRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteTargetProject response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteTargetProject request %j', request); - return this.innerApiCalls.deleteTargetProject(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteTargetProject response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteTargetProject(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteTargetProject response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteTargetProject()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_target_project.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteTargetProject_async - */ - async checkDeleteTargetProjectProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteTargetProject()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_target_project.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteTargetProject_async + */ + async checkDeleteTargetProjectProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('deleteTargetProject long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteTargetProject, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteTargetProject, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Creates a new ImageImport in a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The ImageImport's parent. - * @param {string} request.imageImportId - * Required. The image import identifier. - * This value maximum length is 63 characters, and valid characters are - * /{@link protos.0-9|a-z}-/. It must start with an english letter and must not end with a - * hyphen. - * @param {google.cloud.vmmigration.v1.ImageImport} request.imageImport - * Required. The create request body. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_image_import.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateImageImport_async - */ + /** + * Creates a new ImageImport in a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The ImageImport's parent. + * @param {string} request.imageImportId + * Required. The image import identifier. + * This value maximum length is 63 characters, and valid characters are + * /{@link protos.0-9|a-z}-/. It must start with an english letter and must not end with a + * hyphen. + * @param {google.cloud.vmmigration.v1.ImageImport} request.imageImport + * Required. The create request body. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_image_import.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateImageImport_async + */ createImageImport( - request?: protos.google.cloud.vmmigration.v1.ICreateImageImportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.ICreateImageImportRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IImageImport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createImageImport( - request: protos.google.cloud.vmmigration.v1.ICreateImageImportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateImageImportRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IImageImport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createImageImport( - request: protos.google.cloud.vmmigration.v1.ICreateImageImportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateImageImportRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IImageImport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createImageImport( - request?: protos.google.cloud.vmmigration.v1.ICreateImageImportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.ICreateImageImportRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IImageImport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IImageImport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IImageImport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IImageImport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createImageImport response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createImageImport request %j', request); - return this.innerApiCalls.createImageImport(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createImageImport response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createImageImport(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IImageImport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createImageImport response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createImageImport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_image_import.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateImageImport_async - */ - async checkCreateImageImportProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createImageImport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_image_import.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateImageImport_async + */ + async checkCreateImageImportProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.ImageImport, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('createImageImport long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createImageImport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createImageImport, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.ImageImport, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Deletes a single ImageImport. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The ImageImport name. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and t - * he request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_image_import.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteImageImport_async - */ + /** + * Deletes a single ImageImport. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The ImageImport name. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and t + * he request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_image_import.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteImageImport_async + */ deleteImageImport( - request?: protos.google.cloud.vmmigration.v1.IDeleteImageImportRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IDeleteImageImportRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteImageImport( - request: protos.google.cloud.vmmigration.v1.IDeleteImageImportRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteImageImportRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteImageImport( - request: protos.google.cloud.vmmigration.v1.IDeleteImageImportRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteImageImportRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteImageImport( - request?: protos.google.cloud.vmmigration.v1.IDeleteImageImportRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IDeleteImageImportRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteImageImport response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteImageImport request %j', request); - return this.innerApiCalls.deleteImageImport(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteImageImport response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteImageImport(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteImageImport response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteImageImport()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_image_import.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteImageImport_async - */ - async checkDeleteImageImportProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteImageImport()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_image_import.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteImageImport_async + */ + async checkDeleteImageImportProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('deleteImageImport long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteImageImport, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteImageImport, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Initiates the cancellation of a running ImageImportJob. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The image import job id. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.cancel_image_import_job.js - * region_tag:vmmigration_v1_generated_VmMigration_CancelImageImportJob_async - */ + /** + * Initiates the cancellation of a running ImageImportJob. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The image import job id. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.cancel_image_import_job.js + * region_tag:vmmigration_v1_generated_VmMigration_CancelImageImportJob_async + */ cancelImageImportJob( - request?: protos.google.cloud.vmmigration.v1.ICancelImageImportJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.ICancelImageImportJobRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ICancelImageImportJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; cancelImageImportJob( - request: protos.google.cloud.vmmigration.v1.ICancelImageImportJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICancelImageImportJobRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelImageImportJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; cancelImageImportJob( - request: protos.google.cloud.vmmigration.v1.ICancelImageImportJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICancelImageImportJobRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelImageImportJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; cancelImageImportJob( - request?: protos.google.cloud.vmmigration.v1.ICancelImageImportJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.ICancelImageImportJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelImageImportJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelImageImportJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ICancelImageImportJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelImageImportJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('cancelImageImportJob response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('cancelImageImportJob request %j', request); - return this.innerApiCalls.cancelImageImportJob(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('cancelImageImportJob response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .cancelImageImportJob(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.ICancelImageImportJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('cancelImageImportJob response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `cancelImageImportJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.cancel_image_import_job.js - * region_tag:vmmigration_v1_generated_VmMigration_CancelImageImportJob_async - */ - async checkCancelImageImportJobProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `cancelImageImportJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.cancel_image_import_job.js + * region_tag:vmmigration_v1_generated_VmMigration_CancelImageImportJob_async + */ + async checkCancelImageImportJobProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.CancelImageImportJobResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('cancelImageImportJob long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.cancelImageImportJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.cancelImageImportJob, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.CancelImageImportJobResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Creates a new disk migration job in a given Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The DiskMigrationJob's parent. - * @param {string} request.diskMigrationJobId - * Required. The DiskMigrationJob identifier. - * The maximum length of this value is 63 characters. - * Valid characters are lower case Latin letters, digits and hyphen. - * It must start with a Latin letter and must not end with a hyphen. - * @param {google.cloud.vmmigration.v1.DiskMigrationJob} request.diskMigrationJob - * Required. The create request body. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request timed out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_disk_migration_job.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateDiskMigrationJob_async - */ + /** + * Creates a new disk migration job in a given Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The DiskMigrationJob's parent. + * @param {string} request.diskMigrationJobId + * Required. The DiskMigrationJob identifier. + * The maximum length of this value is 63 characters. + * Valid characters are lower case Latin letters, digits and hyphen. + * It must start with a Latin letter and must not end with a hyphen. + * @param {google.cloud.vmmigration.v1.DiskMigrationJob} request.diskMigrationJob + * Required. The create request body. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request timed out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_disk_migration_job.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateDiskMigrationJob_async + */ createDiskMigrationJob( - request?: protos.google.cloud.vmmigration.v1.ICreateDiskMigrationJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.ICreateDiskMigrationJobRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createDiskMigrationJob( - request: protos.google.cloud.vmmigration.v1.ICreateDiskMigrationJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateDiskMigrationJobRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createDiskMigrationJob( - request: protos.google.cloud.vmmigration.v1.ICreateDiskMigrationJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICreateDiskMigrationJobRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createDiskMigrationJob( - request?: protos.google.cloud.vmmigration.v1.ICreateDiskMigrationJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.ICreateDiskMigrationJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createDiskMigrationJob response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createDiskMigrationJob request %j', request); - return this.innerApiCalls.createDiskMigrationJob(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createDiskMigrationJob response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createDiskMigrationJob(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createDiskMigrationJob response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createDiskMigrationJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.create_disk_migration_job.js - * region_tag:vmmigration_v1_generated_VmMigration_CreateDiskMigrationJob_async - */ - async checkCreateDiskMigrationJobProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createDiskMigrationJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.create_disk_migration_job.js + * region_tag:vmmigration_v1_generated_VmMigration_CreateDiskMigrationJob_async + */ + async checkCreateDiskMigrationJobProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.DiskMigrationJob, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('createDiskMigrationJob long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createDiskMigrationJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createDiskMigrationJob, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.DiskMigrationJob, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single DiskMigrationJob. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * DiskMigrationJob resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask, then a mask equivalent to all fields that are - * populated (have a non-empty value), will be implied. - * @param {google.cloud.vmmigration.v1.DiskMigrationJob} request.diskMigrationJob - * Required. The update request body. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request timed out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.update_disk_migration_job.js - * region_tag:vmmigration_v1_generated_VmMigration_UpdateDiskMigrationJob_async - */ + /** + * Updates the parameters of a single DiskMigrationJob. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * DiskMigrationJob resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask, then a mask equivalent to all fields that are + * populated (have a non-empty value), will be implied. + * @param {google.cloud.vmmigration.v1.DiskMigrationJob} request.diskMigrationJob + * Required. The update request body. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request timed out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.update_disk_migration_job.js + * region_tag:vmmigration_v1_generated_VmMigration_UpdateDiskMigrationJob_async + */ updateDiskMigrationJob( - request?: protos.google.cloud.vmmigration.v1.IUpdateDiskMigrationJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IUpdateDiskMigrationJobRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateDiskMigrationJob( - request: protos.google.cloud.vmmigration.v1.IUpdateDiskMigrationJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IUpdateDiskMigrationJobRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateDiskMigrationJob( - request: protos.google.cloud.vmmigration.v1.IUpdateDiskMigrationJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IUpdateDiskMigrationJobRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateDiskMigrationJob( - request?: protos.google.cloud.vmmigration.v1.IUpdateDiskMigrationJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IUpdateDiskMigrationJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'disk_migration_job.name': request.diskMigrationJob!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'disk_migration_job.name': request.diskMigrationJob!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateDiskMigrationJob response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateDiskMigrationJob request %j', request); - return this.innerApiCalls.updateDiskMigrationJob(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateDiskMigrationJob response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateDiskMigrationJob(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateDiskMigrationJob response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateDiskMigrationJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.update_disk_migration_job.js - * region_tag:vmmigration_v1_generated_VmMigration_UpdateDiskMigrationJob_async - */ - async checkUpdateDiskMigrationJobProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateDiskMigrationJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.update_disk_migration_job.js + * region_tag:vmmigration_v1_generated_VmMigration_UpdateDiskMigrationJob_async + */ + async checkUpdateDiskMigrationJobProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.DiskMigrationJob, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('updateDiskMigrationJob long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDiskMigrationJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateDiskMigrationJob, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.DiskMigrationJob, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Deletes a single DiskMigrationJob. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DiskMigrationJob. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_disk_migration_job.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteDiskMigrationJob_async - */ + /** + * Deletes a single DiskMigrationJob. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the DiskMigrationJob. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_disk_migration_job.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteDiskMigrationJob_async + */ deleteDiskMigrationJob( - request?: protos.google.cloud.vmmigration.v1.IDeleteDiskMigrationJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IDeleteDiskMigrationJobRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteDiskMigrationJob( - request: protos.google.cloud.vmmigration.v1.IDeleteDiskMigrationJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteDiskMigrationJobRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteDiskMigrationJob( - request: protos.google.cloud.vmmigration.v1.IDeleteDiskMigrationJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IDeleteDiskMigrationJobRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteDiskMigrationJob( - request?: protos.google.cloud.vmmigration.v1.IDeleteDiskMigrationJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IDeleteDiskMigrationJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteDiskMigrationJob response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteDiskMigrationJob request %j', request); - return this.innerApiCalls.deleteDiskMigrationJob(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteDiskMigrationJob response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteDiskMigrationJob(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteDiskMigrationJob response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteDiskMigrationJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.delete_disk_migration_job.js - * region_tag:vmmigration_v1_generated_VmMigration_DeleteDiskMigrationJob_async - */ - async checkDeleteDiskMigrationJobProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteDiskMigrationJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.delete_disk_migration_job.js + * region_tag:vmmigration_v1_generated_VmMigration_DeleteDiskMigrationJob_async + */ + async checkDeleteDiskMigrationJobProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('deleteDiskMigrationJob long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteDiskMigrationJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteDiskMigrationJob, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Runs the disk migration job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DiskMigrationJob. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.run_disk_migration_job.js - * region_tag:vmmigration_v1_generated_VmMigration_RunDiskMigrationJob_async - */ + /** + * Runs the disk migration job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the DiskMigrationJob. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.run_disk_migration_job.js + * region_tag:vmmigration_v1_generated_VmMigration_RunDiskMigrationJob_async + */ runDiskMigrationJob( - request?: protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; runDiskMigrationJob( - request: protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; runDiskMigrationJob( - request: protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; runDiskMigrationJob( - request?: protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('runDiskMigrationJob response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('runDiskMigrationJob request %j', request); - return this.innerApiCalls.runDiskMigrationJob(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('runDiskMigrationJob response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .runDiskMigrationJob(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('runDiskMigrationJob response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `runDiskMigrationJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.run_disk_migration_job.js - * region_tag:vmmigration_v1_generated_VmMigration_RunDiskMigrationJob_async - */ - async checkRunDiskMigrationJobProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `runDiskMigrationJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.run_disk_migration_job.js + * region_tag:vmmigration_v1_generated_VmMigration_RunDiskMigrationJob_async + */ + async checkRunDiskMigrationJobProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.RunDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('runDiskMigrationJob long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runDiskMigrationJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.runDiskMigrationJob, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.RunDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; } -/** - * Cancels the disk migration job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DiskMigrationJob. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.cancel_disk_migration_job.js - * region_tag:vmmigration_v1_generated_VmMigration_CancelDiskMigrationJob_async - */ + /** + * Cancels the disk migration job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the DiskMigrationJob. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.cancel_disk_migration_job.js + * region_tag:vmmigration_v1_generated_VmMigration_CancelDiskMigrationJob_async + */ cancelDiskMigrationJob( - request?: protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; cancelDiskMigrationJob( - request: protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; cancelDiskMigrationJob( - request: protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; cancelDiskMigrationJob( - request?: protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('cancelDiskMigrationJob response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('cancelDiskMigrationJob request %j', request); - return this.innerApiCalls.cancelDiskMigrationJob(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('cancelDiskMigrationJob response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .cancelDiskMigrationJob(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('cancelDiskMigrationJob response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `cancelDiskMigrationJob()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.cancel_disk_migration_job.js - * region_tag:vmmigration_v1_generated_VmMigration_CancelDiskMigrationJob_async - */ - async checkCancelDiskMigrationJobProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `cancelDiskMigrationJob()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.cancel_disk_migration_job.js + * region_tag:vmmigration_v1_generated_VmMigration_CancelDiskMigrationJob_async + */ + async checkCancelDiskMigrationJobProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmmigration.v1.CancelDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + > + > { this._log.info('cancelDiskMigrationJob long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.cancelDiskMigrationJob, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Sources in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of sources. - * @param {number} [request.pageSize] - * Optional. The maximum number of sources to return. The service may return - * fewer than this value. If unspecified, at most 500 sources will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListSources` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListSources` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @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 Array of {@link protos.google.cloud.vmmigration.v1.Source|Source}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.cancelDiskMigrationJob, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmmigration.v1.CancelDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.OperationMetadata + >; + } + /** + * Lists Sources in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of sources. + * @param {number} [request.pageSize] + * Optional. The maximum number of sources to return. The service may return + * fewer than this value. If unspecified, at most 500 sources will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListSources` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListSources` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @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 Array of {@link protos.google.cloud.vmmigration.v1.Source|Source}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listSources( - request?: protos.google.cloud.vmmigration.v1.IListSourcesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.ISource[], - protos.google.cloud.vmmigration.v1.IListSourcesRequest|null, - protos.google.cloud.vmmigration.v1.IListSourcesResponse - ]>; + request?: protos.google.cloud.vmmigration.v1.IListSourcesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ISource[], + protos.google.cloud.vmmigration.v1.IListSourcesRequest | null, + protos.google.cloud.vmmigration.v1.IListSourcesResponse, + ] + >; listSources( - request: protos.google.cloud.vmmigration.v1.IListSourcesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListSourcesRequest, - protos.google.cloud.vmmigration.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ISource>): void; + request: protos.google.cloud.vmmigration.v1.IListSourcesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListSourcesRequest, + | protos.google.cloud.vmmigration.v1.IListSourcesResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ISource + >, + ): void; listSources( - request: protos.google.cloud.vmmigration.v1.IListSourcesRequest, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListSourcesRequest, - protos.google.cloud.vmmigration.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ISource>): void; + request: protos.google.cloud.vmmigration.v1.IListSourcesRequest, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListSourcesRequest, + | protos.google.cloud.vmmigration.v1.IListSourcesResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ISource + >, + ): void; listSources( - request?: protos.google.cloud.vmmigration.v1.IListSourcesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmmigration.v1.IListSourcesRequest, - protos.google.cloud.vmmigration.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ISource>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmmigration.v1.IListSourcesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmmigration.v1.IListSourcesRequest, - protos.google.cloud.vmmigration.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ISource>): - Promise<[ - protos.google.cloud.vmmigration.v1.ISource[], - protos.google.cloud.vmmigration.v1.IListSourcesRequest|null, - protos.google.cloud.vmmigration.v1.IListSourcesResponse - ]>|void { + | protos.google.cloud.vmmigration.v1.IListSourcesResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ISource + >, + callback?: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListSourcesRequest, + | protos.google.cloud.vmmigration.v1.IListSourcesResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ISource + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ISource[], + protos.google.cloud.vmmigration.v1.IListSourcesRequest | null, + protos.google.cloud.vmmigration.v1.IListSourcesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListSourcesRequest, - protos.google.cloud.vmmigration.v1.IListSourcesResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ISource>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmmigration.v1.IListSourcesRequest, + | protos.google.cloud.vmmigration.v1.IListSourcesResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ISource + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listSources values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -6324,225 +9442,254 @@ export class VmMigrationClient { this._log.info('listSources request %j', request); return this.innerApiCalls .listSources(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmmigration.v1.ISource[], - protos.google.cloud.vmmigration.v1.IListSourcesRequest|null, - protos.google.cloud.vmmigration.v1.IListSourcesResponse - ]) => { - this._log.info('listSources values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmmigration.v1.ISource[], + protos.google.cloud.vmmigration.v1.IListSourcesRequest | null, + protos.google.cloud.vmmigration.v1.IListSourcesResponse, + ]) => { + this._log.info('listSources values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listSources`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of sources. - * @param {number} [request.pageSize] - * Optional. The maximum number of sources to return. The service may return - * fewer than this value. If unspecified, at most 500 sources will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListSources` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListSources` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.Source|Source} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listSources`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of sources. + * @param {number} [request.pageSize] + * Optional. The maximum number of sources to return. The service may return + * fewer than this value. If unspecified, at most 500 sources will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListSources` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListSources` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.Source|Source} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listSourcesStream( - request?: protos.google.cloud.vmmigration.v1.IListSourcesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmmigration.v1.IListSourcesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSources']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSources stream %j', request); return this.descriptors.page.listSources.createStream( this.innerApiCalls.listSources as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listSources`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of sources. - * @param {number} [request.pageSize] - * Optional. The maximum number of sources to return. The service may return - * fewer than this value. If unspecified, at most 500 sources will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListSources` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListSources` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmmigration.v1.Source|Source}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.list_sources.js - * region_tag:vmmigration_v1_generated_VmMigration_ListSources_async - */ + /** + * Equivalent to `listSources`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of sources. + * @param {number} [request.pageSize] + * Optional. The maximum number of sources to return. The service may return + * fewer than this value. If unspecified, at most 500 sources will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListSources` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListSources` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmmigration.v1.Source|Source}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.list_sources.js + * region_tag:vmmigration_v1_generated_VmMigration_ListSources_async + */ listSourcesAsync( - request?: protos.google.cloud.vmmigration.v1.IListSourcesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmmigration.v1.IListSourcesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSources']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSources iterate %j', request); return this.descriptors.page.listSources.asyncIterate( this.innerApiCalls['listSources'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * List remote source's inventory of storage resources. - * The remote source is another cloud vendor (e.g. AWS, Azure). - * The inventory describes the list of existing storage resources in that - * source. Note that this operation lists the resources on the remote source, - * as opposed to listing the MigratingVms resources in the vmmigration - * service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.source - * Required. The name of the Source. - * @param {google.cloud.vmmigration.v1.FetchStorageInventoryRequest.StorageType} request.type - * Required. The type of the storage inventory to fetch. - * @param {boolean} [request.forceRefresh] - * Optional. If this flag is set to true, the source will be queried instead - * of using cached results. Using this flag will make the call slower. - * @param {number} [request.pageSize] - * Optional. The maximum number of VMs to return. The service may return - * fewer than this value. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `FetchStorageInventory` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `FetchStorageInventory` must match the call - * that provided the page token. - * @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 Array of {@link protos.google.cloud.vmmigration.v1.SourceStorageResource|SourceStorageResource}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `fetchStorageInventoryAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * List remote source's inventory of storage resources. + * The remote source is another cloud vendor (e.g. AWS, Azure). + * The inventory describes the list of existing storage resources in that + * source. Note that this operation lists the resources on the remote source, + * as opposed to listing the MigratingVms resources in the vmmigration + * service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.source + * Required. The name of the Source. + * @param {google.cloud.vmmigration.v1.FetchStorageInventoryRequest.StorageType} request.type + * Required. The type of the storage inventory to fetch. + * @param {boolean} [request.forceRefresh] + * Optional. If this flag is set to true, the source will be queried instead + * of using cached results. Using this flag will make the call slower. + * @param {number} [request.pageSize] + * Optional. The maximum number of VMs to return. The service may return + * fewer than this value. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `FetchStorageInventory` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `FetchStorageInventory` must match the call + * that provided the page token. + * @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 Array of {@link protos.google.cloud.vmmigration.v1.SourceStorageResource|SourceStorageResource}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `fetchStorageInventoryAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ fetchStorageInventory( - request?: protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.ISourceStorageResource[], - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest|null, - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse - ]>; + request?: protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ISourceStorageResource[], + protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest | null, + protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse, + ] + >; fetchStorageInventory( - request: protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ISourceStorageResource>): void; + request: protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, + | protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ISourceStorageResource + >, + ): void; fetchStorageInventory( - request: protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ISourceStorageResource>): void; + request: protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, + | protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ISourceStorageResource + >, + ): void; fetchStorageInventory( - request?: protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ISourceStorageResource>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ISourceStorageResource>): - Promise<[ - protos.google.cloud.vmmigration.v1.ISourceStorageResource[], - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest|null, - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse - ]>|void { + | protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ISourceStorageResource + >, + callback?: PaginationCallback< + protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, + | protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ISourceStorageResource + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ISourceStorageResource[], + protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest | null, + protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'source': request.source ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + source: request.source ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ISourceStorageResource>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, + | protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ISourceStorageResource + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('fetchStorageInventory values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -6551,221 +9698,250 @@ export class VmMigrationClient { this._log.info('fetchStorageInventory request %j', request); return this.innerApiCalls .fetchStorageInventory(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmmigration.v1.ISourceStorageResource[], - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest|null, - protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse - ]) => { - this._log.info('fetchStorageInventory values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmmigration.v1.ISourceStorageResource[], + protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest | null, + protos.google.cloud.vmmigration.v1.IFetchStorageInventoryResponse, + ]) => { + this._log.info('fetchStorageInventory values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `fetchStorageInventory`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.source - * Required. The name of the Source. - * @param {google.cloud.vmmigration.v1.FetchStorageInventoryRequest.StorageType} request.type - * Required. The type of the storage inventory to fetch. - * @param {boolean} [request.forceRefresh] - * Optional. If this flag is set to true, the source will be queried instead - * of using cached results. Using this flag will make the call slower. - * @param {number} [request.pageSize] - * Optional. The maximum number of VMs to return. The service may return - * fewer than this value. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `FetchStorageInventory` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `FetchStorageInventory` must match the call - * that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.SourceStorageResource|SourceStorageResource} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `fetchStorageInventoryAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `fetchStorageInventory`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.source + * Required. The name of the Source. + * @param {google.cloud.vmmigration.v1.FetchStorageInventoryRequest.StorageType} request.type + * Required. The type of the storage inventory to fetch. + * @param {boolean} [request.forceRefresh] + * Optional. If this flag is set to true, the source will be queried instead + * of using cached results. Using this flag will make the call slower. + * @param {number} [request.pageSize] + * Optional. The maximum number of VMs to return. The service may return + * fewer than this value. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `FetchStorageInventory` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `FetchStorageInventory` must match the call + * that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.SourceStorageResource|SourceStorageResource} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `fetchStorageInventoryAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ fetchStorageInventoryStream( - request?: protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'source': request.source ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + source: request.source ?? '', + }); const defaultCallSettings = this._defaults['fetchStorageInventory']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('fetchStorageInventory stream %j', request); return this.descriptors.page.fetchStorageInventory.createStream( this.innerApiCalls.fetchStorageInventory as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `fetchStorageInventory`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.source - * Required. The name of the Source. - * @param {google.cloud.vmmigration.v1.FetchStorageInventoryRequest.StorageType} request.type - * Required. The type of the storage inventory to fetch. - * @param {boolean} [request.forceRefresh] - * Optional. If this flag is set to true, the source will be queried instead - * of using cached results. Using this flag will make the call slower. - * @param {number} [request.pageSize] - * Optional. The maximum number of VMs to return. The service may return - * fewer than this value. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `FetchStorageInventory` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `FetchStorageInventory` must match the call - * that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmmigration.v1.SourceStorageResource|SourceStorageResource}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.fetch_storage_inventory.js - * region_tag:vmmigration_v1_generated_VmMigration_FetchStorageInventory_async - */ + /** + * Equivalent to `fetchStorageInventory`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.source + * Required. The name of the Source. + * @param {google.cloud.vmmigration.v1.FetchStorageInventoryRequest.StorageType} request.type + * Required. The type of the storage inventory to fetch. + * @param {boolean} [request.forceRefresh] + * Optional. If this flag is set to true, the source will be queried instead + * of using cached results. Using this flag will make the call slower. + * @param {number} [request.pageSize] + * Optional. The maximum number of VMs to return. The service may return + * fewer than this value. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `FetchStorageInventory` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `FetchStorageInventory` must match the call + * that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmmigration.v1.SourceStorageResource|SourceStorageResource}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.fetch_storage_inventory.js + * region_tag:vmmigration_v1_generated_VmMigration_FetchStorageInventory_async + */ fetchStorageInventoryAsync( - request?: protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmmigration.v1.IFetchStorageInventoryRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'source': request.source ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + source: request.source ?? '', + }); const defaultCallSettings = this._defaults['fetchStorageInventory']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('fetchStorageInventory iterate %j', request); return this.descriptors.page.fetchStorageInventory.asyncIterate( this.innerApiCalls['fetchStorageInventory'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Utilization Reports of the given Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Utilization Reports parent. - * @param {google.cloud.vmmigration.v1.UtilizationReportView} [request.view] - * Optional. The level of details of each report. - * Defaults to BASIC. - * @param {number} [request.pageSize] - * Optional. The maximum number of reports to return. The service may return - * fewer than this value. If unspecified, at most 500 reports will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListUtilizationReports` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListUtilizationReports` - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @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 Array of {@link protos.google.cloud.vmmigration.v1.UtilizationReport|UtilizationReport}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listUtilizationReportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Utilization Reports of the given Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Utilization Reports parent. + * @param {google.cloud.vmmigration.v1.UtilizationReportView} [request.view] + * Optional. The level of details of each report. + * Defaults to BASIC. + * @param {number} [request.pageSize] + * Optional. The maximum number of reports to return. The service may return + * fewer than this value. If unspecified, at most 500 reports will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListUtilizationReports` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListUtilizationReports` + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @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 Array of {@link protos.google.cloud.vmmigration.v1.UtilizationReport|UtilizationReport}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listUtilizationReportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listUtilizationReports( - request?: protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IUtilizationReport[], - protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest|null, - protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse - ]>; + request?: protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IUtilizationReport[], + protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest | null, + protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse, + ] + >; listUtilizationReports( - request: protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, - protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IUtilizationReport>): void; + request: protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, + | protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IUtilizationReport + >, + ): void; listUtilizationReports( - request: protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, - protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IUtilizationReport>): void; + request: protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, + | protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IUtilizationReport + >, + ): void; listUtilizationReports( - request?: protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, - protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IUtilizationReport>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, - protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IUtilizationReport>): - Promise<[ - protos.google.cloud.vmmigration.v1.IUtilizationReport[], - protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest|null, - protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse - ]>|void { + | protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IUtilizationReport + >, + callback?: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, + | protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IUtilizationReport + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IUtilizationReport[], + protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest | null, + protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, - protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IUtilizationReport>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, + | protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IUtilizationReport + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listUtilizationReports values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -6774,229 +9950,258 @@ export class VmMigrationClient { this._log.info('listUtilizationReports request %j', request); return this.innerApiCalls .listUtilizationReports(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmmigration.v1.IUtilizationReport[], - protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest|null, - protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse - ]) => { - this._log.info('listUtilizationReports values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmmigration.v1.IUtilizationReport[], + protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest | null, + protos.google.cloud.vmmigration.v1.IListUtilizationReportsResponse, + ]) => { + this._log.info('listUtilizationReports values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listUtilizationReports`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Utilization Reports parent. - * @param {google.cloud.vmmigration.v1.UtilizationReportView} [request.view] - * Optional. The level of details of each report. - * Defaults to BASIC. - * @param {number} [request.pageSize] - * Optional. The maximum number of reports to return. The service may return - * fewer than this value. If unspecified, at most 500 reports will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListUtilizationReports` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListUtilizationReports` - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.UtilizationReport|UtilizationReport} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listUtilizationReportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listUtilizationReports`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Utilization Reports parent. + * @param {google.cloud.vmmigration.v1.UtilizationReportView} [request.view] + * Optional. The level of details of each report. + * Defaults to BASIC. + * @param {number} [request.pageSize] + * Optional. The maximum number of reports to return. The service may return + * fewer than this value. If unspecified, at most 500 reports will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListUtilizationReports` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListUtilizationReports` + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.UtilizationReport|UtilizationReport} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listUtilizationReportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listUtilizationReportsStream( - request?: protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listUtilizationReports']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listUtilizationReports stream %j', request); return this.descriptors.page.listUtilizationReports.createStream( this.innerApiCalls.listUtilizationReports as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listUtilizationReports`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The Utilization Reports parent. - * @param {google.cloud.vmmigration.v1.UtilizationReportView} [request.view] - * Optional. The level of details of each report. - * Defaults to BASIC. - * @param {number} [request.pageSize] - * Optional. The maximum number of reports to return. The service may return - * fewer than this value. If unspecified, at most 500 reports will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListUtilizationReports` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListUtilizationReports` - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmmigration.v1.UtilizationReport|UtilizationReport}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.list_utilization_reports.js - * region_tag:vmmigration_v1_generated_VmMigration_ListUtilizationReports_async - */ + /** + * Equivalent to `listUtilizationReports`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The Utilization Reports parent. + * @param {google.cloud.vmmigration.v1.UtilizationReportView} [request.view] + * Optional. The level of details of each report. + * Defaults to BASIC. + * @param {number} [request.pageSize] + * Optional. The maximum number of reports to return. The service may return + * fewer than this value. If unspecified, at most 500 reports will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListUtilizationReports` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListUtilizationReports` + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmmigration.v1.UtilizationReport|UtilizationReport}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.list_utilization_reports.js + * region_tag:vmmigration_v1_generated_VmMigration_ListUtilizationReports_async + */ listUtilizationReportsAsync( - request?: protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmmigration.v1.IListUtilizationReportsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listUtilizationReports']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listUtilizationReports iterate %j', request); return this.descriptors.page.listUtilizationReports.asyncIterate( this.innerApiCalls['listUtilizationReports'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists DatacenterConnectors in a given Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of connectors. - * @param {number} [request.pageSize] - * Optional. The maximum number of connectors to return. The service may - * return fewer than this value. If unspecified, at most 500 sources will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListDatacenterConnectors` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListDatacenterConnectors` must match the call that provided the page - * token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @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 Array of {@link protos.google.cloud.vmmigration.v1.DatacenterConnector|DatacenterConnector}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listDatacenterConnectorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists DatacenterConnectors in a given Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of connectors. + * @param {number} [request.pageSize] + * Optional. The maximum number of connectors to return. The service may + * return fewer than this value. If unspecified, at most 500 sources will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListDatacenterConnectors` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListDatacenterConnectors` must match the call that provided the page + * token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @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 Array of {@link protos.google.cloud.vmmigration.v1.DatacenterConnector|DatacenterConnector}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listDatacenterConnectorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listDatacenterConnectors( - request?: protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IDatacenterConnector[], - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest|null, - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse - ]>; + request?: protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IDatacenterConnector[], + protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest | null, + protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse, + ] + >; listDatacenterConnectors( - request: protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IDatacenterConnector>): void; + request: protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, + | protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IDatacenterConnector + >, + ): void; listDatacenterConnectors( - request: protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IDatacenterConnector>): void; + request: protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, + | protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IDatacenterConnector + >, + ): void; listDatacenterConnectors( - request?: protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IDatacenterConnector>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IDatacenterConnector>): - Promise<[ - protos.google.cloud.vmmigration.v1.IDatacenterConnector[], - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest|null, - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse - ]>|void { + | protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IDatacenterConnector + >, + callback?: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, + | protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IDatacenterConnector + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IDatacenterConnector[], + protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest | null, + protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IDatacenterConnector>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, + | protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IDatacenterConnector + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listDatacenterConnectors values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -7005,226 +10210,255 @@ export class VmMigrationClient { this._log.info('listDatacenterConnectors request %j', request); return this.innerApiCalls .listDatacenterConnectors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmmigration.v1.IDatacenterConnector[], - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest|null, - protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse - ]) => { - this._log.info('listDatacenterConnectors values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmmigration.v1.IDatacenterConnector[], + protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest | null, + protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsResponse, + ]) => { + this._log.info('listDatacenterConnectors values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listDatacenterConnectors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of connectors. - * @param {number} [request.pageSize] - * Optional. The maximum number of connectors to return. The service may - * return fewer than this value. If unspecified, at most 500 sources will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListDatacenterConnectors` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListDatacenterConnectors` must match the call that provided the page - * token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.DatacenterConnector|DatacenterConnector} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listDatacenterConnectorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listDatacenterConnectors`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of connectors. + * @param {number} [request.pageSize] + * Optional. The maximum number of connectors to return. The service may + * return fewer than this value. If unspecified, at most 500 sources will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListDatacenterConnectors` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListDatacenterConnectors` must match the call that provided the page + * token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.DatacenterConnector|DatacenterConnector} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listDatacenterConnectorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listDatacenterConnectorsStream( - request?: protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDatacenterConnectors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDatacenterConnectors stream %j', request); return this.descriptors.page.listDatacenterConnectors.createStream( this.innerApiCalls.listDatacenterConnectors as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listDatacenterConnectors`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of connectors. - * @param {number} [request.pageSize] - * Optional. The maximum number of connectors to return. The service may - * return fewer than this value. If unspecified, at most 500 sources will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListDatacenterConnectors` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListDatacenterConnectors` must match the call that provided the page - * token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmmigration.v1.DatacenterConnector|DatacenterConnector}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.list_datacenter_connectors.js - * region_tag:vmmigration_v1_generated_VmMigration_ListDatacenterConnectors_async - */ + /** + * Equivalent to `listDatacenterConnectors`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of connectors. + * @param {number} [request.pageSize] + * Optional. The maximum number of connectors to return. The service may + * return fewer than this value. If unspecified, at most 500 sources will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListDatacenterConnectors` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListDatacenterConnectors` must match the call that provided the page + * token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmmigration.v1.DatacenterConnector|DatacenterConnector}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.list_datacenter_connectors.js + * region_tag:vmmigration_v1_generated_VmMigration_ListDatacenterConnectors_async + */ listDatacenterConnectorsAsync( - request?: protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmmigration.v1.IListDatacenterConnectorsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDatacenterConnectors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDatacenterConnectors iterate %j', request); return this.descriptors.page.listDatacenterConnectors.asyncIterate( this.innerApiCalls['listDatacenterConnectors'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists MigratingVms in a given Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of MigratingVms. - * @param {number} [request.pageSize] - * Optional. The maximum number of migrating VMs to return. The service may - * return fewer than this value. If unspecified, at most 500 migrating VMs - * will be returned. The maximum value is 1000; values above 1000 will be - * coerced to 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListMigratingVms` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListMigratingVms` - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {google.cloud.vmmigration.v1.MigratingVmView} [request.view] - * Optional. The level of details of each migrating VM. - * @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 Array of {@link protos.google.cloud.vmmigration.v1.MigratingVm|MigratingVm}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMigratingVmsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists MigratingVms in a given Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of MigratingVms. + * @param {number} [request.pageSize] + * Optional. The maximum number of migrating VMs to return. The service may + * return fewer than this value. If unspecified, at most 500 migrating VMs + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListMigratingVms` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListMigratingVms` + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {google.cloud.vmmigration.v1.MigratingVmView} [request.view] + * Optional. The level of details of each migrating VM. + * @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 Array of {@link protos.google.cloud.vmmigration.v1.MigratingVm|MigratingVm}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMigratingVmsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listMigratingVms( - request?: protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IMigratingVm[], - protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest|null, - protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse - ]>; + request?: protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IMigratingVm[], + protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest | null, + protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse, + ] + >; listMigratingVms( - request: protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, - protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IMigratingVm>): void; + request: protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, + | protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IMigratingVm + >, + ): void; listMigratingVms( - request: protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, - protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IMigratingVm>): void; + request: protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, + | protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IMigratingVm + >, + ): void; listMigratingVms( - request?: protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, - protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IMigratingVm>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, - protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IMigratingVm>): - Promise<[ - protos.google.cloud.vmmigration.v1.IMigratingVm[], - protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest|null, - protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse - ]>|void { + | protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IMigratingVm + >, + callback?: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, + | protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IMigratingVm + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IMigratingVm[], + protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest | null, + protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, - protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IMigratingVm>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, + | protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IMigratingVm + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listMigratingVms values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -7233,227 +10467,256 @@ export class VmMigrationClient { this._log.info('listMigratingVms request %j', request); return this.innerApiCalls .listMigratingVms(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmmigration.v1.IMigratingVm[], - protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest|null, - protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse - ]) => { - this._log.info('listMigratingVms values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmmigration.v1.IMigratingVm[], + protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest | null, + protos.google.cloud.vmmigration.v1.IListMigratingVmsResponse, + ]) => { + this._log.info('listMigratingVms values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listMigratingVms`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of MigratingVms. - * @param {number} [request.pageSize] - * Optional. The maximum number of migrating VMs to return. The service may - * return fewer than this value. If unspecified, at most 500 migrating VMs - * will be returned. The maximum value is 1000; values above 1000 will be - * coerced to 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListMigratingVms` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListMigratingVms` - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {google.cloud.vmmigration.v1.MigratingVmView} [request.view] - * Optional. The level of details of each migrating VM. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.MigratingVm|MigratingVm} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listMigratingVmsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listMigratingVms`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of MigratingVms. + * @param {number} [request.pageSize] + * Optional. The maximum number of migrating VMs to return. The service may + * return fewer than this value. If unspecified, at most 500 migrating VMs + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListMigratingVms` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListMigratingVms` + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {google.cloud.vmmigration.v1.MigratingVmView} [request.view] + * Optional. The level of details of each migrating VM. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.MigratingVm|MigratingVm} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMigratingVmsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listMigratingVmsStream( - request?: protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listMigratingVms']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMigratingVms stream %j', request); return this.descriptors.page.listMigratingVms.createStream( this.innerApiCalls.listMigratingVms as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listMigratingVms`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of MigratingVms. - * @param {number} [request.pageSize] - * Optional. The maximum number of migrating VMs to return. The service may - * return fewer than this value. If unspecified, at most 500 migrating VMs - * will be returned. The maximum value is 1000; values above 1000 will be - * coerced to 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListMigratingVms` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListMigratingVms` - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {google.cloud.vmmigration.v1.MigratingVmView} [request.view] - * Optional. The level of details of each migrating VM. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmmigration.v1.MigratingVm|MigratingVm}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.list_migrating_vms.js - * region_tag:vmmigration_v1_generated_VmMigration_ListMigratingVms_async - */ + /** + * Equivalent to `listMigratingVms`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of MigratingVms. + * @param {number} [request.pageSize] + * Optional. The maximum number of migrating VMs to return. The service may + * return fewer than this value. If unspecified, at most 500 migrating VMs + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListMigratingVms` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListMigratingVms` + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {google.cloud.vmmigration.v1.MigratingVmView} [request.view] + * Optional. The level of details of each migrating VM. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmmigration.v1.MigratingVm|MigratingVm}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.list_migrating_vms.js + * region_tag:vmmigration_v1_generated_VmMigration_ListMigratingVms_async + */ listMigratingVmsAsync( - request?: protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmmigration.v1.IListMigratingVmsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listMigratingVms']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listMigratingVms iterate %j', request); return this.descriptors.page.listMigratingVms.asyncIterate( this.innerApiCalls['listMigratingVms'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists the CloneJobs of a migrating VM. Only 25 most recent CloneJobs are - * listed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of source VMs. - * @param {number} [request.pageSize] - * Optional. The maximum number of clone jobs to return. The service may - * return fewer than this value. If unspecified, at most 500 clone jobs will - * be returned. The maximum value is 1000; values above 1000 will be coerced - * to 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListCloneJobs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListCloneJobs` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @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 Array of {@link protos.google.cloud.vmmigration.v1.CloneJob|CloneJob}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCloneJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists the CloneJobs of a migrating VM. Only 25 most recent CloneJobs are + * listed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of source VMs. + * @param {number} [request.pageSize] + * Optional. The maximum number of clone jobs to return. The service may + * return fewer than this value. If unspecified, at most 500 clone jobs will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListCloneJobs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListCloneJobs` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @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 Array of {@link protos.google.cloud.vmmigration.v1.CloneJob|CloneJob}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCloneJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listCloneJobs( - request?: protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.ICloneJob[], - protos.google.cloud.vmmigration.v1.IListCloneJobsRequest|null, - protos.google.cloud.vmmigration.v1.IListCloneJobsResponse - ]>; + request?: protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ICloneJob[], + protos.google.cloud.vmmigration.v1.IListCloneJobsRequest | null, + protos.google.cloud.vmmigration.v1.IListCloneJobsResponse, + ] + >; listCloneJobs( - request: protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, - protos.google.cloud.vmmigration.v1.IListCloneJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ICloneJob>): void; + request: protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, + | protos.google.cloud.vmmigration.v1.IListCloneJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ICloneJob + >, + ): void; listCloneJobs( - request: protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, - protos.google.cloud.vmmigration.v1.IListCloneJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ICloneJob>): void; + request: protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, + | protos.google.cloud.vmmigration.v1.IListCloneJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ICloneJob + >, + ): void; listCloneJobs( - request?: protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, - protos.google.cloud.vmmigration.v1.IListCloneJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ICloneJob>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, - protos.google.cloud.vmmigration.v1.IListCloneJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ICloneJob>): - Promise<[ - protos.google.cloud.vmmigration.v1.ICloneJob[], - protos.google.cloud.vmmigration.v1.IListCloneJobsRequest|null, - protos.google.cloud.vmmigration.v1.IListCloneJobsResponse - ]>|void { + | protos.google.cloud.vmmigration.v1.IListCloneJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ICloneJob + >, + callback?: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, + | protos.google.cloud.vmmigration.v1.IListCloneJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ICloneJob + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ICloneJob[], + protos.google.cloud.vmmigration.v1.IListCloneJobsRequest | null, + protos.google.cloud.vmmigration.v1.IListCloneJobsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, - protos.google.cloud.vmmigration.v1.IListCloneJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ICloneJob>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, + | protos.google.cloud.vmmigration.v1.IListCloneJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ICloneJob + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listCloneJobs values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -7462,223 +10725,252 @@ export class VmMigrationClient { this._log.info('listCloneJobs request %j', request); return this.innerApiCalls .listCloneJobs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmmigration.v1.ICloneJob[], - protos.google.cloud.vmmigration.v1.IListCloneJobsRequest|null, - protos.google.cloud.vmmigration.v1.IListCloneJobsResponse - ]) => { - this._log.info('listCloneJobs values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmmigration.v1.ICloneJob[], + protos.google.cloud.vmmigration.v1.IListCloneJobsRequest | null, + protos.google.cloud.vmmigration.v1.IListCloneJobsResponse, + ]) => { + this._log.info('listCloneJobs values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listCloneJobs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of source VMs. - * @param {number} [request.pageSize] - * Optional. The maximum number of clone jobs to return. The service may - * return fewer than this value. If unspecified, at most 500 clone jobs will - * be returned. The maximum value is 1000; values above 1000 will be coerced - * to 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListCloneJobs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListCloneJobs` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.CloneJob|CloneJob} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listCloneJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listCloneJobs`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of source VMs. + * @param {number} [request.pageSize] + * Optional. The maximum number of clone jobs to return. The service may + * return fewer than this value. If unspecified, at most 500 clone jobs will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListCloneJobs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListCloneJobs` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.CloneJob|CloneJob} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCloneJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listCloneJobsStream( - request?: protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listCloneJobs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listCloneJobs stream %j', request); return this.descriptors.page.listCloneJobs.createStream( this.innerApiCalls.listCloneJobs as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listCloneJobs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of source VMs. - * @param {number} [request.pageSize] - * Optional. The maximum number of clone jobs to return. The service may - * return fewer than this value. If unspecified, at most 500 clone jobs will - * be returned. The maximum value is 1000; values above 1000 will be coerced - * to 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListCloneJobs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListCloneJobs` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmmigration.v1.CloneJob|CloneJob}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.list_clone_jobs.js - * region_tag:vmmigration_v1_generated_VmMigration_ListCloneJobs_async - */ + /** + * Equivalent to `listCloneJobs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of source VMs. + * @param {number} [request.pageSize] + * Optional. The maximum number of clone jobs to return. The service may + * return fewer than this value. If unspecified, at most 500 clone jobs will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListCloneJobs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListCloneJobs` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmmigration.v1.CloneJob|CloneJob}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.list_clone_jobs.js + * region_tag:vmmigration_v1_generated_VmMigration_ListCloneJobs_async + */ listCloneJobsAsync( - request?: protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmmigration.v1.IListCloneJobsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listCloneJobs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listCloneJobs iterate %j', request); return this.descriptors.page.listCloneJobs.asyncIterate( this.innerApiCalls['listCloneJobs'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists the CutoverJobs of a migrating VM. Only 25 most recent CutoverJobs - * are listed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of migrating VMs. - * @param {number} [request.pageSize] - * Optional. The maximum number of cutover jobs to return. The service may - * return fewer than this value. If unspecified, at most 500 cutover jobs will - * be returned. The maximum value is 1000; values above 1000 will be coerced - * to 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListCutoverJobs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListCutoverJobs` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @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 Array of {@link protos.google.cloud.vmmigration.v1.CutoverJob|CutoverJob}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCutoverJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists the CutoverJobs of a migrating VM. Only 25 most recent CutoverJobs + * are listed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of migrating VMs. + * @param {number} [request.pageSize] + * Optional. The maximum number of cutover jobs to return. The service may + * return fewer than this value. If unspecified, at most 500 cutover jobs will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListCutoverJobs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListCutoverJobs` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @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 Array of {@link protos.google.cloud.vmmigration.v1.CutoverJob|CutoverJob}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCutoverJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listCutoverJobs( - request?: protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.ICutoverJob[], - protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest|null, - protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse - ]>; + request?: protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ICutoverJob[], + protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest | null, + protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse, + ] + >; listCutoverJobs( - request: protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, - protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ICutoverJob>): void; + request: protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, + | protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ICutoverJob + >, + ): void; listCutoverJobs( - request: protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, - protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ICutoverJob>): void; + request: protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, + | protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ICutoverJob + >, + ): void; listCutoverJobs( - request?: protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, - protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ICutoverJob>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, - protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ICutoverJob>): - Promise<[ - protos.google.cloud.vmmigration.v1.ICutoverJob[], - protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest|null, - protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse - ]>|void { + | protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ICutoverJob + >, + callback?: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, + | protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ICutoverJob + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ICutoverJob[], + protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest | null, + protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, - protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ICutoverJob>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, + | protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ICutoverJob + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listCutoverJobs values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -7687,222 +10979,245 @@ export class VmMigrationClient { this._log.info('listCutoverJobs request %j', request); return this.innerApiCalls .listCutoverJobs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmmigration.v1.ICutoverJob[], - protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest|null, - protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse - ]) => { - this._log.info('listCutoverJobs values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmmigration.v1.ICutoverJob[], + protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest | null, + protos.google.cloud.vmmigration.v1.IListCutoverJobsResponse, + ]) => { + this._log.info('listCutoverJobs values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listCutoverJobs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of migrating VMs. - * @param {number} [request.pageSize] - * Optional. The maximum number of cutover jobs to return. The service may - * return fewer than this value. If unspecified, at most 500 cutover jobs will - * be returned. The maximum value is 1000; values above 1000 will be coerced - * to 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListCutoverJobs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListCutoverJobs` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.CutoverJob|CutoverJob} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listCutoverJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listCutoverJobs`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of migrating VMs. + * @param {number} [request.pageSize] + * Optional. The maximum number of cutover jobs to return. The service may + * return fewer than this value. If unspecified, at most 500 cutover jobs will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListCutoverJobs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListCutoverJobs` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.CutoverJob|CutoverJob} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCutoverJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listCutoverJobsStream( - request?: protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listCutoverJobs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listCutoverJobs stream %j', request); return this.descriptors.page.listCutoverJobs.createStream( this.innerApiCalls.listCutoverJobs as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listCutoverJobs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of migrating VMs. - * @param {number} [request.pageSize] - * Optional. The maximum number of cutover jobs to return. The service may - * return fewer than this value. If unspecified, at most 500 cutover jobs will - * be returned. The maximum value is 1000; values above 1000 will be coerced - * to 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListCutoverJobs` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListCutoverJobs` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmmigration.v1.CutoverJob|CutoverJob}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.list_cutover_jobs.js - * region_tag:vmmigration_v1_generated_VmMigration_ListCutoverJobs_async - */ + /** + * Equivalent to `listCutoverJobs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of migrating VMs. + * @param {number} [request.pageSize] + * Optional. The maximum number of cutover jobs to return. The service may + * return fewer than this value. If unspecified, at most 500 cutover jobs will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListCutoverJobs` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListCutoverJobs` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmmigration.v1.CutoverJob|CutoverJob}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.list_cutover_jobs.js + * region_tag:vmmigration_v1_generated_VmMigration_ListCutoverJobs_async + */ listCutoverJobsAsync( - request?: protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmmigration.v1.IListCutoverJobsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listCutoverJobs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listCutoverJobs iterate %j', request); return this.descriptors.page.listCutoverJobs.asyncIterate( this.innerApiCalls['listCutoverJobs'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Groups in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of groups. - * @param {number} [request.pageSize] - * Optional. The maximum number of groups to return. The service may return - * fewer than this value. If unspecified, at most 500 groups will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListGroups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListGroups` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @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 Array of {@link protos.google.cloud.vmmigration.v1.Group|Group}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listGroupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Groups in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of groups. + * @param {number} [request.pageSize] + * Optional. The maximum number of groups to return. The service may return + * fewer than this value. If unspecified, at most 500 groups will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListGroups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListGroups` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @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 Array of {@link protos.google.cloud.vmmigration.v1.Group|Group}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listGroupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listGroups( - request?: protos.google.cloud.vmmigration.v1.IListGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IGroup[], - protos.google.cloud.vmmigration.v1.IListGroupsRequest|null, - protos.google.cloud.vmmigration.v1.IListGroupsResponse - ]>; + request?: protos.google.cloud.vmmigration.v1.IListGroupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IGroup[], + protos.google.cloud.vmmigration.v1.IListGroupsRequest | null, + protos.google.cloud.vmmigration.v1.IListGroupsResponse, + ] + >; listGroups( - request: protos.google.cloud.vmmigration.v1.IListGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListGroupsRequest, - protos.google.cloud.vmmigration.v1.IListGroupsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IGroup>): void; + request: protos.google.cloud.vmmigration.v1.IListGroupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListGroupsRequest, + protos.google.cloud.vmmigration.v1.IListGroupsResponse | null | undefined, + protos.google.cloud.vmmigration.v1.IGroup + >, + ): void; listGroups( - request: protos.google.cloud.vmmigration.v1.IListGroupsRequest, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListGroupsRequest, - protos.google.cloud.vmmigration.v1.IListGroupsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IGroup>): void; + request: protos.google.cloud.vmmigration.v1.IListGroupsRequest, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListGroupsRequest, + protos.google.cloud.vmmigration.v1.IListGroupsResponse | null | undefined, + protos.google.cloud.vmmigration.v1.IGroup + >, + ): void; listGroups( - request?: protos.google.cloud.vmmigration.v1.IListGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmmigration.v1.IListGroupsRequest, - protos.google.cloud.vmmigration.v1.IListGroupsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IGroup>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmmigration.v1.IListGroupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmmigration.v1.IListGroupsRequest, - protos.google.cloud.vmmigration.v1.IListGroupsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IGroup>): - Promise<[ - protos.google.cloud.vmmigration.v1.IGroup[], - protos.google.cloud.vmmigration.v1.IListGroupsRequest|null, - protos.google.cloud.vmmigration.v1.IListGroupsResponse - ]>|void { + | protos.google.cloud.vmmigration.v1.IListGroupsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IGroup + >, + callback?: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListGroupsRequest, + protos.google.cloud.vmmigration.v1.IListGroupsResponse | null | undefined, + protos.google.cloud.vmmigration.v1.IGroup + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IGroup[], + protos.google.cloud.vmmigration.v1.IListGroupsRequest | null, + protos.google.cloud.vmmigration.v1.IListGroupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListGroupsRequest, - protos.google.cloud.vmmigration.v1.IListGroupsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IGroup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmmigration.v1.IListGroupsRequest, + | protos.google.cloud.vmmigration.v1.IListGroupsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IGroup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listGroups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -7911,225 +11226,254 @@ export class VmMigrationClient { this._log.info('listGroups request %j', request); return this.innerApiCalls .listGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmmigration.v1.IGroup[], - protos.google.cloud.vmmigration.v1.IListGroupsRequest|null, - protos.google.cloud.vmmigration.v1.IListGroupsResponse - ]) => { - this._log.info('listGroups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmmigration.v1.IGroup[], + protos.google.cloud.vmmigration.v1.IListGroupsRequest | null, + protos.google.cloud.vmmigration.v1.IListGroupsResponse, + ]) => { + this._log.info('listGroups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of groups. - * @param {number} [request.pageSize] - * Optional. The maximum number of groups to return. The service may return - * fewer than this value. If unspecified, at most 500 groups will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListGroups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListGroups` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.Group|Group} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listGroupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listGroups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of groups. + * @param {number} [request.pageSize] + * Optional. The maximum number of groups to return. The service may return + * fewer than this value. If unspecified, at most 500 groups will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListGroups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListGroups` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.Group|Group} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listGroupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listGroupsStream( - request?: protos.google.cloud.vmmigration.v1.IListGroupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmmigration.v1.IListGroupsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listGroups stream %j', request); return this.descriptors.page.listGroups.createStream( this.innerApiCalls.listGroups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listGroups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of groups. - * @param {number} [request.pageSize] - * Optional. The maximum number of groups to return. The service may return - * fewer than this value. If unspecified, at most 500 groups will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListGroups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListGroups` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmmigration.v1.Group|Group}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.list_groups.js - * region_tag:vmmigration_v1_generated_VmMigration_ListGroups_async - */ + /** + * Equivalent to `listGroups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of groups. + * @param {number} [request.pageSize] + * Optional. The maximum number of groups to return. The service may return + * fewer than this value. If unspecified, at most 500 groups will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListGroups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListGroups` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmmigration.v1.Group|Group}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.list_groups.js + * region_tag:vmmigration_v1_generated_VmMigration_ListGroups_async + */ listGroupsAsync( - request?: protos.google.cloud.vmmigration.v1.IListGroupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmmigration.v1.IListGroupsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listGroups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listGroups iterate %j', request); return this.descriptors.page.listGroups.asyncIterate( this.innerApiCalls['listGroups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists TargetProjects in a given project. - * - * NOTE: TargetProject is a global resource; hence the only supported value - * for location is `global`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of targets. - * @param {number} [request.pageSize] - * Optional. The maximum number of targets to return. The service may return - * fewer than this value. If unspecified, at most 500 targets will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListTargets` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListTargets` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @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 Array of {@link protos.google.cloud.vmmigration.v1.TargetProject|TargetProject}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTargetProjectsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists TargetProjects in a given project. + * + * NOTE: TargetProject is a global resource; hence the only supported value + * for location is `global`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of targets. + * @param {number} [request.pageSize] + * Optional. The maximum number of targets to return. The service may return + * fewer than this value. If unspecified, at most 500 targets will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListTargets` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListTargets` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @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 Array of {@link protos.google.cloud.vmmigration.v1.TargetProject|TargetProject}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listTargetProjectsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listTargetProjects( - request?: protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.ITargetProject[], - protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest|null, - protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse - ]>; + request?: protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ITargetProject[], + protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest | null, + protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse, + ] + >; listTargetProjects( - request: protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, - protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ITargetProject>): void; + request: protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, + | protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ITargetProject + >, + ): void; listTargetProjects( - request: protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, - protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ITargetProject>): void; + request: protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, + | protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ITargetProject + >, + ): void; listTargetProjects( - request?: protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, - protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ITargetProject>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, - protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ITargetProject>): - Promise<[ - protos.google.cloud.vmmigration.v1.ITargetProject[], - protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest|null, - protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse - ]>|void { + | protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ITargetProject + >, + callback?: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, + | protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ITargetProject + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.ITargetProject[], + protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest | null, + protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, - protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.ITargetProject>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, + | protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.ITargetProject + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listTargetProjects values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -8138,222 +11482,251 @@ export class VmMigrationClient { this._log.info('listTargetProjects request %j', request); return this.innerApiCalls .listTargetProjects(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmmigration.v1.ITargetProject[], - protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest|null, - protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse - ]) => { - this._log.info('listTargetProjects values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmmigration.v1.ITargetProject[], + protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest | null, + protos.google.cloud.vmmigration.v1.IListTargetProjectsResponse, + ]) => { + this._log.info('listTargetProjects values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listTargetProjects`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of targets. - * @param {number} [request.pageSize] - * Optional. The maximum number of targets to return. The service may return - * fewer than this value. If unspecified, at most 500 targets will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListTargets` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListTargets` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.TargetProject|TargetProject} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listTargetProjectsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listTargetProjects`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of targets. + * @param {number} [request.pageSize] + * Optional. The maximum number of targets to return. The service may return + * fewer than this value. If unspecified, at most 500 targets will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListTargets` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListTargets` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.TargetProject|TargetProject} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listTargetProjectsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listTargetProjectsStream( - request?: protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listTargetProjects']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listTargetProjects stream %j', request); return this.descriptors.page.listTargetProjects.createStream( this.innerApiCalls.listTargetProjects as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listTargetProjects`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of targets. - * @param {number} [request.pageSize] - * Optional. The maximum number of targets to return. The service may return - * fewer than this value. If unspecified, at most 500 targets will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListTargets` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListTargets` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmmigration.v1.TargetProject|TargetProject}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.list_target_projects.js - * region_tag:vmmigration_v1_generated_VmMigration_ListTargetProjects_async - */ + /** + * Equivalent to `listTargetProjects`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of targets. + * @param {number} [request.pageSize] + * Optional. The maximum number of targets to return. The service may return + * fewer than this value. If unspecified, at most 500 targets will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListTargets` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListTargets` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmmigration.v1.TargetProject|TargetProject}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.list_target_projects.js + * region_tag:vmmigration_v1_generated_VmMigration_ListTargetProjects_async + */ listTargetProjectsAsync( - request?: protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmmigration.v1.IListTargetProjectsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listTargetProjects']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listTargetProjects iterate %j', request); return this.descriptors.page.listTargetProjects.asyncIterate( this.innerApiCalls['listTargetProjects'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists ReplicationCycles in a given MigratingVM. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of ReplicationCycles. - * @param {number} [request.pageSize] - * Optional. The maximum number of replication cycles to return. The service - * may return fewer than this value. If unspecified, at most 100 migrating VMs - * will be returned. The maximum value is 100; values above 100 will be - * coerced to 100. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListReplicationCycles` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListReplicationCycles` - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @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 Array of {@link protos.google.cloud.vmmigration.v1.ReplicationCycle|ReplicationCycle}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listReplicationCyclesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists ReplicationCycles in a given MigratingVM. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of ReplicationCycles. + * @param {number} [request.pageSize] + * Optional. The maximum number of replication cycles to return. The service + * may return fewer than this value. If unspecified, at most 100 migrating VMs + * will be returned. The maximum value is 100; values above 100 will be + * coerced to 100. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListReplicationCycles` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListReplicationCycles` + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @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 Array of {@link protos.google.cloud.vmmigration.v1.ReplicationCycle|ReplicationCycle}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listReplicationCyclesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listReplicationCycles( - request?: protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IReplicationCycle[], - protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest|null, - protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse - ]>; + request?: protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IReplicationCycle[], + protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest | null, + protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse, + ] + >; listReplicationCycles( - request: protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, - protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IReplicationCycle>): void; + request: protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, + | protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IReplicationCycle + >, + ): void; listReplicationCycles( - request: protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, - protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IReplicationCycle>): void; + request: protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, + | protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IReplicationCycle + >, + ): void; listReplicationCycles( - request?: protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, - protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IReplicationCycle>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, - protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IReplicationCycle>): - Promise<[ - protos.google.cloud.vmmigration.v1.IReplicationCycle[], - protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest|null, - protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse - ]>|void { + | protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IReplicationCycle + >, + callback?: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, + | protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IReplicationCycle + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IReplicationCycle[], + protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest | null, + protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, - protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IReplicationCycle>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, + | protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IReplicationCycle + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listReplicationCycles values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -8362,225 +11735,254 @@ export class VmMigrationClient { this._log.info('listReplicationCycles request %j', request); return this.innerApiCalls .listReplicationCycles(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmmigration.v1.IReplicationCycle[], - protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest|null, - protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse - ]) => { - this._log.info('listReplicationCycles values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmmigration.v1.IReplicationCycle[], + protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest | null, + protos.google.cloud.vmmigration.v1.IListReplicationCyclesResponse, + ]) => { + this._log.info('listReplicationCycles values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listReplicationCycles`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of ReplicationCycles. - * @param {number} [request.pageSize] - * Optional. The maximum number of replication cycles to return. The service - * may return fewer than this value. If unspecified, at most 100 migrating VMs - * will be returned. The maximum value is 100; values above 100 will be - * coerced to 100. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListReplicationCycles` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListReplicationCycles` - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.ReplicationCycle|ReplicationCycle} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listReplicationCyclesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listReplicationCycles`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of ReplicationCycles. + * @param {number} [request.pageSize] + * Optional. The maximum number of replication cycles to return. The service + * may return fewer than this value. If unspecified, at most 100 migrating VMs + * will be returned. The maximum value is 100; values above 100 will be + * coerced to 100. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListReplicationCycles` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListReplicationCycles` + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.ReplicationCycle|ReplicationCycle} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listReplicationCyclesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listReplicationCyclesStream( - request?: protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listReplicationCycles']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listReplicationCycles stream %j', request); return this.descriptors.page.listReplicationCycles.createStream( this.innerApiCalls.listReplicationCycles as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listReplicationCycles`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of ReplicationCycles. - * @param {number} [request.pageSize] - * Optional. The maximum number of replication cycles to return. The service - * may return fewer than this value. If unspecified, at most 100 migrating VMs - * will be returned. The maximum value is 100; values above 100 will be - * coerced to 100. - * @param {string} request.pageToken - * Required. A page token, received from a previous `ListReplicationCycles` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListReplicationCycles` - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request. - * @param {string} [request.orderBy] - * Optional. the order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmmigration.v1.ReplicationCycle|ReplicationCycle}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.list_replication_cycles.js - * region_tag:vmmigration_v1_generated_VmMigration_ListReplicationCycles_async - */ + /** + * Equivalent to `listReplicationCycles`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of ReplicationCycles. + * @param {number} [request.pageSize] + * Optional. The maximum number of replication cycles to return. The service + * may return fewer than this value. If unspecified, at most 100 migrating VMs + * will be returned. The maximum value is 100; values above 100 will be + * coerced to 100. + * @param {string} request.pageToken + * Required. A page token, received from a previous `ListReplicationCycles` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListReplicationCycles` + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request. + * @param {string} [request.orderBy] + * Optional. the order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmmigration.v1.ReplicationCycle|ReplicationCycle}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.list_replication_cycles.js + * region_tag:vmmigration_v1_generated_VmMigration_ListReplicationCycles_async + */ listReplicationCyclesAsync( - request?: protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmmigration.v1.IListReplicationCyclesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listReplicationCycles']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listReplicationCycles iterate %j', request); return this.descriptors.page.listReplicationCycles.asyncIterate( this.innerApiCalls['listReplicationCycles'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists ImageImports in a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of targets. - * @param {number} [request.pageSize] - * Optional. The maximum number of targets to return. The service may return - * fewer than this value. If unspecified, at most 500 targets will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListImageImports` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListImageImports` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request (according to AIP-160). - * @param {string} [request.orderBy] - * Optional. The order by fields for the result (according to AIP-132). - * Currently ordering is only possible by "name" field. - * @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 Array of {@link protos.google.cloud.vmmigration.v1.ImageImport|ImageImport}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listImageImportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists ImageImports in a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of targets. + * @param {number} [request.pageSize] + * Optional. The maximum number of targets to return. The service may return + * fewer than this value. If unspecified, at most 500 targets will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListImageImports` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListImageImports` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request (according to AIP-160). + * @param {string} [request.orderBy] + * Optional. The order by fields for the result (according to AIP-132). + * Currently ordering is only possible by "name" field. + * @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 Array of {@link protos.google.cloud.vmmigration.v1.ImageImport|ImageImport}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listImageImportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listImageImports( - request?: protos.google.cloud.vmmigration.v1.IListImageImportsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IImageImport[], - protos.google.cloud.vmmigration.v1.IListImageImportsRequest|null, - protos.google.cloud.vmmigration.v1.IListImageImportsResponse - ]>; + request?: protos.google.cloud.vmmigration.v1.IListImageImportsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IImageImport[], + protos.google.cloud.vmmigration.v1.IListImageImportsRequest | null, + protos.google.cloud.vmmigration.v1.IListImageImportsResponse, + ] + >; listImageImports( - request: protos.google.cloud.vmmigration.v1.IListImageImportsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListImageImportsRequest, - protos.google.cloud.vmmigration.v1.IListImageImportsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IImageImport>): void; + request: protos.google.cloud.vmmigration.v1.IListImageImportsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListImageImportsRequest, + | protos.google.cloud.vmmigration.v1.IListImageImportsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IImageImport + >, + ): void; listImageImports( - request: protos.google.cloud.vmmigration.v1.IListImageImportsRequest, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListImageImportsRequest, - protos.google.cloud.vmmigration.v1.IListImageImportsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IImageImport>): void; + request: protos.google.cloud.vmmigration.v1.IListImageImportsRequest, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListImageImportsRequest, + | protos.google.cloud.vmmigration.v1.IListImageImportsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IImageImport + >, + ): void; listImageImports( - request?: protos.google.cloud.vmmigration.v1.IListImageImportsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmmigration.v1.IListImageImportsRequest, - protos.google.cloud.vmmigration.v1.IListImageImportsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IImageImport>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmmigration.v1.IListImageImportsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmmigration.v1.IListImageImportsRequest, - protos.google.cloud.vmmigration.v1.IListImageImportsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IImageImport>): - Promise<[ - protos.google.cloud.vmmigration.v1.IImageImport[], - protos.google.cloud.vmmigration.v1.IListImageImportsRequest|null, - protos.google.cloud.vmmigration.v1.IListImageImportsResponse - ]>|void { + | protos.google.cloud.vmmigration.v1.IListImageImportsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IImageImport + >, + callback?: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListImageImportsRequest, + | protos.google.cloud.vmmigration.v1.IListImageImportsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IImageImport + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IImageImport[], + protos.google.cloud.vmmigration.v1.IListImageImportsRequest | null, + protos.google.cloud.vmmigration.v1.IListImageImportsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListImageImportsRequest, - protos.google.cloud.vmmigration.v1.IListImageImportsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IImageImport>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmmigration.v1.IListImageImportsRequest, + | protos.google.cloud.vmmigration.v1.IListImageImportsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IImageImport + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listImageImports values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -8589,231 +11991,260 @@ export class VmMigrationClient { this._log.info('listImageImports request %j', request); return this.innerApiCalls .listImageImports(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmmigration.v1.IImageImport[], - protos.google.cloud.vmmigration.v1.IListImageImportsRequest|null, - protos.google.cloud.vmmigration.v1.IListImageImportsResponse - ]) => { - this._log.info('listImageImports values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmmigration.v1.IImageImport[], + protos.google.cloud.vmmigration.v1.IListImageImportsRequest | null, + protos.google.cloud.vmmigration.v1.IListImageImportsResponse, + ]) => { + this._log.info('listImageImports values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listImageImports`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of targets. - * @param {number} [request.pageSize] - * Optional. The maximum number of targets to return. The service may return - * fewer than this value. If unspecified, at most 500 targets will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListImageImports` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListImageImports` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request (according to AIP-160). - * @param {string} [request.orderBy] - * Optional. The order by fields for the result (according to AIP-132). - * Currently ordering is only possible by "name" field. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.ImageImport|ImageImport} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listImageImportsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listImageImports`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of targets. + * @param {number} [request.pageSize] + * Optional. The maximum number of targets to return. The service may return + * fewer than this value. If unspecified, at most 500 targets will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListImageImports` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListImageImports` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request (according to AIP-160). + * @param {string} [request.orderBy] + * Optional. The order by fields for the result (according to AIP-132). + * Currently ordering is only possible by "name" field. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.ImageImport|ImageImport} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listImageImportsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listImageImportsStream( - request?: protos.google.cloud.vmmigration.v1.IListImageImportsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmmigration.v1.IListImageImportsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listImageImports']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listImageImports stream %j', request); return this.descriptors.page.listImageImports.createStream( this.innerApiCalls.listImageImports as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listImageImports`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of targets. - * @param {number} [request.pageSize] - * Optional. The maximum number of targets to return. The service may return - * fewer than this value. If unspecified, at most 500 targets will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListImageImports` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListImageImports` must - * match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request (according to AIP-160). - * @param {string} [request.orderBy] - * Optional. The order by fields for the result (according to AIP-132). - * Currently ordering is only possible by "name" field. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmmigration.v1.ImageImport|ImageImport}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.list_image_imports.js - * region_tag:vmmigration_v1_generated_VmMigration_ListImageImports_async - */ + /** + * Equivalent to `listImageImports`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of targets. + * @param {number} [request.pageSize] + * Optional. The maximum number of targets to return. The service may return + * fewer than this value. If unspecified, at most 500 targets will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListImageImports` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListImageImports` must + * match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request (according to AIP-160). + * @param {string} [request.orderBy] + * Optional. The order by fields for the result (according to AIP-132). + * Currently ordering is only possible by "name" field. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmmigration.v1.ImageImport|ImageImport}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.list_image_imports.js + * region_tag:vmmigration_v1_generated_VmMigration_ListImageImports_async + */ listImageImportsAsync( - request?: protos.google.cloud.vmmigration.v1.IListImageImportsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmmigration.v1.IListImageImportsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listImageImports']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listImageImports iterate %j', request); return this.descriptors.page.listImageImports.asyncIterate( this.innerApiCalls['listImageImports'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists ImageImportJobs in a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of targets. - * @param {number} [request.pageSize] - * Optional. The maximum number of targets to return. The service may return - * fewer than this value. If unspecified, at most 500 targets will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListImageImportJobs` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListImageImportJobs` - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request (according to AIP-160). - * @param {string} [request.orderBy] - * Optional. The order by fields for the result (according to AIP-132). - * Currently ordering is only possible by "name" field. - * @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 Array of {@link protos.google.cloud.vmmigration.v1.ImageImportJob|ImageImportJob}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listImageImportJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists ImageImportJobs in a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of targets. + * @param {number} [request.pageSize] + * Optional. The maximum number of targets to return. The service may return + * fewer than this value. If unspecified, at most 500 targets will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListImageImportJobs` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListImageImportJobs` + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request (according to AIP-160). + * @param {string} [request.orderBy] + * Optional. The order by fields for the result (according to AIP-132). + * Currently ordering is only possible by "name" field. + * @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 Array of {@link protos.google.cloud.vmmigration.v1.ImageImportJob|ImageImportJob}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listImageImportJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listImageImportJobs( - request?: protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IImageImportJob[], - protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest|null, - protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse - ]>; + request?: protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IImageImportJob[], + protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest | null, + protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse, + ] + >; listImageImportJobs( - request: protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, - protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IImageImportJob>): void; + request: protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, + | protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IImageImportJob + >, + ): void; listImageImportJobs( - request: protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, - protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IImageImportJob>): void; + request: protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, + | protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IImageImportJob + >, + ): void; listImageImportJobs( - request?: protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, - protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IImageImportJob>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, - protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IImageImportJob>): - Promise<[ - protos.google.cloud.vmmigration.v1.IImageImportJob[], - protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest|null, - protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse - ]>|void { + | protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IImageImportJob + >, + callback?: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, + | protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IImageImportJob + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IImageImportJob[], + protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest | null, + protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, - protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IImageImportJob>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, + | protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IImageImportJob + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listImageImportJobs values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -8822,229 +12253,258 @@ export class VmMigrationClient { this._log.info('listImageImportJobs request %j', request); return this.innerApiCalls .listImageImportJobs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmmigration.v1.IImageImportJob[], - protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest|null, - protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse - ]) => { - this._log.info('listImageImportJobs values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmmigration.v1.IImageImportJob[], + protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest | null, + protos.google.cloud.vmmigration.v1.IListImageImportJobsResponse, + ]) => { + this._log.info('listImageImportJobs values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listImageImportJobs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of targets. - * @param {number} [request.pageSize] - * Optional. The maximum number of targets to return. The service may return - * fewer than this value. If unspecified, at most 500 targets will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListImageImportJobs` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListImageImportJobs` - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request (according to AIP-160). - * @param {string} [request.orderBy] - * Optional. The order by fields for the result (according to AIP-132). - * Currently ordering is only possible by "name" field. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.ImageImportJob|ImageImportJob} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listImageImportJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listImageImportJobs`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of targets. + * @param {number} [request.pageSize] + * Optional. The maximum number of targets to return. The service may return + * fewer than this value. If unspecified, at most 500 targets will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListImageImportJobs` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListImageImportJobs` + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request (according to AIP-160). + * @param {string} [request.orderBy] + * Optional. The order by fields for the result (according to AIP-132). + * Currently ordering is only possible by "name" field. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.ImageImportJob|ImageImportJob} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listImageImportJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listImageImportJobsStream( - request?: protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listImageImportJobs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listImageImportJobs stream %j', request); return this.descriptors.page.listImageImportJobs.createStream( this.innerApiCalls.listImageImportJobs as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listImageImportJobs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of targets. - * @param {number} [request.pageSize] - * Optional. The maximum number of targets to return. The service may return - * fewer than this value. If unspecified, at most 500 targets will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListImageImportJobs` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListImageImportJobs` - * must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request (according to AIP-160). - * @param {string} [request.orderBy] - * Optional. The order by fields for the result (according to AIP-132). - * Currently ordering is only possible by "name" field. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmmigration.v1.ImageImportJob|ImageImportJob}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.list_image_import_jobs.js - * region_tag:vmmigration_v1_generated_VmMigration_ListImageImportJobs_async - */ + /** + * Equivalent to `listImageImportJobs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of targets. + * @param {number} [request.pageSize] + * Optional. The maximum number of targets to return. The service may return + * fewer than this value. If unspecified, at most 500 targets will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListImageImportJobs` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListImageImportJobs` + * must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request (according to AIP-160). + * @param {string} [request.orderBy] + * Optional. The order by fields for the result (according to AIP-132). + * Currently ordering is only possible by "name" field. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmmigration.v1.ImageImportJob|ImageImportJob}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.list_image_import_jobs.js + * region_tag:vmmigration_v1_generated_VmMigration_ListImageImportJobs_async + */ listImageImportJobsAsync( - request?: protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmmigration.v1.IListImageImportJobsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listImageImportJobs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listImageImportJobs iterate %j', request); return this.descriptors.page.listImageImportJobs.asyncIterate( this.innerApiCalls['listImageImportJobs'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists DiskMigrationJobs in a given Source. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of DiskMigrationJobs. - * @param {number} [request.pageSize] - * Optional. The maximum number of disk migration jobs to return. The service - * may return fewer than this value. If unspecified, at most 500 - * disk migration jobs will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListDiskMigrationJobs` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all parameters provided to `ListDiskMigrationJobs` - * except `page_size` must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request (according to AIP-160). - * @param {string} [request.orderBy] - * Optional. Ordering of the result list. - * @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 Array of {@link protos.google.cloud.vmmigration.v1.DiskMigrationJob|DiskMigrationJob}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listDiskMigrationJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists DiskMigrationJobs in a given Source. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of DiskMigrationJobs. + * @param {number} [request.pageSize] + * Optional. The maximum number of disk migration jobs to return. The service + * may return fewer than this value. If unspecified, at most 500 + * disk migration jobs will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListDiskMigrationJobs` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all parameters provided to `ListDiskMigrationJobs` + * except `page_size` must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request (according to AIP-160). + * @param {string} [request.orderBy] + * Optional. Ordering of the result list. + * @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 Array of {@link protos.google.cloud.vmmigration.v1.DiskMigrationJob|DiskMigrationJob}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listDiskMigrationJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listDiskMigrationJobs( - request?: protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmmigration.v1.IDiskMigrationJob[], - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest|null, - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse - ]>; + request?: protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IDiskMigrationJob[], + protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest | null, + protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse, + ] + >; listDiskMigrationJobs( - request: protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IDiskMigrationJob>): void; + request: protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, + | protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IDiskMigrationJob + >, + ): void; listDiskMigrationJobs( - request: protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, - callback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IDiskMigrationJob>): void; + request: protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, + callback: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, + | protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IDiskMigrationJob + >, + ): void; listDiskMigrationJobs( - request?: protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IDiskMigrationJob>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IDiskMigrationJob>): - Promise<[ - protos.google.cloud.vmmigration.v1.IDiskMigrationJob[], - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest|null, - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse - ]>|void { + | protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IDiskMigrationJob + >, + callback?: PaginationCallback< + protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, + | protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IDiskMigrationJob + >, + ): Promise< + [ + protos.google.cloud.vmmigration.v1.IDiskMigrationJob[], + protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest | null, + protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse|null|undefined, - protos.google.cloud.vmmigration.v1.IDiskMigrationJob>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, + | protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse + | null + | undefined, + protos.google.cloud.vmmigration.v1.IDiskMigrationJob + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listDiskMigrationJobs values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -9053,133 +12513,138 @@ export class VmMigrationClient { this._log.info('listDiskMigrationJobs request %j', request); return this.innerApiCalls .listDiskMigrationJobs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmmigration.v1.IDiskMigrationJob[], - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest|null, - protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse - ]) => { - this._log.info('listDiskMigrationJobs values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmmigration.v1.IDiskMigrationJob[], + protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest | null, + protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsResponse, + ]) => { + this._log.info('listDiskMigrationJobs values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listDiskMigrationJobs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of DiskMigrationJobs. - * @param {number} [request.pageSize] - * Optional. The maximum number of disk migration jobs to return. The service - * may return fewer than this value. If unspecified, at most 500 - * disk migration jobs will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListDiskMigrationJobs` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all parameters provided to `ListDiskMigrationJobs` - * except `page_size` must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request (according to AIP-160). - * @param {string} [request.orderBy] - * Optional. Ordering of the result list. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.DiskMigrationJob|DiskMigrationJob} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listDiskMigrationJobsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listDiskMigrationJobs`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of DiskMigrationJobs. + * @param {number} [request.pageSize] + * Optional. The maximum number of disk migration jobs to return. The service + * may return fewer than this value. If unspecified, at most 500 + * disk migration jobs will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListDiskMigrationJobs` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all parameters provided to `ListDiskMigrationJobs` + * except `page_size` must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request (according to AIP-160). + * @param {string} [request.orderBy] + * Optional. Ordering of the result list. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmmigration.v1.DiskMigrationJob|DiskMigrationJob} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listDiskMigrationJobsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listDiskMigrationJobsStream( - request?: protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDiskMigrationJobs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDiskMigrationJobs stream %j', request); return this.descriptors.page.listDiskMigrationJobs.createStream( this.innerApiCalls.listDiskMigrationJobs as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listDiskMigrationJobs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent, which owns this collection of DiskMigrationJobs. - * @param {number} [request.pageSize] - * Optional. The maximum number of disk migration jobs to return. The service - * may return fewer than this value. If unspecified, at most 500 - * disk migration jobs will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListDiskMigrationJobs` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all parameters provided to `ListDiskMigrationJobs` - * except `page_size` must match the call that provided the page token. - * @param {string} [request.filter] - * Optional. The filter request (according to AIP-160). - * @param {string} [request.orderBy] - * Optional. Ordering of the result list. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmmigration.v1.DiskMigrationJob|DiskMigrationJob}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vm_migration.list_disk_migration_jobs.js - * region_tag:vmmigration_v1_generated_VmMigration_ListDiskMigrationJobs_async - */ + /** + * Equivalent to `listDiskMigrationJobs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of DiskMigrationJobs. + * @param {number} [request.pageSize] + * Optional. The maximum number of disk migration jobs to return. The service + * may return fewer than this value. If unspecified, at most 500 + * disk migration jobs will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} [request.pageToken] + * Optional. A page token, received from a previous `ListDiskMigrationJobs` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all parameters provided to `ListDiskMigrationJobs` + * except `page_size` must match the call that provided the page token. + * @param {string} [request.filter] + * Optional. The filter request (according to AIP-160). + * @param {string} [request.orderBy] + * Optional. Ordering of the result list. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmmigration.v1.DiskMigrationJob|DiskMigrationJob}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vm_migration.list_disk_migration_jobs.js + * region_tag:vmmigration_v1_generated_VmMigration_ListDiskMigrationJobs_async + */ listDiskMigrationJobsAsync( - request?: protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmmigration.v1.IListDiskMigrationJobsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDiskMigrationJobs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDiskMigrationJobs iterate %j', request); return this.descriptors.page.listDiskMigrationJobs.asyncIterate( this.innerApiCalls['listDiskMigrationJobs'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } -/** + + /** * Gets information about a location. * * @param {Object} request @@ -9214,12 +12679,11 @@ export class VmMigrationClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -9252,12 +12716,12 @@ export class VmMigrationClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } -/** + /** * Gets the latest state of a long-running operation. Clients can use this * method to poll the operation result at intervals as recommended by the API * service. @@ -9300,22 +12764,22 @@ export class VmMigrationClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -9350,15 +12814,15 @@ export class VmMigrationClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -9392,7 +12856,7 @@ export class VmMigrationClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -9405,25 +12869,24 @@ export class VmMigrationClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.cancelOperation(request, options, callback); } - /** * Deletes a long-running operation. This method indicates that the client is * no longer interested in the operation result. It does not cancel the @@ -9462,22 +12925,22 @@ export class VmMigrationClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -9495,7 +12958,13 @@ export class VmMigrationClient { * @param {string} clone_job * @returns {string} Resource name string. */ - cloneJobPath(project:string,location:string,source:string,migratingVm:string,cloneJob:string) { + cloneJobPath( + project: string, + location: string, + source: string, + migratingVm: string, + cloneJob: string, + ) { return this.pathTemplates.cloneJobPathTemplate.render({ project: project, location: location, @@ -9546,7 +13015,8 @@ export class VmMigrationClient { * @returns {string} A string representing the migrating_vm. */ matchMigratingVmFromCloneJobName(cloneJobName: string) { - return this.pathTemplates.cloneJobPathTemplate.match(cloneJobName).migrating_vm; + return this.pathTemplates.cloneJobPathTemplate.match(cloneJobName) + .migrating_vm; } /** @@ -9557,7 +13027,8 @@ export class VmMigrationClient { * @returns {string} A string representing the clone_job. */ matchCloneJobFromCloneJobName(cloneJobName: string) { - return this.pathTemplates.cloneJobPathTemplate.match(cloneJobName).clone_job; + return this.pathTemplates.cloneJobPathTemplate.match(cloneJobName) + .clone_job; } /** @@ -9569,7 +13040,12 @@ export class VmMigrationClient { * @param {string} crypto_key * @returns {string} Resource name string. */ - cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { + cryptoKeyPath( + project: string, + location: string, + keyRing: string, + cryptoKey: string, + ) { return this.pathTemplates.cryptoKeyPathTemplate.render({ project: project, location: location, @@ -9586,7 +13062,8 @@ export class VmMigrationClient { * @returns {string} A string representing the project. */ matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .project; } /** @@ -9597,7 +13074,8 @@ export class VmMigrationClient { * @returns {string} A string representing the location. */ matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .location; } /** @@ -9608,7 +13086,8 @@ export class VmMigrationClient { * @returns {string} A string representing the key_ring. */ matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .key_ring; } /** @@ -9619,7 +13098,8 @@ export class VmMigrationClient { * @returns {string} A string representing the crypto_key. */ matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .crypto_key; } /** @@ -9632,7 +13112,13 @@ export class VmMigrationClient { * @param {string} cutover_job * @returns {string} Resource name string. */ - cutoverJobPath(project:string,location:string,source:string,migratingVm:string,cutoverJob:string) { + cutoverJobPath( + project: string, + location: string, + source: string, + migratingVm: string, + cutoverJob: string, + ) { return this.pathTemplates.cutoverJobPathTemplate.render({ project: project, location: location, @@ -9650,7 +13136,8 @@ export class VmMigrationClient { * @returns {string} A string representing the project. */ matchProjectFromCutoverJobName(cutoverJobName: string) { - return this.pathTemplates.cutoverJobPathTemplate.match(cutoverJobName).project; + return this.pathTemplates.cutoverJobPathTemplate.match(cutoverJobName) + .project; } /** @@ -9661,7 +13148,8 @@ export class VmMigrationClient { * @returns {string} A string representing the location. */ matchLocationFromCutoverJobName(cutoverJobName: string) { - return this.pathTemplates.cutoverJobPathTemplate.match(cutoverJobName).location; + return this.pathTemplates.cutoverJobPathTemplate.match(cutoverJobName) + .location; } /** @@ -9672,7 +13160,8 @@ export class VmMigrationClient { * @returns {string} A string representing the source. */ matchSourceFromCutoverJobName(cutoverJobName: string) { - return this.pathTemplates.cutoverJobPathTemplate.match(cutoverJobName).source; + return this.pathTemplates.cutoverJobPathTemplate.match(cutoverJobName) + .source; } /** @@ -9683,7 +13172,8 @@ export class VmMigrationClient { * @returns {string} A string representing the migrating_vm. */ matchMigratingVmFromCutoverJobName(cutoverJobName: string) { - return this.pathTemplates.cutoverJobPathTemplate.match(cutoverJobName).migrating_vm; + return this.pathTemplates.cutoverJobPathTemplate.match(cutoverJobName) + .migrating_vm; } /** @@ -9694,7 +13184,8 @@ export class VmMigrationClient { * @returns {string} A string representing the cutover_job. */ matchCutoverJobFromCutoverJobName(cutoverJobName: string) { - return this.pathTemplates.cutoverJobPathTemplate.match(cutoverJobName).cutover_job; + return this.pathTemplates.cutoverJobPathTemplate.match(cutoverJobName) + .cutover_job; } /** @@ -9706,7 +13197,12 @@ export class VmMigrationClient { * @param {string} datacenter_connector * @returns {string} Resource name string. */ - datacenterConnectorPath(project:string,location:string,source:string,datacenterConnector:string) { + datacenterConnectorPath( + project: string, + location: string, + source: string, + datacenterConnector: string, + ) { return this.pathTemplates.datacenterConnectorPathTemplate.render({ project: project, location: location, @@ -9723,7 +13219,9 @@ export class VmMigrationClient { * @returns {string} A string representing the project. */ matchProjectFromDatacenterConnectorName(datacenterConnectorName: string) { - return this.pathTemplates.datacenterConnectorPathTemplate.match(datacenterConnectorName).project; + return this.pathTemplates.datacenterConnectorPathTemplate.match( + datacenterConnectorName, + ).project; } /** @@ -9734,7 +13232,9 @@ export class VmMigrationClient { * @returns {string} A string representing the location. */ matchLocationFromDatacenterConnectorName(datacenterConnectorName: string) { - return this.pathTemplates.datacenterConnectorPathTemplate.match(datacenterConnectorName).location; + return this.pathTemplates.datacenterConnectorPathTemplate.match( + datacenterConnectorName, + ).location; } /** @@ -9745,7 +13245,9 @@ export class VmMigrationClient { * @returns {string} A string representing the source. */ matchSourceFromDatacenterConnectorName(datacenterConnectorName: string) { - return this.pathTemplates.datacenterConnectorPathTemplate.match(datacenterConnectorName).source; + return this.pathTemplates.datacenterConnectorPathTemplate.match( + datacenterConnectorName, + ).source; } /** @@ -9755,8 +13257,12 @@ export class VmMigrationClient { * A fully-qualified path representing DatacenterConnector resource. * @returns {string} A string representing the datacenter_connector. */ - matchDatacenterConnectorFromDatacenterConnectorName(datacenterConnectorName: string) { - return this.pathTemplates.datacenterConnectorPathTemplate.match(datacenterConnectorName).datacenter_connector; + matchDatacenterConnectorFromDatacenterConnectorName( + datacenterConnectorName: string, + ) { + return this.pathTemplates.datacenterConnectorPathTemplate.match( + datacenterConnectorName, + ).datacenter_connector; } /** @@ -9768,7 +13274,12 @@ export class VmMigrationClient { * @param {string} disk_migration_job * @returns {string} Resource name string. */ - diskMigrationJobPath(project:string,location:string,source:string,diskMigrationJob:string) { + diskMigrationJobPath( + project: string, + location: string, + source: string, + diskMigrationJob: string, + ) { return this.pathTemplates.diskMigrationJobPathTemplate.render({ project: project, location: location, @@ -9785,7 +13296,9 @@ export class VmMigrationClient { * @returns {string} A string representing the project. */ matchProjectFromDiskMigrationJobName(diskMigrationJobName: string) { - return this.pathTemplates.diskMigrationJobPathTemplate.match(diskMigrationJobName).project; + return this.pathTemplates.diskMigrationJobPathTemplate.match( + diskMigrationJobName, + ).project; } /** @@ -9796,7 +13309,9 @@ export class VmMigrationClient { * @returns {string} A string representing the location. */ matchLocationFromDiskMigrationJobName(diskMigrationJobName: string) { - return this.pathTemplates.diskMigrationJobPathTemplate.match(diskMigrationJobName).location; + return this.pathTemplates.diskMigrationJobPathTemplate.match( + diskMigrationJobName, + ).location; } /** @@ -9807,7 +13322,9 @@ export class VmMigrationClient { * @returns {string} A string representing the source. */ matchSourceFromDiskMigrationJobName(diskMigrationJobName: string) { - return this.pathTemplates.diskMigrationJobPathTemplate.match(diskMigrationJobName).source; + return this.pathTemplates.diskMigrationJobPathTemplate.match( + diskMigrationJobName, + ).source; } /** @@ -9818,7 +13335,9 @@ export class VmMigrationClient { * @returns {string} A string representing the disk_migration_job. */ matchDiskMigrationJobFromDiskMigrationJobName(diskMigrationJobName: string) { - return this.pathTemplates.diskMigrationJobPathTemplate.match(diskMigrationJobName).disk_migration_job; + return this.pathTemplates.diskMigrationJobPathTemplate.match( + diskMigrationJobName, + ).disk_migration_job; } /** @@ -9829,7 +13348,7 @@ export class VmMigrationClient { * @param {string} group * @returns {string} Resource name string. */ - groupPath(project:string,location:string,group:string) { + groupPath(project: string, location: string, group: string) { return this.pathTemplates.groupPathTemplate.render({ project: project, location: location, @@ -9878,7 +13397,7 @@ export class VmMigrationClient { * @param {string} job * @returns {string} Resource name string. */ - imageImportPath(project:string,location:string,job:string) { + imageImportPath(project: string, location: string, job: string) { return this.pathTemplates.imageImportPathTemplate.render({ project: project, location: location, @@ -9894,7 +13413,8 @@ export class VmMigrationClient { * @returns {string} A string representing the project. */ matchProjectFromImageImportName(imageImportName: string) { - return this.pathTemplates.imageImportPathTemplate.match(imageImportName).project; + return this.pathTemplates.imageImportPathTemplate.match(imageImportName) + .project; } /** @@ -9905,7 +13425,8 @@ export class VmMigrationClient { * @returns {string} A string representing the location. */ matchLocationFromImageImportName(imageImportName: string) { - return this.pathTemplates.imageImportPathTemplate.match(imageImportName).location; + return this.pathTemplates.imageImportPathTemplate.match(imageImportName) + .location; } /** @@ -9916,7 +13437,8 @@ export class VmMigrationClient { * @returns {string} A string representing the job. */ matchJobFromImageImportName(imageImportName: string) { - return this.pathTemplates.imageImportPathTemplate.match(imageImportName).job; + return this.pathTemplates.imageImportPathTemplate.match(imageImportName) + .job; } /** @@ -9928,7 +13450,12 @@ export class VmMigrationClient { * @param {string} result * @returns {string} Resource name string. */ - imageImportJobPath(project:string,location:string,job:string,result:string) { + imageImportJobPath( + project: string, + location: string, + job: string, + result: string, + ) { return this.pathTemplates.imageImportJobPathTemplate.render({ project: project, location: location, @@ -9945,7 +13472,9 @@ export class VmMigrationClient { * @returns {string} A string representing the project. */ matchProjectFromImageImportJobName(imageImportJobName: string) { - return this.pathTemplates.imageImportJobPathTemplate.match(imageImportJobName).project; + return this.pathTemplates.imageImportJobPathTemplate.match( + imageImportJobName, + ).project; } /** @@ -9956,7 +13485,9 @@ export class VmMigrationClient { * @returns {string} A string representing the location. */ matchLocationFromImageImportJobName(imageImportJobName: string) { - return this.pathTemplates.imageImportJobPathTemplate.match(imageImportJobName).location; + return this.pathTemplates.imageImportJobPathTemplate.match( + imageImportJobName, + ).location; } /** @@ -9967,7 +13498,9 @@ export class VmMigrationClient { * @returns {string} A string representing the job. */ matchJobFromImageImportJobName(imageImportJobName: string) { - return this.pathTemplates.imageImportJobPathTemplate.match(imageImportJobName).job; + return this.pathTemplates.imageImportJobPathTemplate.match( + imageImportJobName, + ).job; } /** @@ -9978,7 +13511,9 @@ export class VmMigrationClient { * @returns {string} A string representing the result. */ matchResultFromImageImportJobName(imageImportJobName: string) { - return this.pathTemplates.imageImportJobPathTemplate.match(imageImportJobName).result; + return this.pathTemplates.imageImportJobPathTemplate.match( + imageImportJobName, + ).result; } /** @@ -9988,7 +13523,7 @@ export class VmMigrationClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -10026,7 +13561,12 @@ export class VmMigrationClient { * @param {string} migrating_vm * @returns {string} Resource name string. */ - migratingVmPath(project:string,location:string,source:string,migratingVm:string) { + migratingVmPath( + project: string, + location: string, + source: string, + migratingVm: string, + ) { return this.pathTemplates.migratingVmPathTemplate.render({ project: project, location: location, @@ -10043,7 +13583,8 @@ export class VmMigrationClient { * @returns {string} A string representing the project. */ matchProjectFromMigratingVmName(migratingVmName: string) { - return this.pathTemplates.migratingVmPathTemplate.match(migratingVmName).project; + return this.pathTemplates.migratingVmPathTemplate.match(migratingVmName) + .project; } /** @@ -10054,7 +13595,8 @@ export class VmMigrationClient { * @returns {string} A string representing the location. */ matchLocationFromMigratingVmName(migratingVmName: string) { - return this.pathTemplates.migratingVmPathTemplate.match(migratingVmName).location; + return this.pathTemplates.migratingVmPathTemplate.match(migratingVmName) + .location; } /** @@ -10065,7 +13607,8 @@ export class VmMigrationClient { * @returns {string} A string representing the source. */ matchSourceFromMigratingVmName(migratingVmName: string) { - return this.pathTemplates.migratingVmPathTemplate.match(migratingVmName).source; + return this.pathTemplates.migratingVmPathTemplate.match(migratingVmName) + .source; } /** @@ -10076,7 +13619,8 @@ export class VmMigrationClient { * @returns {string} A string representing the migrating_vm. */ matchMigratingVmFromMigratingVmName(migratingVmName: string) { - return this.pathTemplates.migratingVmPathTemplate.match(migratingVmName).migrating_vm; + return this.pathTemplates.migratingVmPathTemplate.match(migratingVmName) + .migrating_vm; } /** @@ -10085,7 +13629,7 @@ export class VmMigrationClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -10112,7 +13656,13 @@ export class VmMigrationClient { * @param {string} replication_cycle * @returns {string} Resource name string. */ - replicationCyclePath(project:string,location:string,source:string,migratingVm:string,replicationCycle:string) { + replicationCyclePath( + project: string, + location: string, + source: string, + migratingVm: string, + replicationCycle: string, + ) { return this.pathTemplates.replicationCyclePathTemplate.render({ project: project, location: location, @@ -10130,7 +13680,9 @@ export class VmMigrationClient { * @returns {string} A string representing the project. */ matchProjectFromReplicationCycleName(replicationCycleName: string) { - return this.pathTemplates.replicationCyclePathTemplate.match(replicationCycleName).project; + return this.pathTemplates.replicationCyclePathTemplate.match( + replicationCycleName, + ).project; } /** @@ -10141,7 +13693,9 @@ export class VmMigrationClient { * @returns {string} A string representing the location. */ matchLocationFromReplicationCycleName(replicationCycleName: string) { - return this.pathTemplates.replicationCyclePathTemplate.match(replicationCycleName).location; + return this.pathTemplates.replicationCyclePathTemplate.match( + replicationCycleName, + ).location; } /** @@ -10152,7 +13706,9 @@ export class VmMigrationClient { * @returns {string} A string representing the source. */ matchSourceFromReplicationCycleName(replicationCycleName: string) { - return this.pathTemplates.replicationCyclePathTemplate.match(replicationCycleName).source; + return this.pathTemplates.replicationCyclePathTemplate.match( + replicationCycleName, + ).source; } /** @@ -10163,7 +13719,9 @@ export class VmMigrationClient { * @returns {string} A string representing the migrating_vm. */ matchMigratingVmFromReplicationCycleName(replicationCycleName: string) { - return this.pathTemplates.replicationCyclePathTemplate.match(replicationCycleName).migrating_vm; + return this.pathTemplates.replicationCyclePathTemplate.match( + replicationCycleName, + ).migrating_vm; } /** @@ -10174,7 +13732,9 @@ export class VmMigrationClient { * @returns {string} A string representing the replication_cycle. */ matchReplicationCycleFromReplicationCycleName(replicationCycleName: string) { - return this.pathTemplates.replicationCyclePathTemplate.match(replicationCycleName).replication_cycle; + return this.pathTemplates.replicationCyclePathTemplate.match( + replicationCycleName, + ).replication_cycle; } /** @@ -10184,7 +13744,7 @@ export class VmMigrationClient { * @param {string} service_account * @returns {string} Resource name string. */ - serviceAccountPath(project:string,serviceAccount:string) { + serviceAccountPath(project: string, serviceAccount: string) { return this.pathTemplates.serviceAccountPathTemplate.render({ project: project, service_account: serviceAccount, @@ -10199,7 +13759,9 @@ export class VmMigrationClient { * @returns {string} A string representing the project. */ matchProjectFromServiceAccountName(serviceAccountName: string) { - return this.pathTemplates.serviceAccountPathTemplate.match(serviceAccountName).project; + return this.pathTemplates.serviceAccountPathTemplate.match( + serviceAccountName, + ).project; } /** @@ -10210,7 +13772,9 @@ export class VmMigrationClient { * @returns {string} A string representing the service_account. */ matchServiceAccountFromServiceAccountName(serviceAccountName: string) { - return this.pathTemplates.serviceAccountPathTemplate.match(serviceAccountName).service_account; + return this.pathTemplates.serviceAccountPathTemplate.match( + serviceAccountName, + ).service_account; } /** @@ -10221,7 +13785,7 @@ export class VmMigrationClient { * @param {string} source * @returns {string} Resource name string. */ - sourcePath(project:string,location:string,source:string) { + sourcePath(project: string, location: string, source: string) { return this.pathTemplates.sourcePathTemplate.render({ project: project, location: location, @@ -10270,7 +13834,7 @@ export class VmMigrationClient { * @param {string} target_project * @returns {string} Resource name string. */ - targetProjectPath(project:string,location:string,targetProject:string) { + targetProjectPath(project: string, location: string, targetProject: string) { return this.pathTemplates.targetProjectPathTemplate.render({ project: project, location: location, @@ -10286,7 +13850,8 @@ export class VmMigrationClient { * @returns {string} A string representing the project. */ matchProjectFromTargetProjectName(targetProjectName: string) { - return this.pathTemplates.targetProjectPathTemplate.match(targetProjectName).project; + return this.pathTemplates.targetProjectPathTemplate.match(targetProjectName) + .project; } /** @@ -10297,7 +13862,8 @@ export class VmMigrationClient { * @returns {string} A string representing the location. */ matchLocationFromTargetProjectName(targetProjectName: string) { - return this.pathTemplates.targetProjectPathTemplate.match(targetProjectName).location; + return this.pathTemplates.targetProjectPathTemplate.match(targetProjectName) + .location; } /** @@ -10308,7 +13874,8 @@ export class VmMigrationClient { * @returns {string} A string representing the target_project. */ matchTargetProjectFromTargetProjectName(targetProjectName: string) { - return this.pathTemplates.targetProjectPathTemplate.match(targetProjectName).target_project; + return this.pathTemplates.targetProjectPathTemplate.match(targetProjectName) + .target_project; } /** @@ -10320,7 +13887,12 @@ export class VmMigrationClient { * @param {string} utilization_report * @returns {string} Resource name string. */ - utilizationReportPath(project:string,location:string,source:string,utilizationReport:string) { + utilizationReportPath( + project: string, + location: string, + source: string, + utilizationReport: string, + ) { return this.pathTemplates.utilizationReportPathTemplate.render({ project: project, location: location, @@ -10337,7 +13909,9 @@ export class VmMigrationClient { * @returns {string} A string representing the project. */ matchProjectFromUtilizationReportName(utilizationReportName: string) { - return this.pathTemplates.utilizationReportPathTemplate.match(utilizationReportName).project; + return this.pathTemplates.utilizationReportPathTemplate.match( + utilizationReportName, + ).project; } /** @@ -10348,7 +13922,9 @@ export class VmMigrationClient { * @returns {string} A string representing the location. */ matchLocationFromUtilizationReportName(utilizationReportName: string) { - return this.pathTemplates.utilizationReportPathTemplate.match(utilizationReportName).location; + return this.pathTemplates.utilizationReportPathTemplate.match( + utilizationReportName, + ).location; } /** @@ -10359,7 +13935,9 @@ export class VmMigrationClient { * @returns {string} A string representing the source. */ matchSourceFromUtilizationReportName(utilizationReportName: string) { - return this.pathTemplates.utilizationReportPathTemplate.match(utilizationReportName).source; + return this.pathTemplates.utilizationReportPathTemplate.match( + utilizationReportName, + ).source; } /** @@ -10369,8 +13947,12 @@ export class VmMigrationClient { * A fully-qualified path representing UtilizationReport resource. * @returns {string} A string representing the utilization_report. */ - matchUtilizationReportFromUtilizationReportName(utilizationReportName: string) { - return this.pathTemplates.utilizationReportPathTemplate.match(utilizationReportName).utilization_report; + matchUtilizationReportFromUtilizationReportName( + utilizationReportName: string, + ) { + return this.pathTemplates.utilizationReportPathTemplate.match( + utilizationReportName, + ).utilization_report; } /** @@ -10381,14 +13963,16 @@ export class VmMigrationClient { */ close(): Promise { if (this.vmMigrationStub && !this._terminated) { - return this.vmMigrationStub.then(stub => { + return this.vmMigrationStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-vmmigration/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-vmmigration/system-test/fixtures/sample/src/index.ts index 637e35fa6bf9..b78d3522c554 100644 --- a/packages/google-cloud-vmmigration/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-vmmigration/system-test/fixtures/sample/src/index.ts @@ -16,7 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {VmMigrationClient} from '@google-cloud/vmmigration'; +import { VmMigrationClient } from '@google-cloud/vmmigration'; // check that the client class type name can be used function doStuffWithVmMigrationClient(client: VmMigrationClient) { diff --git a/packages/google-cloud-vmmigration/system-test/install.ts b/packages/google-cloud-vmmigration/system-test/install.ts index 394f3362d203..ccf167042d2e 100644 --- a/packages/google-cloud-vmmigration/system-test/install.ts +++ b/packages/google-cloud-vmmigration/system-test/install.ts @@ -16,34 +16,36 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { + it('TypeScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts', + ).toString(), + }, }; await packNTest(options); }); - it('JavaScript code', async function() { + it('JavaScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } + cjs: readFileSync( + './system-test/fixtures/sample/src/index.js', + ).toString(), + }, }; await packNTest(options); }); - }); diff --git a/packages/google-cloud-vmmigration/test/gapic_vm_migration_v1.ts b/packages/google-cloud-vmmigration/test/gapic_vm_migration_v1.ts index 922ccdc9548b..3cb5f8a8e698 100644 --- a/packages/google-cloud-vmmigration/test/gapic_vm_migration_v1.ts +++ b/packages/google-cloud-vmmigration/test/gapic_vm_migration_v1.ts @@ -19,11636 +19,15091 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as vmmigrationModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); } -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.VmMigrationClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new vmmigrationModule.v1.VmMigrationClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'vmmigration.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new vmmigrationModule.v1.VmMigrationClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'vmmigration.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new vmmigrationModule.v1.VmMigrationClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new vmmigrationModule.v1.VmMigrationClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = vmmigrationModule.v1.VmMigrationClient.servicePath; - assert.strictEqual(servicePath, 'vmmigration.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = vmmigrationModule.v1.VmMigrationClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'vmmigration.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new vmmigrationModule.v1.VmMigrationClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'vmmigration.example.com'); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = vmmigrationModule.v1.VmMigrationClient.servicePath; + assert.strictEqual(servicePath, 'vmmigration.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = vmmigrationModule.v1.VmMigrationClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'vmmigration.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'vmmigration.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new vmmigrationModule.v1.VmMigrationClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'vmmigration.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'vmmigration.example.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new vmmigrationModule.v1.VmMigrationClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'vmmigration.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new vmmigrationModule.v1.VmMigrationClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'vmmigration.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new vmmigrationModule.v1.VmMigrationClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new vmmigrationModule.v1.VmMigrationClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'vmmigration.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new vmmigrationModule.v1.VmMigrationClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'vmmigration.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new vmmigrationModule.v1.VmMigrationClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has port', () => { - const port = vmmigrationModule.v1.VmMigrationClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has port', () => { + const port = vmmigrationModule.v1.VmMigrationClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with no option', () => { - const client = new vmmigrationModule.v1.VmMigrationClient(); - assert(client); - }); + it('should create a client with no option', () => { + const client = new vmmigrationModule.v1.VmMigrationClient(); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + fallback: true, + }); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.vmMigrationStub, undefined); - await client.initialize(); - assert(client.vmMigrationStub); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.vmMigrationStub, undefined); + await client.initialize(); + assert(client.vmMigrationStub); + }); - it('has close method for the initialized client', done => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.vmMigrationStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.vmMigrationStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has close method for the non-initialized client', done => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.vmMigrationStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the non-initialized client', (done) => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.vmMigrationStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getSource', () => { + it('invokes getSource without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetSourceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetSourceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.Source(), + ); + client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); + const [response] = await client.getSource(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getSource', () => { - it('invokes getSource without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.Source() - ); - client.innerApiCalls.getSource = stubSimpleCall(expectedResponse); - const [response] = await client.getSource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSource without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetSourceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetSourceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.Source(), + ); + client.innerApiCalls.getSource = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSource( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.ISource | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSource without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.Source() - ); - client.innerApiCalls.getSource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSource( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.ISource|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSource with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetSourceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetSourceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSource(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSource with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSource(request), expectedError); - const actualRequest = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSource with closed client', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetSourceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetSourceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getSource(request), expectedError); + }); + }); + + describe('fetchInventory', () => { + it('invokes fetchInventory without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FetchInventoryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FetchInventoryRequest', + ['source'], + ); + request.source = defaultValue1; + const expectedHeaderRequestParams = `source=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FetchInventoryResponse(), + ); + client.innerApiCalls.fetchInventory = stubSimpleCall(expectedResponse); + const [response] = await client.fetchInventory(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.fetchInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSource with closed client', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetSourceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSource(request), expectedError); - }); + it('invokes fetchInventory without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FetchInventoryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FetchInventoryRequest', + ['source'], + ); + request.source = defaultValue1; + const expectedHeaderRequestParams = `source=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FetchInventoryResponse(), + ); + client.innerApiCalls.fetchInventory = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchInventory( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.IFetchInventoryResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.fetchInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('fetchInventory', () => { - it('invokes fetchInventory without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FetchInventoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FetchInventoryRequest', ['source']); - request.source = defaultValue1; - const expectedHeaderRequestParams = `source=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FetchInventoryResponse() - ); - client.innerApiCalls.fetchInventory = stubSimpleCall(expectedResponse); - const [response] = await client.fetchInventory(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchInventory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchInventory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes fetchInventory with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FetchInventoryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FetchInventoryRequest', + ['source'], + ); + request.source = defaultValue1; + const expectedHeaderRequestParams = `source=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchInventory = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.fetchInventory(request), expectedError); + const actualRequest = ( + client.innerApiCalls.fetchInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes fetchInventory without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FetchInventoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FetchInventoryRequest', ['source']); - request.source = defaultValue1; - const expectedHeaderRequestParams = `source=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FetchInventoryResponse() - ); - client.innerApiCalls.fetchInventory = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchInventory( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IFetchInventoryResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchInventory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchInventory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes fetchInventory with closed client', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FetchInventoryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FetchInventoryRequest', + ['source'], + ); + request.source = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.fetchInventory(request), expectedError); + }); + }); + + describe('getUtilizationReport', () => { + it('invokes getUtilizationReport without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetUtilizationReportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetUtilizationReportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UtilizationReport(), + ); + client.innerApiCalls.getUtilizationReport = + stubSimpleCall(expectedResponse); + const [response] = await client.getUtilizationReport(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getUtilizationReport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUtilizationReport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes fetchInventory with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FetchInventoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FetchInventoryRequest', ['source']); - request.source = defaultValue1; - const expectedHeaderRequestParams = `source=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchInventory = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchInventory(request), expectedError); - const actualRequest = (client.innerApiCalls.fetchInventory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchInventory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getUtilizationReport without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetUtilizationReportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetUtilizationReportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UtilizationReport(), + ); + client.innerApiCalls.getUtilizationReport = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getUtilizationReport( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.IUtilizationReport | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getUtilizationReport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUtilizationReport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes fetchInventory with closed client', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FetchInventoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FetchInventoryRequest', ['source']); - request.source = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.fetchInventory(request), expectedError); - }); + it('invokes getUtilizationReport with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetUtilizationReportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetUtilizationReportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getUtilizationReport = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getUtilizationReport(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getUtilizationReport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getUtilizationReport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getUtilizationReport', () => { - it('invokes getUtilizationReport without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetUtilizationReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetUtilizationReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UtilizationReport() - ); - client.innerApiCalls.getUtilizationReport = stubSimpleCall(expectedResponse); - const [response] = await client.getUtilizationReport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUtilizationReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUtilizationReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getUtilizationReport with closed client', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetUtilizationReportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetUtilizationReportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getUtilizationReport(request), expectedError); + }); + }); + + describe('getDatacenterConnector', () => { + it('invokes getDatacenterConnector without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DatacenterConnector(), + ); + client.innerApiCalls.getDatacenterConnector = + stubSimpleCall(expectedResponse); + const [response] = await client.getDatacenterConnector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDatacenterConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDatacenterConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getUtilizationReport without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetUtilizationReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetUtilizationReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UtilizationReport() - ); - client.innerApiCalls.getUtilizationReport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getUtilizationReport( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IUtilizationReport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUtilizationReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUtilizationReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDatacenterConnector without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DatacenterConnector(), + ); + client.innerApiCalls.getDatacenterConnector = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDatacenterConnector( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.IDatacenterConnector | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDatacenterConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDatacenterConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getUtilizationReport with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetUtilizationReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetUtilizationReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getUtilizationReport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getUtilizationReport(request), expectedError); - const actualRequest = (client.innerApiCalls.getUtilizationReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUtilizationReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDatacenterConnector with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDatacenterConnector = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getDatacenterConnector(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getDatacenterConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDatacenterConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getUtilizationReport with closed client', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetUtilizationReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetUtilizationReportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getUtilizationReport(request), expectedError); - }); + it('invokes getDatacenterConnector with closed client', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getDatacenterConnector(request), + expectedError, + ); + }); + }); + + describe('getMigratingVm', () => { + it('invokes getMigratingVm without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetMigratingVmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetMigratingVmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.MigratingVm(), + ); + client.innerApiCalls.getMigratingVm = stubSimpleCall(expectedResponse); + const [response] = await client.getMigratingVm(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getDatacenterConnector', () => { - it('invokes getDatacenterConnector without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DatacenterConnector() - ); - client.innerApiCalls.getDatacenterConnector = stubSimpleCall(expectedResponse); - const [response] = await client.getDatacenterConnector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDatacenterConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDatacenterConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMigratingVm without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetMigratingVmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetMigratingVmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.MigratingVm(), + ); + client.innerApiCalls.getMigratingVm = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMigratingVm( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.IMigratingVm | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDatacenterConnector without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DatacenterConnector() - ); - client.innerApiCalls.getDatacenterConnector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDatacenterConnector( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IDatacenterConnector|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDatacenterConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDatacenterConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMigratingVm with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetMigratingVmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetMigratingVmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMigratingVm = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getMigratingVm(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDatacenterConnector with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDatacenterConnector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDatacenterConnector(request), expectedError); - const actualRequest = (client.innerApiCalls.getDatacenterConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDatacenterConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getMigratingVm with closed client', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetMigratingVmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetMigratingVmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getMigratingVm(request), expectedError); + }); + }); + + describe('getCloneJob', () => { + it('invokes getCloneJob without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetCloneJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetCloneJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CloneJob(), + ); + client.innerApiCalls.getCloneJob = stubSimpleCall(expectedResponse); + const [response] = await client.getCloneJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCloneJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCloneJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDatacenterConnector with closed client', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetDatacenterConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDatacenterConnector(request), expectedError); - }); + it('invokes getCloneJob without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetCloneJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetCloneJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CloneJob(), + ); + client.innerApiCalls.getCloneJob = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCloneJob( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.ICloneJob | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCloneJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCloneJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getMigratingVm', () => { - it('invokes getMigratingVm without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetMigratingVmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetMigratingVmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.MigratingVm() - ); - client.innerApiCalls.getMigratingVm = stubSimpleCall(expectedResponse); - const [response] = await client.getMigratingVm(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getCloneJob with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetCloneJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetCloneJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCloneJob = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getCloneJob(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getCloneJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCloneJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getMigratingVm without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetMigratingVmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetMigratingVmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.MigratingVm() - ); - client.innerApiCalls.getMigratingVm = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMigratingVm( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IMigratingVm|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getCloneJob with closed client', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetCloneJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetCloneJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getCloneJob(request), expectedError); + }); + }); + + describe('getCutoverJob', () => { + it('invokes getCutoverJob without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetCutoverJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetCutoverJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CutoverJob(), + ); + client.innerApiCalls.getCutoverJob = stubSimpleCall(expectedResponse); + const [response] = await client.getCutoverJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCutoverJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCutoverJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getMigratingVm with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetMigratingVmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetMigratingVmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMigratingVm = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMigratingVm(request), expectedError); - const actualRequest = (client.innerApiCalls.getMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getCutoverJob without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetCutoverJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetCutoverJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CutoverJob(), + ); + client.innerApiCalls.getCutoverJob = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCutoverJob( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.ICutoverJob | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCutoverJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCutoverJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getMigratingVm with closed client', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetMigratingVmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetMigratingVmRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMigratingVm(request), expectedError); - }); + it('invokes getCutoverJob with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetCutoverJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetCutoverJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCutoverJob = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getCutoverJob(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getCutoverJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCutoverJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getCloneJob', () => { - it('invokes getCloneJob without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetCloneJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetCloneJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CloneJob() - ); - client.innerApiCalls.getCloneJob = stubSimpleCall(expectedResponse); - const [response] = await client.getCloneJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCloneJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCloneJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getCutoverJob with closed client', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetCutoverJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetCutoverJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getCutoverJob(request), expectedError); + }); + }); + + describe('getGroup', () => { + it('invokes getGroup without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.Group(), + ); + client.innerApiCalls.getGroup = stubSimpleCall(expectedResponse); + const [response] = await client.getGroup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getCloneJob without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetCloneJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetCloneJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CloneJob() - ); - client.innerApiCalls.getCloneJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCloneJob( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.ICloneJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCloneJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCloneJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getGroup without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.Group(), + ); + client.innerApiCalls.getGroup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getGroup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.IGroup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getCloneJob with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetCloneJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetCloneJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCloneJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCloneJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getCloneJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCloneJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getGroup with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getGroup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getCloneJob with closed client', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetCloneJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetCloneJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getCloneJob(request), expectedError); - }); + it('invokes getGroup with closed client', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getGroup(request), expectedError); + }); + }); + + describe('getTargetProject', () => { + it('invokes getTargetProject without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetTargetProjectRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetTargetProjectRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.TargetProject(), + ); + client.innerApiCalls.getTargetProject = stubSimpleCall(expectedResponse); + const [response] = await client.getTargetProject(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getCutoverJob', () => { - it('invokes getCutoverJob without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetCutoverJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetCutoverJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CutoverJob() - ); - client.innerApiCalls.getCutoverJob = stubSimpleCall(expectedResponse); - const [response] = await client.getCutoverJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCutoverJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCutoverJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getTargetProject without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetTargetProjectRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetTargetProjectRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.TargetProject(), + ); + client.innerApiCalls.getTargetProject = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getTargetProject( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.ITargetProject | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getCutoverJob without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetCutoverJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetCutoverJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CutoverJob() - ); - client.innerApiCalls.getCutoverJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCutoverJob( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.ICutoverJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCutoverJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCutoverJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getTargetProject with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetTargetProjectRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetTargetProjectRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getTargetProject = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getTargetProject(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getCutoverJob with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetCutoverJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetCutoverJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCutoverJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCutoverJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getCutoverJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCutoverJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getTargetProject with closed client', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetTargetProjectRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetTargetProjectRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getTargetProject(request), expectedError); + }); + }); + + describe('getReplicationCycle', () => { + it('invokes getReplicationCycle without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetReplicationCycleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetReplicationCycleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ReplicationCycle(), + ); + client.innerApiCalls.getReplicationCycle = + stubSimpleCall(expectedResponse); + const [response] = await client.getReplicationCycle(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getReplicationCycle as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getReplicationCycle as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getCutoverJob with closed client', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetCutoverJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetCutoverJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getCutoverJob(request), expectedError); - }); + it('invokes getReplicationCycle without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetReplicationCycleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetReplicationCycleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ReplicationCycle(), + ); + client.innerApiCalls.getReplicationCycle = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getReplicationCycle( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.IReplicationCycle | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getReplicationCycle as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getReplicationCycle as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getGroup', () => { - it('invokes getGroup without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.Group() - ); - client.innerApiCalls.getGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getReplicationCycle with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetReplicationCycleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetReplicationCycleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getReplicationCycle = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getReplicationCycle(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getReplicationCycle as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getReplicationCycle as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGroup without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.Group() - ); - client.innerApiCalls.getGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGroup( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getReplicationCycle with closed client', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetReplicationCycleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetReplicationCycleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getReplicationCycle(request), expectedError); + }); + }); + + describe('getImageImport', () => { + it('invokes getImageImport without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetImageImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetImageImportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImport(), + ); + client.innerApiCalls.getImageImport = stubSimpleCall(expectedResponse); + const [response] = await client.getImageImport(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getImageImport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getImageImport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGroup with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getImageImport without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetImageImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetImageImportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImport(), + ); + client.innerApiCalls.getImageImport = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getImageImport( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.IImageImport | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getImageImport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getImageImport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getGroup with closed client', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getGroup(request), expectedError); - }); + it('invokes getImageImport with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetImageImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetImageImportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getImageImport = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getImageImport(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getImageImport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getImageImport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getTargetProject', () => { - it('invokes getTargetProject without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetTargetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetTargetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.TargetProject() - ); - client.innerApiCalls.getTargetProject = stubSimpleCall(expectedResponse); - const [response] = await client.getTargetProject(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getImageImport with closed client', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetImageImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetImageImportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getImageImport(request), expectedError); + }); + }); + + describe('getImageImportJob', () => { + it('invokes getImageImportJob without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetImageImportJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetImageImportJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImportJob(), + ); + client.innerApiCalls.getImageImportJob = stubSimpleCall(expectedResponse); + const [response] = await client.getImageImportJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getImageImportJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getImageImportJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getTargetProject without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetTargetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetTargetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.TargetProject() - ); - client.innerApiCalls.getTargetProject = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTargetProject( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.ITargetProject|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getImageImportJob without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetImageImportJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetImageImportJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImportJob(), + ); + client.innerApiCalls.getImageImportJob = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getImageImportJob( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.IImageImportJob | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getImageImportJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getImageImportJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getTargetProject with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetTargetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetTargetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getTargetProject = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTargetProject(request), expectedError); - const actualRequest = (client.innerApiCalls.getTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getImageImportJob with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetImageImportJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetImageImportJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getImageImportJob = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getImageImportJob(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getImageImportJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getImageImportJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getTargetProject with closed client', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetTargetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetTargetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getTargetProject(request), expectedError); - }); + it('invokes getImageImportJob with closed client', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetImageImportJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetImageImportJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getImageImportJob(request), expectedError); + }); + }); + + describe('getDiskMigrationJob', () => { + it('invokes getDiskMigrationJob without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DiskMigrationJob(), + ); + client.innerApiCalls.getDiskMigrationJob = + stubSimpleCall(expectedResponse); + const [response] = await client.getDiskMigrationJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getReplicationCycle', () => { - it('invokes getReplicationCycle without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetReplicationCycleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetReplicationCycleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ReplicationCycle() - ); - client.innerApiCalls.getReplicationCycle = stubSimpleCall(expectedResponse); - const [response] = await client.getReplicationCycle(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getReplicationCycle as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getReplicationCycle as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDiskMigrationJob without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DiskMigrationJob(), + ); + client.innerApiCalls.getDiskMigrationJob = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDiskMigrationJob( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.IDiskMigrationJob | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getReplicationCycle without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetReplicationCycleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetReplicationCycleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ReplicationCycle() - ); - client.innerApiCalls.getReplicationCycle = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getReplicationCycle( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IReplicationCycle|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getReplicationCycle as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getReplicationCycle as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDiskMigrationJob with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDiskMigrationJob = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDiskMigrationJob(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getReplicationCycle with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetReplicationCycleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetReplicationCycleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getReplicationCycle = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getReplicationCycle(request), expectedError); - const actualRequest = (client.innerApiCalls.getReplicationCycle as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getReplicationCycle as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDiskMigrationJob with closed client', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDiskMigrationJob(request), expectedError); + }); + }); + + describe('createSource', () => { + it('invokes createSource without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateSourceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateSourceRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSource = stubLongRunningCall(expectedResponse); + const [operation] = await client.createSource(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getReplicationCycle with closed client', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetReplicationCycleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetReplicationCycleRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getReplicationCycle(request), expectedError); - }); + it('invokes createSource without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateSourceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateSourceRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSource = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSource( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getImageImport', () => { - it('invokes getImageImport without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetImageImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetImageImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ImageImport() - ); - client.innerApiCalls.getImageImport = stubSimpleCall(expectedResponse); - const [response] = await client.getImageImport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getImageImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImageImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSource with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateSourceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateSourceRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSource = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createSource(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getImageImport without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetImageImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetImageImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ImageImport() - ); - client.innerApiCalls.getImageImport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getImageImport( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IImageImport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getImageImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImageImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSource with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateSourceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateSourceRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSource = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createSource(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getImageImport with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetImageImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetImageImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getImageImport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getImageImport(request), expectedError); - const actualRequest = (client.innerApiCalls.getImageImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImageImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateSourceProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateSourceProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes getImageImport with closed client', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetImageImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetImageImportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getImageImport(request), expectedError); - }); + it('invokes checkCreateSourceProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkCreateSourceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateSource', () => { + it('invokes updateSource without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateSourceRequest(), + ); + request.source ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateSourceRequest', + ['source', 'name'], + ); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSource = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSource(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getImageImportJob', () => { - it('invokes getImageImportJob without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetImageImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetImageImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ImageImportJob() - ); - client.innerApiCalls.getImageImportJob = stubSimpleCall(expectedResponse); - const [response] = await client.getImageImportJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getImageImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImageImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSource without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateSourceRequest(), + ); + request.source ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateSourceRequest', + ['source', 'name'], + ); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSource = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSource( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.ISource, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getImageImportJob without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetImageImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetImageImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ImageImportJob() - ); - client.innerApiCalls.getImageImportJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getImageImportJob( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IImageImportJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getImageImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImageImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSource with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateSourceRequest(), + ); + request.source ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateSourceRequest', + ['source', 'name'], + ); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSource = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateSource(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getImageImportJob with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetImageImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetImageImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getImageImportJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getImageImportJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getImageImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImageImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSource with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateSourceRequest(), + ); + request.source ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateSourceRequest', + ['source', 'name'], + ); + request.source.name = defaultValue1; + const expectedHeaderRequestParams = `source.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSource = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateSource(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getImageImportJob with closed client', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetImageImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetImageImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getImageImportJob(request), expectedError); - }); + it('invokes checkUpdateSourceProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateSourceProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('getDiskMigrationJob', () => { - it('invokes getDiskMigrationJob without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DiskMigrationJob() - ); - client.innerApiCalls.getDiskMigrationJob = stubSimpleCall(expectedResponse); - const [response] = await client.getDiskMigrationJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateSourceProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkUpdateSourceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteSource', () => { + it('invokes deleteSource without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteSourceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteSourceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSource = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSource(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDiskMigrationJob without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DiskMigrationJob() - ); - client.innerApiCalls.getDiskMigrationJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDiskMigrationJob( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IDiskMigrationJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSource without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteSourceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteSourceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSource = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSource( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDiskMigrationJob with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDiskMigrationJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDiskMigrationJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteSource with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteSourceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteSourceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSource = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteSource(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDiskMigrationJob with closed client', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.GetDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDiskMigrationJob(request), expectedError); - }); + it('invokes deleteSource with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteSourceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteSourceRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSource = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteSource(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSource as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSource as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createSource', () => { - it('invokes createSource without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSource = stubLongRunningCall(expectedResponse); - const [operation] = await client.createSource(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteSourceProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteSourceProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createSource without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createSource = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSource( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteSourceProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkDeleteSourceProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createUtilizationReport', () => { + it('invokes createUtilizationReport without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateUtilizationReportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateUtilizationReportRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createUtilizationReport = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createUtilizationReport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createUtilizationReport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUtilizationReport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSource with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSource = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createSource(request), expectedError); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createUtilizationReport without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateUtilizationReportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateUtilizationReportRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createUtilizationReport = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createUtilizationReport( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IUtilizationReport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IUtilizationReport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createUtilizationReport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUtilizationReport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSource with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateSourceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSource = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createSource(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createUtilizationReport with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateUtilizationReportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateUtilizationReportRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createUtilizationReport = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createUtilizationReport(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createUtilizationReport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUtilizationReport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateSourceProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateSourceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createUtilizationReport with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateUtilizationReportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateUtilizationReportRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createUtilizationReport = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createUtilizationReport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createUtilizationReport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createUtilizationReport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateSourceProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateSourceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateUtilizationReportProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkCreateUtilizationReportProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateSource', () => { - it('invokes updateSource without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSource = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateSource(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateUtilizationReportProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateUtilizationReportProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteUtilizationReport', () => { + it('invokes deleteUtilizationReport without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteUtilizationReport = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteUtilizationReport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteUtilizationReport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUtilizationReport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSource without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSource = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSource( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteUtilizationReport without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteUtilizationReport = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteUtilizationReport( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteUtilizationReport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUtilizationReport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSource with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSource = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateSource(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteUtilizationReport with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteUtilizationReport = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteUtilizationReport(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteUtilizationReport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUtilizationReport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSource with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateSourceRequest() - ); - request.source ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateSourceRequest', ['source', 'name']); - request.source.name = defaultValue1; - const expectedHeaderRequestParams = `source.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSource = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateSource(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteUtilizationReport with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteUtilizationReport = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteUtilizationReport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteUtilizationReport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteUtilizationReport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateSourceProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateSourceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteUtilizationReportProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkDeleteUtilizationReportProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateSourceProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateSourceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteUtilizationReportProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteUtilizationReportProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createDatacenterConnector', () => { + it('invokes createDatacenterConnector without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createDatacenterConnector = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createDatacenterConnector(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDatacenterConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDatacenterConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteSource', () => { - it('invokes deleteSource without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSource = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteSource(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createDatacenterConnector without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createDatacenterConnector = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDatacenterConnector( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IDatacenterConnector, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDatacenterConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDatacenterConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSource without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteSource = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSource( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createDatacenterConnector with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDatacenterConnector = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createDatacenterConnector(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createDatacenterConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDatacenterConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSource with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSource = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteSource(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createDatacenterConnector with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDatacenterConnector = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createDatacenterConnector(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createDatacenterConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDatacenterConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteSource with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteSourceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteSourceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSource = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteSource(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateDatacenterConnectorProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkCreateDatacenterConnectorProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteSourceProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteSourceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateDatacenterConnectorProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateDatacenterConnectorProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteDatacenterConnector', () => { + it('invokes deleteDatacenterConnector without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteDatacenterConnector = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteDatacenterConnector(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDatacenterConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDatacenterConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteSourceProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteSourceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteDatacenterConnector without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteDatacenterConnector = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDatacenterConnector( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDatacenterConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDatacenterConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createUtilizationReport', () => { - it('invokes createUtilizationReport without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateUtilizationReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateUtilizationReportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createUtilizationReport = stubLongRunningCall(expectedResponse); - const [operation] = await client.createUtilizationReport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createUtilizationReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUtilizationReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteDatacenterConnector with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDatacenterConnector = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteDatacenterConnector(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteDatacenterConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDatacenterConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createUtilizationReport without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateUtilizationReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateUtilizationReportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createUtilizationReport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createUtilizationReport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createUtilizationReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUtilizationReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteDatacenterConnector with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDatacenterConnector = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteDatacenterConnector(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteDatacenterConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDatacenterConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createUtilizationReport with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateUtilizationReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateUtilizationReportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createUtilizationReport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createUtilizationReport(request), expectedError); - const actualRequest = (client.innerApiCalls.createUtilizationReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUtilizationReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteDatacenterConnectorProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkDeleteDatacenterConnectorProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createUtilizationReport with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateUtilizationReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateUtilizationReportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createUtilizationReport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createUtilizationReport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createUtilizationReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUtilizationReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteDatacenterConnectorProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteDatacenterConnectorProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('upgradeAppliance', () => { + it('invokes upgradeAppliance without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpgradeApplianceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpgradeApplianceRequest', + ['datacenterConnector'], + ); + request.datacenterConnector = defaultValue1; + const expectedHeaderRequestParams = `datacenter_connector=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.upgradeAppliance = + stubLongRunningCall(expectedResponse); + const [operation] = await client.upgradeAppliance(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.upgradeAppliance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.upgradeAppliance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateUtilizationReportProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateUtilizationReportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes upgradeAppliance without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpgradeApplianceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpgradeApplianceRequest', + ['datacenterConnector'], + ); + request.datacenterConnector = defaultValue1; + const expectedHeaderRequestParams = `datacenter_connector=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.upgradeAppliance = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.upgradeAppliance( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IUpgradeApplianceResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IUpgradeApplianceResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.upgradeAppliance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.upgradeAppliance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateUtilizationReportProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateUtilizationReportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes upgradeAppliance with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpgradeApplianceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpgradeApplianceRequest', + ['datacenterConnector'], + ); + request.datacenterConnector = defaultValue1; + const expectedHeaderRequestParams = `datacenter_connector=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.upgradeAppliance = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.upgradeAppliance(request), expectedError); + const actualRequest = ( + client.innerApiCalls.upgradeAppliance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.upgradeAppliance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteUtilizationReport', () => { - it('invokes deleteUtilizationReport without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteUtilizationReport = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteUtilizationReport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUtilizationReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUtilizationReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes upgradeAppliance with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpgradeApplianceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpgradeApplianceRequest', + ['datacenterConnector'], + ); + request.datacenterConnector = defaultValue1; + const expectedHeaderRequestParams = `datacenter_connector=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.upgradeAppliance = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.upgradeAppliance(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.upgradeAppliance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.upgradeAppliance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteUtilizationReport without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteUtilizationReport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteUtilizationReport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUtilizationReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUtilizationReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpgradeApplianceProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpgradeApplianceProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteUtilizationReport with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteUtilizationReport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteUtilizationReport(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteUtilizationReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUtilizationReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpgradeApplianceProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpgradeApplianceProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createMigratingVm', () => { + it('invokes createMigratingVm without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateMigratingVmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateMigratingVmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMigratingVm = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createMigratingVm(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteUtilizationReport with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteUtilizationReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteUtilizationReport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteUtilizationReport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteUtilizationReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUtilizationReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createMigratingVm without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateMigratingVmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateMigratingVmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createMigratingVm = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createMigratingVm( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteUtilizationReportProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteUtilizationReportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createMigratingVm with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateMigratingVmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateMigratingVmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMigratingVm = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createMigratingVm(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteUtilizationReportProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteUtilizationReportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createMigratingVm with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateMigratingVmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateMigratingVmRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createMigratingVm = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createMigratingVm(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createDatacenterConnector', () => { - it('invokes createDatacenterConnector without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createDatacenterConnector = stubLongRunningCall(expectedResponse); - const [operation] = await client.createDatacenterConnector(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDatacenterConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDatacenterConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateMigratingVmProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateMigratingVmProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createDatacenterConnector without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createDatacenterConnector = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDatacenterConnector( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDatacenterConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDatacenterConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateMigratingVmProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateMigratingVmProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateMigratingVm', () => { + it('invokes updateMigratingVm without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateMigratingVmRequest(), + ); + request.migratingVm ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateMigratingVmRequest', + ['migratingVm', 'name'], + ); + request.migratingVm.name = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMigratingVm = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateMigratingVm(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDatacenterConnector with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDatacenterConnector = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createDatacenterConnector(request), expectedError); - const actualRequest = (client.innerApiCalls.createDatacenterConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDatacenterConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMigratingVm without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateMigratingVmRequest(), + ); + request.migratingVm ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateMigratingVmRequest', + ['migratingVm', 'name'], + ); + request.migratingVm.name = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateMigratingVm = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateMigratingVm( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IMigratingVm, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDatacenterConnector with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateDatacenterConnectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDatacenterConnector = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createDatacenterConnector(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createDatacenterConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDatacenterConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateMigratingVm with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateMigratingVmRequest(), + ); + request.migratingVm ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateMigratingVmRequest', + ['migratingVm', 'name'], + ); + request.migratingVm.name = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMigratingVm = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateMigratingVm(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateDatacenterConnectorProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateDatacenterConnectorProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateMigratingVm with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateMigratingVmRequest(), + ); + request.migratingVm ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateMigratingVmRequest', + ['migratingVm', 'name'], + ); + request.migratingVm.name = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateMigratingVm = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateMigratingVm(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateDatacenterConnectorProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateDatacenterConnectorProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateMigratingVmProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateMigratingVmProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteDatacenterConnector', () => { - it('invokes deleteDatacenterConnector without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteDatacenterConnector = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteDatacenterConnector(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDatacenterConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDatacenterConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateMigratingVmProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateMigratingVmProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteMigratingVm', () => { + it('invokes deleteMigratingVm without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteMigratingVmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteMigratingVmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMigratingVm = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteMigratingVm(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteDatacenterConnector without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteDatacenterConnector = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDatacenterConnector( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDatacenterConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDatacenterConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMigratingVm without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteMigratingVmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteMigratingVmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteMigratingVm = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteMigratingVm( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteDatacenterConnector with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDatacenterConnector = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteDatacenterConnector(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDatacenterConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDatacenterConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMigratingVm with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteMigratingVmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteMigratingVmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMigratingVm = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteMigratingVm(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteDatacenterConnector with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteDatacenterConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDatacenterConnector = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteDatacenterConnector(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteDatacenterConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDatacenterConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteMigratingVm with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteMigratingVmRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteMigratingVmRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteMigratingVm = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteMigratingVm(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteMigratingVm as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteMigratingVm as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteDatacenterConnectorProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteDatacenterConnectorProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteMigratingVmProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteMigratingVmProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteDatacenterConnectorProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteDatacenterConnectorProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteMigratingVmProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteMigratingVmProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('startMigration', () => { + it('invokes startMigration without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.StartMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.StartMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.startMigration = + stubLongRunningCall(expectedResponse); + const [operation] = await client.startMigration(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('upgradeAppliance', () => { - it('invokes upgradeAppliance without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpgradeApplianceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpgradeApplianceRequest', ['datacenterConnector']); - request.datacenterConnector = defaultValue1; - const expectedHeaderRequestParams = `datacenter_connector=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.upgradeAppliance = stubLongRunningCall(expectedResponse); - const [operation] = await client.upgradeAppliance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.upgradeAppliance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.upgradeAppliance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes startMigration without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.StartMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.StartMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.startMigration = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startMigration( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IStartMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IStartMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes upgradeAppliance without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpgradeApplianceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpgradeApplianceRequest', ['datacenterConnector']); - request.datacenterConnector = defaultValue1; - const expectedHeaderRequestParams = `datacenter_connector=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.upgradeAppliance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.upgradeAppliance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.upgradeAppliance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.upgradeAppliance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes startMigration with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.StartMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.StartMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startMigration = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.startMigration(request), expectedError); + const actualRequest = ( + client.innerApiCalls.startMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes upgradeAppliance with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpgradeApplianceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpgradeApplianceRequest', ['datacenterConnector']); - request.datacenterConnector = defaultValue1; - const expectedHeaderRequestParams = `datacenter_connector=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.upgradeAppliance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.upgradeAppliance(request), expectedError); - const actualRequest = (client.innerApiCalls.upgradeAppliance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.upgradeAppliance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes startMigration with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.StartMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.StartMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startMigration = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.startMigration(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.startMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes upgradeAppliance with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpgradeApplianceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpgradeApplianceRequest', ['datacenterConnector']); - request.datacenterConnector = defaultValue1; - const expectedHeaderRequestParams = `datacenter_connector=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.upgradeAppliance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.upgradeAppliance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.upgradeAppliance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.upgradeAppliance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkStartMigrationProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkStartMigrationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpgradeApplianceProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpgradeApplianceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkStartMigrationProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkStartMigrationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('resumeMigration', () => { + it('invokes resumeMigration without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ResumeMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ResumeMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.resumeMigration = + stubLongRunningCall(expectedResponse); + const [operation] = await client.resumeMigration(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resumeMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resumeMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpgradeApplianceProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpgradeApplianceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes resumeMigration without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ResumeMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ResumeMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.resumeMigration = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resumeMigration( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IResumeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IResumeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resumeMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resumeMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createMigratingVm', () => { - it('invokes createMigratingVm without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateMigratingVmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateMigratingVmRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMigratingVm = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMigratingVm(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes resumeMigration with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ResumeMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ResumeMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resumeMigration = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.resumeMigration(request), expectedError); + const actualRequest = ( + client.innerApiCalls.resumeMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resumeMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMigratingVm without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateMigratingVmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateMigratingVmRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMigratingVm = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMigratingVm( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes resumeMigration with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ResumeMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ResumeMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resumeMigration = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.resumeMigration(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.resumeMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resumeMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createMigratingVm with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateMigratingVmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateMigratingVmRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMigratingVm = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMigratingVm(request), expectedError); - const actualRequest = (client.innerApiCalls.createMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkResumeMigrationProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkResumeMigrationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createMigratingVm with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateMigratingVmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateMigratingVmRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMigratingVm = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMigratingVm(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkResumeMigrationProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkResumeMigrationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('pauseMigration', () => { + it('invokes pauseMigration without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.PauseMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.PauseMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.pauseMigration = + stubLongRunningCall(expectedResponse); + const [operation] = await client.pauseMigration(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.pauseMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pauseMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMigratingVmProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateMigratingVmProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes pauseMigration without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.PauseMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.PauseMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.pauseMigration = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pauseMigration( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IPauseMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IPauseMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.pauseMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pauseMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateMigratingVmProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMigratingVmProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes pauseMigration with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.PauseMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.PauseMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.pauseMigration = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.pauseMigration(request), expectedError); + const actualRequest = ( + client.innerApiCalls.pauseMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pauseMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateMigratingVm', () => { - it('invokes updateMigratingVm without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateMigratingVmRequest() - ); - request.migratingVm ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateMigratingVmRequest', ['migratingVm', 'name']); - request.migratingVm.name = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMigratingVm = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateMigratingVm(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes pauseMigration with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.PauseMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.PauseMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.pauseMigration = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.pauseMigration(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.pauseMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pauseMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMigratingVm without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateMigratingVmRequest() - ); - request.migratingVm ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateMigratingVmRequest', ['migratingVm', 'name']); - request.migratingVm.name = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateMigratingVm = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateMigratingVm( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkPauseMigrationProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkPauseMigrationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateMigratingVm with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateMigratingVmRequest() - ); - request.migratingVm ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateMigratingVmRequest', ['migratingVm', 'name']); - request.migratingVm.name = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMigratingVm = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateMigratingVm(request), expectedError); - const actualRequest = (client.innerApiCalls.updateMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkPauseMigrationProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkPauseMigrationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('finalizeMigration', () => { + it('invokes finalizeMigration without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FinalizeMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FinalizeMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.finalizeMigration = + stubLongRunningCall(expectedResponse); + const [operation] = await client.finalizeMigration(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.finalizeMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.finalizeMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateMigratingVm with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateMigratingVmRequest() - ); - request.migratingVm ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateMigratingVmRequest', ['migratingVm', 'name']); - request.migratingVm.name = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateMigratingVm = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateMigratingVm(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes finalizeMigration without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FinalizeMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FinalizeMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.finalizeMigration = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.finalizeMigration( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IFinalizeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IFinalizeMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.finalizeMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.finalizeMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMigratingVmProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateMigratingVmProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes finalizeMigration with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FinalizeMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FinalizeMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.finalizeMigration = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.finalizeMigration(request), expectedError); + const actualRequest = ( + client.innerApiCalls.finalizeMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.finalizeMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateMigratingVmProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateMigratingVmProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes finalizeMigration with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FinalizeMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FinalizeMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.finalizeMigration = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.finalizeMigration(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.finalizeMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.finalizeMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteMigratingVm', () => { - it('invokes deleteMigratingVm without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteMigratingVmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteMigratingVmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMigratingVm = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteMigratingVm(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkFinalizeMigrationProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkFinalizeMigrationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteMigratingVm without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteMigratingVmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteMigratingVmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteMigratingVm = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMigratingVm( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkFinalizeMigrationProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkFinalizeMigrationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('extendMigration', () => { + it('invokes extendMigration without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ExtendMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ExtendMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.extendMigration = + stubLongRunningCall(expectedResponse); + const [operation] = await client.extendMigration(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.extendMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.extendMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMigratingVm with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteMigratingVmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteMigratingVmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMigratingVm = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteMigratingVm(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes extendMigration without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ExtendMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ExtendMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.extendMigration = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.extendMigration( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IExtendMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IExtendMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.extendMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.extendMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteMigratingVm with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteMigratingVmRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteMigratingVmRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMigratingVm = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteMigratingVm(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteMigratingVm as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMigratingVm as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes extendMigration with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ExtendMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ExtendMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.extendMigration = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.extendMigration(request), expectedError); + const actualRequest = ( + client.innerApiCalls.extendMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.extendMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteMigratingVmProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteMigratingVmProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes extendMigration with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ExtendMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ExtendMigrationRequest', + ['migratingVm'], + ); + request.migratingVm = defaultValue1; + const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.extendMigration = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.extendMigration(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.extendMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.extendMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteMigratingVmProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteMigratingVmProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkExtendMigrationProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkExtendMigrationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('startMigration', () => { - it('invokes startMigration without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.StartMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.StartMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.startMigration = stubLongRunningCall(expectedResponse); - const [operation] = await client.startMigration(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkExtendMigrationProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkExtendMigrationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createCloneJob', () => { + it('invokes createCloneJob without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateCloneJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateCloneJobRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createCloneJob = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createCloneJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCloneJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCloneJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes startMigration without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.StartMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.StartMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.startMigration = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startMigration( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createCloneJob without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateCloneJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateCloneJobRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createCloneJob = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCloneJob( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.ICloneJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCloneJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCloneJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes startMigration with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.StartMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.StartMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.startMigration = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.startMigration(request), expectedError); - const actualRequest = (client.innerApiCalls.startMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createCloneJob with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateCloneJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateCloneJobRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCloneJob = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createCloneJob(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createCloneJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCloneJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes startMigration with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.StartMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.StartMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.startMigration = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.startMigration(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.startMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createCloneJob with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateCloneJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateCloneJobRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCloneJob = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createCloneJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createCloneJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCloneJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkStartMigrationProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkStartMigrationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateCloneJobProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateCloneJobProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkStartMigrationProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkStartMigrationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateCloneJobProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateCloneJobProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('cancelCloneJob', () => { + it('invokes cancelCloneJob without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelCloneJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelCloneJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.cancelCloneJob = + stubLongRunningCall(expectedResponse); + const [operation] = await client.cancelCloneJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelCloneJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelCloneJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('resumeMigration', () => { - it('invokes resumeMigration without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ResumeMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ResumeMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.resumeMigration = stubLongRunningCall(expectedResponse); - const [operation] = await client.resumeMigration(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resumeMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cancelCloneJob without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelCloneJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelCloneJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.cancelCloneJob = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelCloneJob( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.ICancelCloneJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.ICancelCloneJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelCloneJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelCloneJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes resumeMigration without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ResumeMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ResumeMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.resumeMigration = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resumeMigration( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resumeMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cancelCloneJob with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelCloneJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelCloneJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelCloneJob = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.cancelCloneJob(request), expectedError); + const actualRequest = ( + client.innerApiCalls.cancelCloneJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelCloneJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes resumeMigration with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ResumeMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ResumeMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resumeMigration = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.resumeMigration(request), expectedError); - const actualRequest = (client.innerApiCalls.resumeMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cancelCloneJob with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelCloneJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelCloneJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelCloneJob = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.cancelCloneJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.cancelCloneJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelCloneJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes resumeMigration with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ResumeMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ResumeMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resumeMigration = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.resumeMigration(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.resumeMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCancelCloneJobProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCancelCloneJobProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkResumeMigrationProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkResumeMigrationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCancelCloneJobProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCancelCloneJobProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createCutoverJob', () => { + it('invokes createCutoverJob without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateCutoverJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateCutoverJobRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createCutoverJob = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createCutoverJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCutoverJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCutoverJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkResumeMigrationProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkResumeMigrationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createCutoverJob without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateCutoverJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateCutoverJobRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createCutoverJob = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCutoverJob( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.ICutoverJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.ICutoverJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCutoverJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCutoverJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('pauseMigration', () => { - it('invokes pauseMigration without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.PauseMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.PauseMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.pauseMigration = stubLongRunningCall(expectedResponse); - const [operation] = await client.pauseMigration(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pauseMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createCutoverJob with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateCutoverJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateCutoverJobRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCutoverJob = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createCutoverJob(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createCutoverJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCutoverJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes pauseMigration without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.PauseMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.PauseMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.pauseMigration = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pauseMigration( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pauseMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createCutoverJob with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateCutoverJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateCutoverJobRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCutoverJob = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createCutoverJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createCutoverJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCutoverJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes pauseMigration with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.PauseMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.PauseMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.pauseMigration = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.pauseMigration(request), expectedError); - const actualRequest = (client.innerApiCalls.pauseMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateCutoverJobProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateCutoverJobProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes pauseMigration with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.PauseMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.PauseMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.pauseMigration = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.pauseMigration(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.pauseMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateCutoverJobProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateCutoverJobProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('cancelCutoverJob', () => { + it('invokes cancelCutoverJob without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelCutoverJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelCutoverJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.cancelCutoverJob = + stubLongRunningCall(expectedResponse); + const [operation] = await client.cancelCutoverJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelCutoverJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelCutoverJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkPauseMigrationProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkPauseMigrationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes cancelCutoverJob without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelCutoverJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelCutoverJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.cancelCutoverJob = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelCutoverJob( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.ICancelCutoverJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.ICancelCutoverJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelCutoverJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelCutoverJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkPauseMigrationProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkPauseMigrationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes cancelCutoverJob with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelCutoverJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelCutoverJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelCutoverJob = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.cancelCutoverJob(request), expectedError); + const actualRequest = ( + client.innerApiCalls.cancelCutoverJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelCutoverJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('finalizeMigration', () => { - it('invokes finalizeMigration without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FinalizeMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FinalizeMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.finalizeMigration = stubLongRunningCall(expectedResponse); - const [operation] = await client.finalizeMigration(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.finalizeMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.finalizeMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cancelCutoverJob with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelCutoverJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelCutoverJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelCutoverJob = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.cancelCutoverJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.cancelCutoverJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelCutoverJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes finalizeMigration without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FinalizeMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FinalizeMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.finalizeMigration = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.finalizeMigration( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.finalizeMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.finalizeMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCancelCutoverJobProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCancelCutoverJobProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes finalizeMigration with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FinalizeMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FinalizeMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.finalizeMigration = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.finalizeMigration(request), expectedError); - const actualRequest = (client.innerApiCalls.finalizeMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.finalizeMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCancelCutoverJobProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCancelCutoverJobProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createGroup', () => { + it('invokes createGroup without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createGroup = stubLongRunningCall(expectedResponse); + const [operation] = await client.createGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes finalizeMigration with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FinalizeMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FinalizeMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.finalizeMigration = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.finalizeMigration(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.finalizeMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.finalizeMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createGroup without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkFinalizeMigrationProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkFinalizeMigrationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createGroup with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkFinalizeMigrationProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkFinalizeMigrationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createGroup with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateGroupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('extendMigration', () => { - it('invokes extendMigration without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ExtendMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ExtendMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.extendMigration = stubLongRunningCall(expectedResponse); - const [operation] = await client.extendMigration(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.extendMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.extendMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateGroupProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes extendMigration without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ExtendMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ExtendMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.extendMigration = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.extendMigration( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.extendMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.extendMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateGroupProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkCreateGroupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateGroup', () => { + it('invokes updateGroup without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateGroupRequest(), + ); + request.group ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateGroupRequest', + ['group', 'name'], + ); + request.group.name = defaultValue1; + const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateGroup = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes extendMigration with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ExtendMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ExtendMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.extendMigration = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.extendMigration(request), expectedError); - const actualRequest = (client.innerApiCalls.extendMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.extendMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateGroup without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateGroupRequest(), + ); + request.group ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateGroupRequest', + ['group', 'name'], + ); + request.group.name = defaultValue1; + const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IGroup, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes extendMigration with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ExtendMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ExtendMigrationRequest', ['migratingVm']); - request.migratingVm = defaultValue1; - const expectedHeaderRequestParams = `migrating_vm=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.extendMigration = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.extendMigration(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.extendMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.extendMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateGroup with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateGroupRequest(), + ); + request.group ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateGroupRequest', + ['group', 'name'], + ); + request.group.name = defaultValue1; + const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkExtendMigrationProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExtendMigrationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateGroup with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateGroupRequest(), + ); + request.group ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateGroupRequest', + ['group', 'name'], + ); + request.group.name = defaultValue1; + const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkExtendMigrationProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExtendMigrationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateGroupProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('createCloneJob', () => { - it('invokes createCloneJob without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateCloneJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateCloneJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCloneJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.createCloneJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCloneJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCloneJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateGroupProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkUpdateGroupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteGroup', () => { + it('invokes deleteGroup without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteGroup = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteGroup(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createCloneJob without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateCloneJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateCloneJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCloneJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCloneJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCloneJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCloneJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteGroup without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteGroup = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteGroup( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createCloneJob with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateCloneJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateCloneJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCloneJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createCloneJob(request), expectedError); - const actualRequest = (client.innerApiCalls.createCloneJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCloneJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteGroup with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGroup = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteGroup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createCloneJob with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateCloneJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateCloneJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCloneJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createCloneJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createCloneJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCloneJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteGroup with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteGroupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteGroupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteGroup = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteGroup(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteGroup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteGroup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateCloneJobProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateCloneJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteGroupProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteGroupProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateCloneJobProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateCloneJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteGroupProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkDeleteGroupProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('addGroupMigration', () => { + it('invokes addGroupMigration without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.AddGroupMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.AddGroupMigrationRequest', + ['group'], + ); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.addGroupMigration = + stubLongRunningCall(expectedResponse); + const [operation] = await client.addGroupMigration(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addGroupMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addGroupMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('cancelCloneJob', () => { - it('invokes cancelCloneJob without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelCloneJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelCloneJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.cancelCloneJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.cancelCloneJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelCloneJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelCloneJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addGroupMigration without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.AddGroupMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.AddGroupMigrationRequest', + ['group'], + ); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.addGroupMigration = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addGroupMigration( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IAddGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IAddGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addGroupMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addGroupMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelCloneJob without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelCloneJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelCloneJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.cancelCloneJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelCloneJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelCloneJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelCloneJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addGroupMigration with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.AddGroupMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.AddGroupMigrationRequest', + ['group'], + ); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addGroupMigration = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.addGroupMigration(request), expectedError); + const actualRequest = ( + client.innerApiCalls.addGroupMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addGroupMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelCloneJob with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelCloneJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelCloneJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelCloneJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.cancelCloneJob(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelCloneJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelCloneJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addGroupMigration with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.AddGroupMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.AddGroupMigrationRequest', + ['group'], + ); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addGroupMigration = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.addGroupMigration(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.addGroupMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addGroupMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelCloneJob with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelCloneJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelCloneJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelCloneJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.cancelCloneJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.cancelCloneJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelCloneJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkAddGroupMigrationProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkAddGroupMigrationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCancelCloneJobProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCancelCloneJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkAddGroupMigrationProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkAddGroupMigrationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('removeGroupMigration', () => { + it('invokes removeGroupMigration without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest', + ['group'], + ); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.removeGroupMigration = + stubLongRunningCall(expectedResponse); + const [operation] = await client.removeGroupMigration(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.removeGroupMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeGroupMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCancelCloneJobProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCancelCloneJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes removeGroupMigration without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest', + ['group'], + ); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.removeGroupMigration = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.removeGroupMigration( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IRemoveGroupMigrationResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.removeGroupMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeGroupMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createCutoverJob', () => { - it('invokes createCutoverJob without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateCutoverJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateCutoverJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCutoverJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.createCutoverJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCutoverJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCutoverJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes removeGroupMigration with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest', + ['group'], + ); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeGroupMigration = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.removeGroupMigration(request), expectedError); + const actualRequest = ( + client.innerApiCalls.removeGroupMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeGroupMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createCutoverJob without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateCutoverJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateCutoverJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCutoverJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCutoverJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCutoverJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCutoverJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes removeGroupMigration with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest', + ['group'], + ); + request.group = defaultValue1; + const expectedHeaderRequestParams = `group=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.removeGroupMigration = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.removeGroupMigration(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.removeGroupMigration as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.removeGroupMigration as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createCutoverJob with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateCutoverJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateCutoverJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCutoverJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createCutoverJob(request), expectedError); - const actualRequest = (client.innerApiCalls.createCutoverJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCutoverJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkRemoveGroupMigrationProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRemoveGroupMigrationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createCutoverJob with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateCutoverJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateCutoverJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCutoverJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createCutoverJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createCutoverJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCutoverJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkRemoveGroupMigrationProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkRemoveGroupMigrationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createTargetProject', () => { + it('invokes createTargetProject without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateTargetProjectRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateTargetProjectRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createTargetProject = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createTargetProject(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateCutoverJobProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateCutoverJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createTargetProject without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateTargetProjectRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateTargetProjectRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createTargetProject = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createTargetProject( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateCutoverJobProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateCutoverJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createTargetProject with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateTargetProjectRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateTargetProjectRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createTargetProject = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createTargetProject(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('cancelCutoverJob', () => { - it('invokes cancelCutoverJob without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelCutoverJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelCutoverJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.cancelCutoverJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.cancelCutoverJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelCutoverJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelCutoverJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createTargetProject with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateTargetProjectRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateTargetProjectRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createTargetProject = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createTargetProject(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelCutoverJob without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelCutoverJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelCutoverJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.cancelCutoverJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelCutoverJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelCutoverJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelCutoverJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateTargetProjectProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateTargetProjectProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes cancelCutoverJob with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelCutoverJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelCutoverJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelCutoverJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.cancelCutoverJob(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelCutoverJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelCutoverJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateTargetProjectProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateTargetProjectProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateTargetProject', () => { + it('invokes updateTargetProject without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateTargetProjectRequest(), + ); + request.targetProject ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateTargetProjectRequest', + ['targetProject', 'name'], + ); + request.targetProject.name = defaultValue1; + const expectedHeaderRequestParams = `target_project.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateTargetProject = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateTargetProject(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelCutoverJob with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelCutoverJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelCutoverJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelCutoverJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.cancelCutoverJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.cancelCutoverJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelCutoverJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateTargetProject without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateTargetProjectRequest(), + ); + request.targetProject ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateTargetProjectRequest', + ['targetProject', 'name'], + ); + request.targetProject.name = defaultValue1; + const expectedHeaderRequestParams = `target_project.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateTargetProject = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateTargetProject( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.ITargetProject, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCancelCutoverJobProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCancelCutoverJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateTargetProject with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateTargetProjectRequest(), + ); + request.targetProject ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateTargetProjectRequest', + ['targetProject', 'name'], + ); + request.targetProject.name = defaultValue1; + const expectedHeaderRequestParams = `target_project.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTargetProject = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateTargetProject(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCancelCutoverJobProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCancelCutoverJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateTargetProject with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateTargetProjectRequest(), + ); + request.targetProject ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateTargetProjectRequest', + ['targetProject', 'name'], + ); + request.targetProject.name = defaultValue1; + const expectedHeaderRequestParams = `target_project.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateTargetProject = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateTargetProject(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createGroup', () => { - it('invokes createGroup without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.createGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateTargetProjectProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateTargetProjectProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createGroup without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateTargetProjectProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateTargetProjectProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteTargetProject', () => { + it('invokes deleteTargetProject without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteTargetProjectRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteTargetProjectRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteTargetProject = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteTargetProject(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createGroup with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteTargetProject without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteTargetProjectRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteTargetProjectRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteTargetProject = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteTargetProject( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createGroup with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateGroupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteTargetProject with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteTargetProjectRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteTargetProjectRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTargetProject = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteTargetProject(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateGroupProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteTargetProject with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteTargetProjectRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteTargetProjectRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteTargetProject = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteTargetProject(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteTargetProject as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteTargetProject as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateGroupProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteTargetProjectProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteTargetProjectProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateGroup', () => { - it('invokes updateGroup without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteTargetProjectProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteTargetProjectProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createImageImport', () => { + it('invokes createImageImport without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateImageImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateImageImportRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createImageImport = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createImageImport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createImageImport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createImageImport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateGroup without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createImageImport without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateImageImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateImageImportRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createImageImport = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createImageImport( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IImageImport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IImageImport, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createImageImport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createImageImport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateGroup with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createImageImport with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateImageImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateImageImportRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createImageImport = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createImageImport(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createImageImport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createImageImport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateGroup with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createImageImport with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateImageImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateImageImportRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createImageImport = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createImageImport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createImageImport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createImageImport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateGroupProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateImageImportProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateImageImportProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateGroupProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateImageImportProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateImageImportProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteImageImport', () => { + it('invokes deleteImageImport without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteImageImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteImageImportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteImageImport = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteImageImport(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteImageImport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteImageImport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteGroup', () => { - it('invokes deleteGroup without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGroup = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteGroup(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteImageImport without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteImageImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteImageImportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteImageImport = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteImageImport( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteImageImport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteImageImport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteGroup without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGroup = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteGroup( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteImageImport with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteImageImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteImageImportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteImageImport = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteImageImport(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteImageImport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteImageImport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteGroup with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGroup = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteImageImport with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteImageImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteImageImportRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteImageImport = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteImageImport(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteImageImport as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteImageImport as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteGroup with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGroup = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteGroup(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteImageImportProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteImageImportProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteGroupProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteGroupProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteImageImportProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteImageImportProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('cancelImageImportJob', () => { + it('invokes cancelImageImportJob without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelImageImportJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelImageImportJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.cancelImageImportJob = + stubLongRunningCall(expectedResponse); + const [operation] = await client.cancelImageImportJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelImageImportJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelImageImportJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteGroupProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteGroupProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes cancelImageImportJob without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelImageImportJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelImageImportJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.cancelImageImportJob = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelImageImportJob( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.ICancelImageImportJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.ICancelImageImportJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelImageImportJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelImageImportJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('addGroupMigration', () => { - it('invokes addGroupMigration without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.AddGroupMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.AddGroupMigrationRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addGroupMigration = stubLongRunningCall(expectedResponse); - const [operation] = await client.addGroupMigration(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addGroupMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addGroupMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cancelImageImportJob with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelImageImportJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelImageImportJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelImageImportJob = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.cancelImageImportJob(request), expectedError); + const actualRequest = ( + client.innerApiCalls.cancelImageImportJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelImageImportJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addGroupMigration without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.AddGroupMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.AddGroupMigrationRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addGroupMigration = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addGroupMigration( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addGroupMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addGroupMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cancelImageImportJob with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelImageImportJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelImageImportJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelImageImportJob = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.cancelImageImportJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.cancelImageImportJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelImageImportJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addGroupMigration with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.AddGroupMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.AddGroupMigrationRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addGroupMigration = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.addGroupMigration(request), expectedError); - const actualRequest = (client.innerApiCalls.addGroupMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addGroupMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCancelImageImportJobProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCancelImageImportJobProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes addGroupMigration with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.AddGroupMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.AddGroupMigrationRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addGroupMigration = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.addGroupMigration(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.addGroupMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addGroupMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCancelImageImportJobProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCancelImageImportJobProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createDiskMigrationJob', () => { + it('invokes createDiskMigrationJob without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createDiskMigrationJob = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createDiskMigrationJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkAddGroupMigrationProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAddGroupMigrationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createDiskMigrationJob without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createDiskMigrationJob = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDiskMigrationJob( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkAddGroupMigrationProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAddGroupMigrationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createDiskMigrationJob with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDiskMigrationJob = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createDiskMigrationJob(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('removeGroupMigration', () => { - it('invokes removeGroupMigration without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeGroupMigration = stubLongRunningCall(expectedResponse); - const [operation] = await client.removeGroupMigration(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeGroupMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeGroupMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createDiskMigrationJob with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDiskMigrationJob = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createDiskMigrationJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes removeGroupMigration without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeGroupMigration = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeGroupMigration( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeGroupMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeGroupMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateDiskMigrationJobProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateDiskMigrationJobProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes removeGroupMigration with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeGroupMigration = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.removeGroupMigration(request), expectedError); - const actualRequest = (client.innerApiCalls.removeGroupMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeGroupMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateDiskMigrationJobProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateDiskMigrationJobProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateDiskMigrationJob', () => { + it('invokes updateDiskMigrationJob without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest(), + ); + request.diskMigrationJob ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest', + ['diskMigrationJob', 'name'], + ); + request.diskMigrationJob.name = defaultValue1; + const expectedHeaderRequestParams = `disk_migration_job.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateDiskMigrationJob = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDiskMigrationJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes removeGroupMigration with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.RemoveGroupMigrationRequest', ['group']); - request.group = defaultValue1; - const expectedHeaderRequestParams = `group=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeGroupMigration = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.removeGroupMigration(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.removeGroupMigration as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeGroupMigration as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateDiskMigrationJob without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest(), + ); + request.diskMigrationJob ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest', + ['diskMigrationJob', 'name'], + ); + request.diskMigrationJob.name = defaultValue1; + const expectedHeaderRequestParams = `disk_migration_job.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateDiskMigrationJob = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDiskMigrationJob( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IDiskMigrationJob, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkRemoveGroupMigrationProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRemoveGroupMigrationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateDiskMigrationJob with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest(), + ); + request.diskMigrationJob ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest', + ['diskMigrationJob', 'name'], + ); + request.diskMigrationJob.name = defaultValue1; + const expectedHeaderRequestParams = `disk_migration_job.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDiskMigrationJob = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateDiskMigrationJob(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkRemoveGroupMigrationProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRemoveGroupMigrationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateDiskMigrationJob with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest(), + ); + request.diskMigrationJob ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest', + ['diskMigrationJob', 'name'], + ); + request.diskMigrationJob.name = defaultValue1; + const expectedHeaderRequestParams = `disk_migration_job.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDiskMigrationJob = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateDiskMigrationJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createTargetProject', () => { - it('invokes createTargetProject without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateTargetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateTargetProjectRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createTargetProject = stubLongRunningCall(expectedResponse); - const [operation] = await client.createTargetProject(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateDiskMigrationJobProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateDiskMigrationJobProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createTargetProject without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateTargetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateTargetProjectRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createTargetProject = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTargetProject( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateDiskMigrationJobProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateDiskMigrationJobProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteDiskMigrationJob', () => { + it('invokes deleteDiskMigrationJob without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteDiskMigrationJob = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteDiskMigrationJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createTargetProject with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateTargetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateTargetProjectRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createTargetProject = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createTargetProject(request), expectedError); - const actualRequest = (client.innerApiCalls.createTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteDiskMigrationJob without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteDiskMigrationJob = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDiskMigrationJob( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createTargetProject with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateTargetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateTargetProjectRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createTargetProject = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createTargetProject(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteDiskMigrationJob with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDiskMigrationJob = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteDiskMigrationJob(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateTargetProjectProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateTargetProjectProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteDiskMigrationJob with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDiskMigrationJob = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteDiskMigrationJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateTargetProjectProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateTargetProjectProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteDiskMigrationJobProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteDiskMigrationJobProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateTargetProject', () => { - it('invokes updateTargetProject without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateTargetProjectRequest() - ); - request.targetProject ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateTargetProjectRequest', ['targetProject', 'name']); - request.targetProject.name = defaultValue1; - const expectedHeaderRequestParams = `target_project.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateTargetProject = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateTargetProject(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteDiskMigrationJobProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteDiskMigrationJobProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('runDiskMigrationJob', () => { + it('invokes runDiskMigrationJob without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.runDiskMigrationJob = + stubLongRunningCall(expectedResponse); + const [operation] = await client.runDiskMigrationJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.runDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateTargetProject without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateTargetProjectRequest() - ); - request.targetProject ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateTargetProjectRequest', ['targetProject', 'name']); - request.targetProject.name = defaultValue1; - const expectedHeaderRequestParams = `target_project.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateTargetProject = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateTargetProject( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes runDiskMigrationJob without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.runDiskMigrationJob = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runDiskMigrationJob( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.IRunDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.runDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateTargetProject with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateTargetProjectRequest() - ); - request.targetProject ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateTargetProjectRequest', ['targetProject', 'name']); - request.targetProject.name = defaultValue1; - const expectedHeaderRequestParams = `target_project.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTargetProject = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateTargetProject(request), expectedError); - const actualRequest = (client.innerApiCalls.updateTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes runDiskMigrationJob with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runDiskMigrationJob = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.runDiskMigrationJob(request), expectedError); + const actualRequest = ( + client.innerApiCalls.runDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateTargetProject with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateTargetProjectRequest() - ); - request.targetProject ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateTargetProjectRequest', ['targetProject', 'name']); - request.targetProject.name = defaultValue1; - const expectedHeaderRequestParams = `target_project.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTargetProject = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateTargetProject(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateTargetProjectProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateTargetProjectProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateTargetProjectProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateTargetProjectProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes runDiskMigrationJob with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runDiskMigrationJob = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.runDiskMigrationJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.runDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteTargetProject', () => { - it('invokes deleteTargetProject without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteTargetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteTargetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteTargetProject = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteTargetProject(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTargetProject without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteTargetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteTargetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteTargetProject = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTargetProject( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTargetProject with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteTargetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteTargetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTargetProject = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteTargetProject(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTargetProject with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteTargetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteTargetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTargetProject = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteTargetProject(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteTargetProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTargetProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteTargetProjectProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteTargetProjectProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteTargetProjectProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteTargetProjectProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkRunDiskMigrationJobProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRunDiskMigrationJobProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('createImageImport', () => { - it('invokes createImageImport without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateImageImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateImageImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createImageImport = stubLongRunningCall(expectedResponse); - const [operation] = await client.createImageImport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createImageImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImageImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImageImport without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateImageImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateImageImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createImageImport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createImageImport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createImageImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImageImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImageImport with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateImageImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateImageImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createImageImport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createImageImport(request), expectedError); - const actualRequest = (client.innerApiCalls.createImageImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImageImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImageImport with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateImageImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateImageImportRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createImageImport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createImageImport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createImageImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImageImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateImageImportProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateImageImportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateImageImportProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateImageImportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkRunDiskMigrationJobProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkRunDiskMigrationJobProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - - describe('deleteImageImport', () => { - it('invokes deleteImageImport without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteImageImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteImageImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteImageImport = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteImageImport(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteImageImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteImageImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteImageImport without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteImageImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteImageImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteImageImport = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteImageImport( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteImageImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteImageImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteImageImport with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteImageImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteImageImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteImageImport = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteImageImport(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteImageImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteImageImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteImageImport with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteImageImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteImageImportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteImageImport = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteImageImport(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteImageImport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteImageImport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteImageImportProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteImageImportProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteImageImportProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteImageImportProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + }); + + describe('cancelDiskMigrationJob', () => { + it('invokes cancelDiskMigrationJob without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.cancelDiskMigrationJob = + stubLongRunningCall(expectedResponse); + const [operation] = await client.cancelDiskMigrationJob(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('cancelImageImportJob', () => { - it('invokes cancelImageImportJob without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelImageImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelImageImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.cancelImageImportJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.cancelImageImportJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelImageImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelImageImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelImageImportJob without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelImageImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelImageImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.cancelImageImportJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelImageImportJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelImageImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelImageImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelImageImportJob with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelImageImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelImageImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelImageImportJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.cancelImageImportJob(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelImageImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelImageImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelImageImportJob with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelImageImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelImageImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelImageImportJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.cancelImageImportJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.cancelImageImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelImageImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCancelImageImportJobProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCancelImageImportJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCancelImageImportJobProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCancelImageImportJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes cancelDiskMigrationJob without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.cancelDiskMigrationJob = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelDiskMigrationJob( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmmigration.v1.ICancelDiskMigrationJobResponse, + protos.google.cloud.vmmigration.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createDiskMigrationJob', () => { - it('invokes createDiskMigrationJob without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createDiskMigrationJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.createDiskMigrationJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDiskMigrationJob without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createDiskMigrationJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDiskMigrationJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDiskMigrationJob with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDiskMigrationJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createDiskMigrationJob(request), expectedError); - const actualRequest = (client.innerApiCalls.createDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDiskMigrationJob with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CreateDiskMigrationJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDiskMigrationJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createDiskMigrationJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateDiskMigrationJobProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateDiskMigrationJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateDiskMigrationJobProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateDiskMigrationJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes cancelDiskMigrationJob with call error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelDiskMigrationJob = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.cancelDiskMigrationJob(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.cancelDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateDiskMigrationJob', () => { - it('invokes updateDiskMigrationJob without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest() - ); - request.diskMigrationJob ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest', ['diskMigrationJob', 'name']); - request.diskMigrationJob.name = defaultValue1; - const expectedHeaderRequestParams = `disk_migration_job.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateDiskMigrationJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateDiskMigrationJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDiskMigrationJob without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest() - ); - request.diskMigrationJob ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest', ['diskMigrationJob', 'name']); - request.diskMigrationJob.name = defaultValue1; - const expectedHeaderRequestParams = `disk_migration_job.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateDiskMigrationJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDiskMigrationJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDiskMigrationJob with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest() - ); - request.diskMigrationJob ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest', ['diskMigrationJob', 'name']); - request.diskMigrationJob.name = defaultValue1; - const expectedHeaderRequestParams = `disk_migration_job.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDiskMigrationJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateDiskMigrationJob(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDiskMigrationJob with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest() - ); - request.diskMigrationJob ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.UpdateDiskMigrationJobRequest', ['diskMigrationJob', 'name']); - request.diskMigrationJob.name = defaultValue1; - const expectedHeaderRequestParams = `disk_migration_job.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDiskMigrationJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateDiskMigrationJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateDiskMigrationJobProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateDiskMigrationJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateDiskMigrationJobProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateDiskMigrationJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes cancelDiskMigrationJob with LRO error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelDiskMigrationJob = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.cancelDiskMigrationJob(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.cancelDiskMigrationJob as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelDiskMigrationJob as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteDiskMigrationJob', () => { - it('invokes deleteDiskMigrationJob without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteDiskMigrationJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteDiskMigrationJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDiskMigrationJob without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteDiskMigrationJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDiskMigrationJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDiskMigrationJob with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDiskMigrationJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteDiskMigrationJob(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDiskMigrationJob with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.DeleteDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDiskMigrationJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteDiskMigrationJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteDiskMigrationJobProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteDiskMigrationJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteDiskMigrationJobProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteDiskMigrationJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCancelDiskMigrationJobProgress without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCancelDiskMigrationJobProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('runDiskMigrationJob', () => { - it('invokes runDiskMigrationJob without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runDiskMigrationJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.runDiskMigrationJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runDiskMigrationJob without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runDiskMigrationJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runDiskMigrationJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runDiskMigrationJob with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.runDiskMigrationJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runDiskMigrationJob(request), expectedError); - const actualRequest = (client.innerApiCalls.runDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runDiskMigrationJob with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.RunDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.runDiskMigrationJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runDiskMigrationJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.runDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRunDiskMigrationJobProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRunDiskMigrationJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRunDiskMigrationJobProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRunDiskMigrationJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCancelDiskMigrationJobProgress with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCancelDiskMigrationJobProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listSources', () => { + it('invokes listSources without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListSourcesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListSourcesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), + ]; + client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); + const [response] = await client.listSources(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSources as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSources as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('cancelDiskMigrationJob', () => { - it('invokes cancelDiskMigrationJob without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.cancelDiskMigrationJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.cancelDiskMigrationJob(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelDiskMigrationJob without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.cancelDiskMigrationJob = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelDiskMigrationJob( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelDiskMigrationJob with call error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelDiskMigrationJob = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.cancelDiskMigrationJob(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelDiskMigrationJob with LRO error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.CancelDiskMigrationJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelDiskMigrationJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.cancelDiskMigrationJob(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.cancelDiskMigrationJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelDiskMigrationJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCancelDiskMigrationJobProgress without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCancelDiskMigrationJobProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCancelDiskMigrationJobProgress with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCancelDiskMigrationJobProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listSources without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListSourcesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListSourcesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), + ]; + client.innerApiCalls.listSources = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSources( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.ISource[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSources as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSources as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listSources', () => { - it('invokes listSources without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCall(expectedResponse); - const [response] = await client.listSources(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSources with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListSourcesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListSourcesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSources = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listSources(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listSources as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSources as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listSources without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), - ]; - client.innerApiCalls.listSources = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSources( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.ISource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSourcesStream without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListSourcesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListSourcesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), + ]; + client.descriptors.page.listSources.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.Source[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.Source) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSources, request), + ); + assert( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSources with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSources = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSources(request), expectedError); - const actualRequest = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSourcesStream with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListSourcesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListSourcesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSources.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listSourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.Source[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.Source) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSources, request), + ); + assert( + (client.descriptors.page.listSources.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSourcesStream without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), - ]; - client.descriptors.page.listSources.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.Source[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.Source) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSources without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListSourcesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListSourcesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), + ]; + client.descriptors.page.listSources.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmmigration.v1.ISource[] = []; + const iterable = client.listSourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listSourcesStream with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSources.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.Source[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.Source) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSources, request)); - assert( - (client.descriptors.page.listSources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listSources with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListSourcesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListSourcesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listSourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmmigration.v1.ISource[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSources.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listSources.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('fetchStorageInventory', () => { + it('invokes fetchStorageInventory without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FetchStorageInventoryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FetchStorageInventoryRequest', + ['source'], + ); + request.source = defaultValue1; + const expectedHeaderRequestParams = `source=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.SourceStorageResource(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.SourceStorageResource(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.SourceStorageResource(), + ), + ]; + client.innerApiCalls.fetchStorageInventory = + stubSimpleCall(expectedResponse); + const [response] = await client.fetchStorageInventory(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.fetchStorageInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchStorageInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listSources without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Source()), - ]; - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmmigration.v1.ISource[] = []; - const iterable = client.listSourcesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes fetchStorageInventory without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FetchStorageInventoryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FetchStorageInventoryRequest', + ['source'], + ); + request.source = defaultValue1; + const expectedHeaderRequestParams = `source=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.SourceStorageResource(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.SourceStorageResource(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.SourceStorageResource(), + ), + ]; + client.innerApiCalls.fetchStorageInventory = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchStorageInventory( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmmigration.v1.ISourceStorageResource[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSources with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListSourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListSourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSourcesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmmigration.v1.ISource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.fetchStorageInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchStorageInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('fetchStorageInventory', () => { - it('invokes fetchStorageInventory without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FetchStorageInventoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FetchStorageInventoryRequest', ['source']); - request.source = defaultValue1; - const expectedHeaderRequestParams = `source=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.SourceStorageResource()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.SourceStorageResource()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.SourceStorageResource()), - ]; - client.innerApiCalls.fetchStorageInventory = stubSimpleCall(expectedResponse); - const [response] = await client.fetchStorageInventory(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchStorageInventory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchStorageInventory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes fetchStorageInventory with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FetchStorageInventoryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FetchStorageInventoryRequest', + ['source'], + ); + request.source = defaultValue1; + const expectedHeaderRequestParams = `source=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchStorageInventory = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.fetchStorageInventory(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.fetchStorageInventory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchStorageInventory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes fetchStorageInventory without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FetchStorageInventoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FetchStorageInventoryRequest', ['source']); - request.source = defaultValue1; - const expectedHeaderRequestParams = `source=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.SourceStorageResource()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.SourceStorageResource()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.SourceStorageResource()), - ]; - client.innerApiCalls.fetchStorageInventory = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchStorageInventory( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.ISourceStorageResource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchStorageInventory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchStorageInventory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes fetchStorageInventoryStream without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FetchStorageInventoryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FetchStorageInventoryRequest', + ['source'], + ); + request.source = defaultValue1; + const expectedHeaderRequestParams = `source=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.SourceStorageResource(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.SourceStorageResource(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.SourceStorageResource(), + ), + ]; + client.descriptors.page.fetchStorageInventory.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.fetchStorageInventoryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.SourceStorageResource[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.vmmigration.v1.SourceStorageResource, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.fetchStorageInventory + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.fetchStorageInventory, request), + ); + assert( + ( + client.descriptors.page.fetchStorageInventory + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes fetchStorageInventory with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FetchStorageInventoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FetchStorageInventoryRequest', ['source']); - request.source = defaultValue1; - const expectedHeaderRequestParams = `source=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchStorageInventory = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchStorageInventory(request), expectedError); - const actualRequest = (client.innerApiCalls.fetchStorageInventory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchStorageInventory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes fetchStorageInventoryStream with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FetchStorageInventoryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FetchStorageInventoryRequest', + ['source'], + ); + request.source = defaultValue1; + const expectedHeaderRequestParams = `source=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.fetchStorageInventory.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.fetchStorageInventoryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.SourceStorageResource[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.vmmigration.v1.SourceStorageResource, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.fetchStorageInventory + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.fetchStorageInventory, request), + ); + assert( + ( + client.descriptors.page.fetchStorageInventory + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes fetchStorageInventoryStream without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FetchStorageInventoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FetchStorageInventoryRequest', ['source']); - request.source = defaultValue1; - const expectedHeaderRequestParams = `source=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.SourceStorageResource()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.SourceStorageResource()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.SourceStorageResource()), - ]; - client.descriptors.page.fetchStorageInventory.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.fetchStorageInventoryStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.SourceStorageResource[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.SourceStorageResource) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.fetchStorageInventory.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.fetchStorageInventory, request)); - assert( - (client.descriptors.page.fetchStorageInventory.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with fetchStorageInventory without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FetchStorageInventoryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FetchStorageInventoryRequest', + ['source'], + ); + request.source = defaultValue1; + const expectedHeaderRequestParams = `source=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.SourceStorageResource(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.SourceStorageResource(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.SourceStorageResource(), + ), + ]; + client.descriptors.page.fetchStorageInventory.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmmigration.v1.ISourceStorageResource[] = + []; + const iterable = client.fetchStorageInventoryAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.fetchStorageInventory + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.fetchStorageInventory + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes fetchStorageInventoryStream with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FetchStorageInventoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FetchStorageInventoryRequest', ['source']); - request.source = defaultValue1; - const expectedHeaderRequestParams = `source=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.fetchStorageInventory.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.fetchStorageInventoryStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.SourceStorageResource[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.SourceStorageResource) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.fetchStorageInventory.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.fetchStorageInventory, request)); - assert( - (client.descriptors.page.fetchStorageInventory.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with fetchStorageInventory with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.FetchStorageInventoryRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.FetchStorageInventoryRequest', + ['source'], + ); + request.source = defaultValue1; + const expectedHeaderRequestParams = `source=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.fetchStorageInventory.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.fetchStorageInventoryAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmmigration.v1.ISourceStorageResource[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.fetchStorageInventory + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.fetchStorageInventory + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listUtilizationReports', () => { + it('invokes listUtilizationReports without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListUtilizationReportsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListUtilizationReportsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UtilizationReport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UtilizationReport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UtilizationReport(), + ), + ]; + client.innerApiCalls.listUtilizationReports = + stubSimpleCall(expectedResponse); + const [response] = await client.listUtilizationReports(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listUtilizationReports as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUtilizationReports as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with fetchStorageInventory without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FetchStorageInventoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FetchStorageInventoryRequest', ['source']); - request.source = defaultValue1; - const expectedHeaderRequestParams = `source=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.SourceStorageResource()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.SourceStorageResource()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.SourceStorageResource()), - ]; - client.descriptors.page.fetchStorageInventory.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmmigration.v1.ISourceStorageResource[] = []; - const iterable = client.fetchStorageInventoryAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listUtilizationReports without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListUtilizationReportsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListUtilizationReportsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UtilizationReport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UtilizationReport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UtilizationReport(), + ), + ]; + client.innerApiCalls.listUtilizationReports = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listUtilizationReports( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmmigration.v1.IUtilizationReport[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.fetchStorageInventory.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.fetchStorageInventory.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with fetchStorageInventory with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.FetchStorageInventoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.FetchStorageInventoryRequest', ['source']); - request.source = defaultValue1; - const expectedHeaderRequestParams = `source=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.fetchStorageInventory.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.fetchStorageInventoryAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmmigration.v1.ISourceStorageResource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.fetchStorageInventory.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.fetchStorageInventory.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listUtilizationReports as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUtilizationReports as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listUtilizationReports', () => { - it('invokes listUtilizationReports without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListUtilizationReportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListUtilizationReportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.UtilizationReport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.UtilizationReport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.UtilizationReport()), - ]; - client.innerApiCalls.listUtilizationReports = stubSimpleCall(expectedResponse); - const [response] = await client.listUtilizationReports(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUtilizationReports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUtilizationReports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listUtilizationReports with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListUtilizationReportsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListUtilizationReportsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listUtilizationReports = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listUtilizationReports(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listUtilizationReports as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listUtilizationReports as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listUtilizationReports without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListUtilizationReportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListUtilizationReportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.UtilizationReport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.UtilizationReport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.UtilizationReport()), - ]; - client.innerApiCalls.listUtilizationReports = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUtilizationReports( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IUtilizationReport[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUtilizationReports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUtilizationReports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listUtilizationReportsStream without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListUtilizationReportsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListUtilizationReportsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UtilizationReport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UtilizationReport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UtilizationReport(), + ), + ]; + client.descriptors.page.listUtilizationReports.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listUtilizationReportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.UtilizationReport[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.UtilizationReport) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listUtilizationReports + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listUtilizationReports, request), + ); + assert( + ( + client.descriptors.page.listUtilizationReports + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listUtilizationReports with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListUtilizationReportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListUtilizationReportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listUtilizationReports = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUtilizationReports(request), expectedError); - const actualRequest = (client.innerApiCalls.listUtilizationReports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUtilizationReports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listUtilizationReportsStream with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListUtilizationReportsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListUtilizationReportsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUtilizationReports.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listUtilizationReportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.UtilizationReport[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.UtilizationReport) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listUtilizationReports + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listUtilizationReports, request), + ); + assert( + ( + client.descriptors.page.listUtilizationReports + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listUtilizationReportsStream without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListUtilizationReportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListUtilizationReportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.UtilizationReport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.UtilizationReport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.UtilizationReport()), - ]; - client.descriptors.page.listUtilizationReports.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUtilizationReportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.UtilizationReport[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.UtilizationReport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listUtilizationReports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUtilizationReports, request)); - assert( - (client.descriptors.page.listUtilizationReports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listUtilizationReports without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListUtilizationReportsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListUtilizationReportsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UtilizationReport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UtilizationReport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.UtilizationReport(), + ), + ]; + client.descriptors.page.listUtilizationReports.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmmigration.v1.IUtilizationReport[] = + []; + const iterable = client.listUtilizationReportsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listUtilizationReports + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listUtilizationReports + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listUtilizationReportsStream with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListUtilizationReportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListUtilizationReportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listUtilizationReports.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUtilizationReportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.UtilizationReport[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.UtilizationReport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUtilizationReports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUtilizationReports, request)); - assert( - (client.descriptors.page.listUtilizationReports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listUtilizationReports with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListUtilizationReportsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListUtilizationReportsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listUtilizationReports.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listUtilizationReportsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmmigration.v1.IUtilizationReport[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listUtilizationReports + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listUtilizationReports + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listDatacenterConnectors', () => { + it('invokes listDatacenterConnectors without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DatacenterConnector(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DatacenterConnector(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DatacenterConnector(), + ), + ]; + client.innerApiCalls.listDatacenterConnectors = + stubSimpleCall(expectedResponse); + const [response] = await client.listDatacenterConnectors(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDatacenterConnectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDatacenterConnectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listUtilizationReports without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListUtilizationReportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListUtilizationReportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.UtilizationReport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.UtilizationReport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.UtilizationReport()), - ]; - client.descriptors.page.listUtilizationReports.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmmigration.v1.IUtilizationReport[] = []; - const iterable = client.listUtilizationReportsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listDatacenterConnectors without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DatacenterConnector(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DatacenterConnector(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DatacenterConnector(), + ), + ]; + client.innerApiCalls.listDatacenterConnectors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDatacenterConnectors( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmmigration.v1.IDatacenterConnector[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUtilizationReports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUtilizationReports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUtilizationReports with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListUtilizationReportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListUtilizationReportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listUtilizationReports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUtilizationReportsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmmigration.v1.IUtilizationReport[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUtilizationReports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUtilizationReports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDatacenterConnectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDatacenterConnectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listDatacenterConnectors', () => { - it('invokes listDatacenterConnectors without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DatacenterConnector()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DatacenterConnector()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DatacenterConnector()), - ]; - client.innerApiCalls.listDatacenterConnectors = stubSimpleCall(expectedResponse); - const [response] = await client.listDatacenterConnectors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDatacenterConnectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatacenterConnectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listDatacenterConnectors with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDatacenterConnectors = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listDatacenterConnectors(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listDatacenterConnectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDatacenterConnectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listDatacenterConnectors without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DatacenterConnector()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DatacenterConnector()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DatacenterConnector()), - ]; - client.innerApiCalls.listDatacenterConnectors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDatacenterConnectors( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IDatacenterConnector[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDatacenterConnectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatacenterConnectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listDatacenterConnectorsStream without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DatacenterConnector(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DatacenterConnector(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DatacenterConnector(), + ), + ]; + client.descriptors.page.listDatacenterConnectors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listDatacenterConnectorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.DatacenterConnector[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.vmmigration.v1.DatacenterConnector, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listDatacenterConnectors + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listDatacenterConnectors, request), + ); + assert( + ( + client.descriptors.page.listDatacenterConnectors + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listDatacenterConnectors with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDatacenterConnectors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDatacenterConnectors(request), expectedError); - const actualRequest = (client.innerApiCalls.listDatacenterConnectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatacenterConnectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listDatacenterConnectorsStream with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDatacenterConnectors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listDatacenterConnectorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.DatacenterConnector[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.vmmigration.v1.DatacenterConnector, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listDatacenterConnectors + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listDatacenterConnectors, request), + ); + assert( + ( + client.descriptors.page.listDatacenterConnectors + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listDatacenterConnectorsStream without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DatacenterConnector()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DatacenterConnector()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DatacenterConnector()), - ]; - client.descriptors.page.listDatacenterConnectors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDatacenterConnectorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.DatacenterConnector[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.DatacenterConnector) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listDatacenterConnectors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDatacenterConnectors, request)); - assert( - (client.descriptors.page.listDatacenterConnectors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listDatacenterConnectors without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DatacenterConnector(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DatacenterConnector(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DatacenterConnector(), + ), + ]; + client.descriptors.page.listDatacenterConnectors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmmigration.v1.IDatacenterConnector[] = + []; + const iterable = client.listDatacenterConnectorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listDatacenterConnectors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listDatacenterConnectors + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listDatacenterConnectorsStream with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDatacenterConnectors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDatacenterConnectorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.DatacenterConnector[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.DatacenterConnector) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDatacenterConnectors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDatacenterConnectors, request)); - assert( - (client.descriptors.page.listDatacenterConnectors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listDatacenterConnectors with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDatacenterConnectors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDatacenterConnectorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmmigration.v1.IDatacenterConnector[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listDatacenterConnectors + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listDatacenterConnectors + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listMigratingVms', () => { + it('invokes listMigratingVms without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListMigratingVmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListMigratingVmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.MigratingVm(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.MigratingVm(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.MigratingVm(), + ), + ]; + client.innerApiCalls.listMigratingVms = stubSimpleCall(expectedResponse); + const [response] = await client.listMigratingVms(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMigratingVms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMigratingVms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listDatacenterConnectors without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DatacenterConnector()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DatacenterConnector()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DatacenterConnector()), - ]; - client.descriptors.page.listDatacenterConnectors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmmigration.v1.IDatacenterConnector[] = []; - const iterable = client.listDatacenterConnectorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listMigratingVms without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListMigratingVmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListMigratingVmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.MigratingVm(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.MigratingVm(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.MigratingVm(), + ), + ]; + client.innerApiCalls.listMigratingVms = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMigratingVms( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.IMigratingVm[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDatacenterConnectors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDatacenterConnectors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDatacenterConnectors with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListDatacenterConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDatacenterConnectors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDatacenterConnectorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmmigration.v1.IDatacenterConnector[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDatacenterConnectors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDatacenterConnectors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMigratingVms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMigratingVms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listMigratingVms', () => { - it('invokes listMigratingVms without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListMigratingVmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListMigratingVmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.MigratingVm()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.MigratingVm()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.MigratingVm()), - ]; - client.innerApiCalls.listMigratingVms = stubSimpleCall(expectedResponse); - const [response] = await client.listMigratingVms(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMigratingVms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMigratingVms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMigratingVms with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListMigratingVmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListMigratingVmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMigratingVms = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listMigratingVms(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listMigratingVms as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMigratingVms as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listMigratingVms without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListMigratingVmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListMigratingVmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.MigratingVm()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.MigratingVm()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.MigratingVm()), - ]; - client.innerApiCalls.listMigratingVms = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMigratingVms( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IMigratingVm[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMigratingVms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMigratingVms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMigratingVmsStream without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListMigratingVmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListMigratingVmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.MigratingVm(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.MigratingVm(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.MigratingVm(), + ), + ]; + client.descriptors.page.listMigratingVms.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listMigratingVmsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.MigratingVm[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.MigratingVm) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listMigratingVms.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listMigratingVms, request), + ); + assert( + (client.descriptors.page.listMigratingVms.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listMigratingVms with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListMigratingVmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListMigratingVmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMigratingVms = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMigratingVms(request), expectedError); - const actualRequest = (client.innerApiCalls.listMigratingVms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMigratingVms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listMigratingVmsStream with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListMigratingVmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListMigratingVmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMigratingVms.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listMigratingVmsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.MigratingVm[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.MigratingVm) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listMigratingVms.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listMigratingVms, request), + ); + assert( + (client.descriptors.page.listMigratingVms.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listMigratingVmsStream without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListMigratingVmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListMigratingVmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.MigratingVm()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.MigratingVm()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.MigratingVm()), - ]; - client.descriptors.page.listMigratingVms.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMigratingVmsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.MigratingVm[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.MigratingVm) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMigratingVms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMigratingVms, request)); - assert( - (client.descriptors.page.listMigratingVms.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMigratingVms without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListMigratingVmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListMigratingVmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.MigratingVm(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.MigratingVm(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.MigratingVm(), + ), + ]; + client.descriptors.page.listMigratingVms.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmmigration.v1.IMigratingVm[] = []; + const iterable = client.listMigratingVmsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMigratingVms.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listMigratingVms.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listMigratingVmsStream with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListMigratingVmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListMigratingVmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMigratingVms.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMigratingVmsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.MigratingVm[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.MigratingVm) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMigratingVms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMigratingVms, request)); - assert( - (client.descriptors.page.listMigratingVms.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listMigratingVms with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListMigratingVmsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListMigratingVmsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMigratingVms.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMigratingVmsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmmigration.v1.IMigratingVm[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMigratingVms.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listMigratingVms.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listCloneJobs', () => { + it('invokes listCloneJobs without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListCloneJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListCloneJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CloneJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CloneJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CloneJob(), + ), + ]; + client.innerApiCalls.listCloneJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listCloneJobs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCloneJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCloneJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listMigratingVms without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListMigratingVmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListMigratingVmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.MigratingVm()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.MigratingVm()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.MigratingVm()), - ]; - client.descriptors.page.listMigratingVms.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmmigration.v1.IMigratingVm[] = []; - const iterable = client.listMigratingVmsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listCloneJobs without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListCloneJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListCloneJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CloneJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CloneJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CloneJob(), + ), + ]; + client.innerApiCalls.listCloneJobs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCloneJobs( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.ICloneJob[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMigratingVms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMigratingVms.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMigratingVms with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListMigratingVmsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListMigratingVmsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMigratingVms.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMigratingVmsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmmigration.v1.IMigratingVm[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMigratingVms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMigratingVms.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCloneJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCloneJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listCloneJobs', () => { - it('invokes listCloneJobs without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListCloneJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListCloneJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CloneJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CloneJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CloneJob()), - ]; - client.innerApiCalls.listCloneJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listCloneJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCloneJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCloneJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listCloneJobs with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListCloneJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListCloneJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCloneJobs = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listCloneJobs(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listCloneJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCloneJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listCloneJobs without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListCloneJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListCloneJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CloneJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CloneJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CloneJob()), - ]; - client.innerApiCalls.listCloneJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCloneJobs( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.ICloneJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCloneJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCloneJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listCloneJobsStream without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListCloneJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListCloneJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CloneJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CloneJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CloneJob(), + ), + ]; + client.descriptors.page.listCloneJobs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listCloneJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.CloneJob[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.CloneJob) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listCloneJobs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCloneJobs, request), + ); + assert( + (client.descriptors.page.listCloneJobs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listCloneJobs with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListCloneJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListCloneJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCloneJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCloneJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listCloneJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCloneJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listCloneJobsStream with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListCloneJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListCloneJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCloneJobs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listCloneJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.CloneJob[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.CloneJob) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listCloneJobs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCloneJobs, request), + ); + assert( + (client.descriptors.page.listCloneJobs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listCloneJobsStream without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListCloneJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListCloneJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CloneJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CloneJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CloneJob()), - ]; - client.descriptors.page.listCloneJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCloneJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.CloneJob[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.CloneJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCloneJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCloneJobs, request)); - assert( - (client.descriptors.page.listCloneJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listCloneJobs without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListCloneJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListCloneJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CloneJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CloneJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CloneJob(), + ), + ]; + client.descriptors.page.listCloneJobs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmmigration.v1.ICloneJob[] = []; + const iterable = client.listCloneJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listCloneJobs.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCloneJobs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listCloneJobsStream with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListCloneJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListCloneJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCloneJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCloneJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.CloneJob[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.CloneJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCloneJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCloneJobs, request)); - assert( - (client.descriptors.page.listCloneJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listCloneJobs with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListCloneJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListCloneJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCloneJobs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCloneJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmmigration.v1.ICloneJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listCloneJobs.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCloneJobs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listCutoverJobs', () => { + it('invokes listCutoverJobs without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListCutoverJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListCutoverJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CutoverJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CutoverJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CutoverJob(), + ), + ]; + client.innerApiCalls.listCutoverJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listCutoverJobs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCutoverJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCutoverJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listCloneJobs without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListCloneJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListCloneJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CloneJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CloneJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CloneJob()), - ]; - client.descriptors.page.listCloneJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmmigration.v1.ICloneJob[] = []; - const iterable = client.listCloneJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listCutoverJobs without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListCutoverJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListCutoverJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CutoverJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CutoverJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CutoverJob(), + ), + ]; + client.innerApiCalls.listCutoverJobs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCutoverJobs( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.ICutoverJob[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCloneJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCloneJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCloneJobs with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListCloneJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListCloneJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCloneJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCloneJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmmigration.v1.ICloneJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCloneJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCloneJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCutoverJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCutoverJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listCutoverJobs', () => { - it('invokes listCutoverJobs without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListCutoverJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListCutoverJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CutoverJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CutoverJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CutoverJob()), - ]; - client.innerApiCalls.listCutoverJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listCutoverJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCutoverJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCutoverJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listCutoverJobs with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListCutoverJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListCutoverJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCutoverJobs = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listCutoverJobs(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listCutoverJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCutoverJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listCutoverJobs without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListCutoverJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListCutoverJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CutoverJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CutoverJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CutoverJob()), - ]; - client.innerApiCalls.listCutoverJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCutoverJobs( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.ICutoverJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCutoverJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCutoverJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listCutoverJobsStream without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListCutoverJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListCutoverJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CutoverJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CutoverJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CutoverJob(), + ), + ]; + client.descriptors.page.listCutoverJobs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listCutoverJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.CutoverJob[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.CutoverJob) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listCutoverJobs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCutoverJobs, request), + ); + assert( + (client.descriptors.page.listCutoverJobs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listCutoverJobs with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListCutoverJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListCutoverJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCutoverJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCutoverJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listCutoverJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCutoverJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listCutoverJobsStream with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListCutoverJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListCutoverJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCutoverJobs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listCutoverJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.CutoverJob[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.CutoverJob) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listCutoverJobs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCutoverJobs, request), + ); + assert( + (client.descriptors.page.listCutoverJobs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listCutoverJobsStream without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListCutoverJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListCutoverJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CutoverJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CutoverJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CutoverJob()), - ]; - client.descriptors.page.listCutoverJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCutoverJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.CutoverJob[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.CutoverJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCutoverJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCutoverJobs, request)); - assert( - (client.descriptors.page.listCutoverJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listCutoverJobs without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListCutoverJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListCutoverJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CutoverJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CutoverJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.CutoverJob(), + ), + ]; + client.descriptors.page.listCutoverJobs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmmigration.v1.ICutoverJob[] = []; + const iterable = client.listCutoverJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listCutoverJobs.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCutoverJobs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listCutoverJobsStream with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListCutoverJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListCutoverJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCutoverJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCutoverJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.CutoverJob[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.CutoverJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCutoverJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCutoverJobs, request)); - assert( - (client.descriptors.page.listCutoverJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listCutoverJobs with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListCutoverJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListCutoverJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCutoverJobs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCutoverJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmmigration.v1.ICutoverJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listCutoverJobs.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCutoverJobs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listGroups', () => { + it('invokes listGroups without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), + ]; + client.innerApiCalls.listGroups = stubSimpleCall(expectedResponse); + const [response] = await client.listGroups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listCutoverJobs without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListCutoverJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListCutoverJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CutoverJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CutoverJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.CutoverJob()), - ]; - client.descriptors.page.listCutoverJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmmigration.v1.ICutoverJob[] = []; - const iterable = client.listCutoverJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listGroups without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), + ]; + client.innerApiCalls.listGroups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listGroups( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.IGroup[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCutoverJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCutoverJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCutoverJobs with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListCutoverJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListCutoverJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCutoverJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCutoverJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmmigration.v1.ICutoverJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCutoverJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCutoverJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listGroups', () => { - it('invokes listGroups without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), - ]; - client.innerApiCalls.listGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGroups with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listGroups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listGroups(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listGroups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listGroups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listGroups without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), - ]; - client.innerApiCalls.listGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGroups( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGroupsStream without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), + ]; + client.descriptors.page.listGroups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.Group[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.Group) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listGroups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listGroups, request), + ); + assert( + (client.descriptors.page.listGroups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listGroups with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listGroupsStream with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGroups.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listGroupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.Group[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.Group) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listGroups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listGroups, request), + ); + assert( + (client.descriptors.page.listGroups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listGroupsStream without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), - ]; - client.descriptors.page.listGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.Group[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.Group) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroups, request)); - assert( - (client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listGroups without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), + generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), + ]; + client.descriptors.page.listGroups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmmigration.v1.IGroup[] = []; + const iterable = client.listGroupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listGroups.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listGroups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listGroupsStream with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.Group[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.Group) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroups, request)); - assert( - (client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listGroups with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListGroupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListGroupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listGroupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmmigration.v1.IGroup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listGroups.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listGroups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listTargetProjects', () => { + it('invokes listTargetProjects without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListTargetProjectsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListTargetProjectsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.TargetProject(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.TargetProject(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.TargetProject(), + ), + ]; + client.innerApiCalls.listTargetProjects = + stubSimpleCall(expectedResponse); + const [response] = await client.listTargetProjects(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listTargetProjects as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTargetProjects as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listGroups without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.Group()), - ]; - client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmmigration.v1.IGroup[] = []; - const iterable = client.listGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listTargetProjects without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListTargetProjectsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListTargetProjectsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.TargetProject(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.TargetProject(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.TargetProject(), + ), + ]; + client.innerApiCalls.listTargetProjects = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listTargetProjects( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.ITargetProject[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGroups with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListGroupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmmigration.v1.IGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listTargetProjects as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTargetProjects as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listTargetProjects', () => { - it('invokes listTargetProjects without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListTargetProjectsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListTargetProjectsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.TargetProject()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.TargetProject()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.TargetProject()), - ]; - client.innerApiCalls.listTargetProjects = stubSimpleCall(expectedResponse); - const [response] = await client.listTargetProjects(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTargetProjects as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTargetProjects as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listTargetProjects with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListTargetProjectsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListTargetProjectsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listTargetProjects = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listTargetProjects(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listTargetProjects as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listTargetProjects as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listTargetProjects without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListTargetProjectsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListTargetProjectsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.TargetProject()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.TargetProject()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.TargetProject()), - ]; - client.innerApiCalls.listTargetProjects = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTargetProjects( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.ITargetProject[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTargetProjects as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTargetProjects as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listTargetProjectsStream without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListTargetProjectsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListTargetProjectsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.TargetProject(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.TargetProject(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.TargetProject(), + ), + ]; + client.descriptors.page.listTargetProjects.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listTargetProjectsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.TargetProject[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.TargetProject) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listTargetProjects.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listTargetProjects, request), + ); + assert( + (client.descriptors.page.listTargetProjects.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listTargetProjects with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListTargetProjectsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListTargetProjectsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTargetProjects = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTargetProjects(request), expectedError); - const actualRequest = (client.innerApiCalls.listTargetProjects as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTargetProjects as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listTargetProjectsStream with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListTargetProjectsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListTargetProjectsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTargetProjects.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listTargetProjectsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.TargetProject[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.TargetProject) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listTargetProjects.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listTargetProjects, request), + ); + assert( + (client.descriptors.page.listTargetProjects.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listTargetProjectsStream without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListTargetProjectsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListTargetProjectsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.TargetProject()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.TargetProject()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.TargetProject()), - ]; - client.descriptors.page.listTargetProjects.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTargetProjectsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.TargetProject[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.TargetProject) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listTargetProjects.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTargetProjects, request)); - assert( - (client.descriptors.page.listTargetProjects.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listTargetProjects without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListTargetProjectsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListTargetProjectsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.TargetProject(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.TargetProject(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.TargetProject(), + ), + ]; + client.descriptors.page.listTargetProjects.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmmigration.v1.ITargetProject[] = []; + const iterable = client.listTargetProjectsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listTargetProjects.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listTargetProjects.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listTargetProjectsStream with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListTargetProjectsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListTargetProjectsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTargetProjects.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTargetProjectsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.TargetProject[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.TargetProject) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTargetProjects.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTargetProjects, request)); - assert( - (client.descriptors.page.listTargetProjects.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listTargetProjects with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListTargetProjectsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListTargetProjectsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listTargetProjects.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listTargetProjectsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmmigration.v1.ITargetProject[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listTargetProjects.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listTargetProjects.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listReplicationCycles', () => { + it('invokes listReplicationCycles without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListReplicationCyclesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListReplicationCyclesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ReplicationCycle(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ReplicationCycle(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ReplicationCycle(), + ), + ]; + client.innerApiCalls.listReplicationCycles = + stubSimpleCall(expectedResponse); + const [response] = await client.listReplicationCycles(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listReplicationCycles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listReplicationCycles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listTargetProjects without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListTargetProjectsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListTargetProjectsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.TargetProject()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.TargetProject()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.TargetProject()), - ]; - client.descriptors.page.listTargetProjects.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmmigration.v1.ITargetProject[] = []; - const iterable = client.listTargetProjectsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listReplicationCycles without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListReplicationCyclesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListReplicationCyclesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ReplicationCycle(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ReplicationCycle(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ReplicationCycle(), + ), + ]; + client.innerApiCalls.listReplicationCycles = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listReplicationCycles( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmmigration.v1.IReplicationCycle[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTargetProjects.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTargetProjects.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTargetProjects with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListTargetProjectsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListTargetProjectsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTargetProjects.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTargetProjectsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmmigration.v1.ITargetProject[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTargetProjects.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTargetProjects.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listReplicationCycles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listReplicationCycles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listReplicationCycles', () => { - it('invokes listReplicationCycles without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListReplicationCyclesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListReplicationCyclesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ReplicationCycle()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ReplicationCycle()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ReplicationCycle()), - ]; - client.innerApiCalls.listReplicationCycles = stubSimpleCall(expectedResponse); - const [response] = await client.listReplicationCycles(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listReplicationCycles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReplicationCycles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listReplicationCycles with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListReplicationCyclesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListReplicationCyclesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listReplicationCycles = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listReplicationCycles(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listReplicationCycles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listReplicationCycles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listReplicationCycles without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListReplicationCyclesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListReplicationCyclesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ReplicationCycle()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ReplicationCycle()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ReplicationCycle()), - ]; - client.innerApiCalls.listReplicationCycles = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listReplicationCycles( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IReplicationCycle[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listReplicationCycles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReplicationCycles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listReplicationCyclesStream without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListReplicationCyclesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListReplicationCyclesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ReplicationCycle(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ReplicationCycle(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ReplicationCycle(), + ), + ]; + client.descriptors.page.listReplicationCycles.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listReplicationCyclesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.ReplicationCycle[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.ReplicationCycle) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listReplicationCycles + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listReplicationCycles, request), + ); + assert( + ( + client.descriptors.page.listReplicationCycles + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listReplicationCycles with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListReplicationCyclesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListReplicationCyclesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listReplicationCycles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listReplicationCycles(request), expectedError); - const actualRequest = (client.innerApiCalls.listReplicationCycles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listReplicationCycles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listReplicationCyclesStream with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListReplicationCyclesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListReplicationCyclesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listReplicationCycles.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listReplicationCyclesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.ReplicationCycle[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.ReplicationCycle) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listReplicationCycles + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listReplicationCycles, request), + ); + assert( + ( + client.descriptors.page.listReplicationCycles + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listReplicationCyclesStream without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListReplicationCyclesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListReplicationCyclesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ReplicationCycle()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ReplicationCycle()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ReplicationCycle()), - ]; - client.descriptors.page.listReplicationCycles.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listReplicationCyclesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.ReplicationCycle[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.ReplicationCycle) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listReplicationCycles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listReplicationCycles, request)); - assert( - (client.descriptors.page.listReplicationCycles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listReplicationCycles without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListReplicationCyclesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListReplicationCyclesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ReplicationCycle(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ReplicationCycle(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ReplicationCycle(), + ), + ]; + client.descriptors.page.listReplicationCycles.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmmigration.v1.IReplicationCycle[] = + []; + const iterable = client.listReplicationCyclesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listReplicationCycles + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listReplicationCycles + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listReplicationCyclesStream with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListReplicationCyclesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListReplicationCyclesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listReplicationCycles.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listReplicationCyclesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.ReplicationCycle[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.ReplicationCycle) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listReplicationCycles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listReplicationCycles, request)); - assert( - (client.descriptors.page.listReplicationCycles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listReplicationCycles with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListReplicationCyclesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListReplicationCyclesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listReplicationCycles.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listReplicationCyclesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmmigration.v1.IReplicationCycle[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listReplicationCycles + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listReplicationCycles + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listImageImports', () => { + it('invokes listImageImports without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListImageImportsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListImageImportsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImport(), + ), + ]; + client.innerApiCalls.listImageImports = stubSimpleCall(expectedResponse); + const [response] = await client.listImageImports(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listImageImports as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listImageImports as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listReplicationCycles without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListReplicationCyclesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListReplicationCyclesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ReplicationCycle()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ReplicationCycle()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ReplicationCycle()), - ]; - client.descriptors.page.listReplicationCycles.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmmigration.v1.IReplicationCycle[] = []; - const iterable = client.listReplicationCyclesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listImageImports without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListImageImportsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListImageImportsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImport(), + ), + ]; + client.innerApiCalls.listImageImports = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listImageImports( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmmigration.v1.IImageImport[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listReplicationCycles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listReplicationCycles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listReplicationCycles with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListReplicationCyclesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListReplicationCyclesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listReplicationCycles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listReplicationCyclesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmmigration.v1.IReplicationCycle[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listReplicationCycles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listReplicationCycles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listImageImports as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listImageImports as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listImageImports', () => { - it('invokes listImageImports without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListImageImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListImageImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImport()), - ]; - client.innerApiCalls.listImageImports = stubSimpleCall(expectedResponse); - const [response] = await client.listImageImports(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listImageImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImageImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listImageImports with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListImageImportsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListImageImportsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listImageImports = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listImageImports(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listImageImports as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listImageImports as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listImageImports without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListImageImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListImageImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImport()), - ]; - client.innerApiCalls.listImageImports = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listImageImports( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IImageImport[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listImageImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImageImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listImageImportsStream without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListImageImportsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListImageImportsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImport(), + ), + ]; + client.descriptors.page.listImageImports.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listImageImportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.ImageImport[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.ImageImport) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listImageImports.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listImageImports, request), + ); + assert( + (client.descriptors.page.listImageImports.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listImageImports with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListImageImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListImageImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listImageImports = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listImageImports(request), expectedError); - const actualRequest = (client.innerApiCalls.listImageImports as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImageImports as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listImageImportsStream with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListImageImportsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListImageImportsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listImageImports.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listImageImportsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.ImageImport[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.ImageImport) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listImageImports.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listImageImports, request), + ); + assert( + (client.descriptors.page.listImageImports.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listImageImportsStream without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListImageImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListImageImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImport()), - ]; - client.descriptors.page.listImageImports.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listImageImportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.ImageImport[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.ImageImport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listImageImports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listImageImports, request)); - assert( - (client.descriptors.page.listImageImports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listImageImports without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListImageImportsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListImageImportsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImport(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImport(), + ), + ]; + client.descriptors.page.listImageImports.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmmigration.v1.IImageImport[] = []; + const iterable = client.listImageImportsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listImageImports.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listImageImports.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listImageImportsStream with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListImageImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListImageImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listImageImports.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listImageImportsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.ImageImport[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.ImageImport) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listImageImports.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listImageImports, request)); - assert( - (client.descriptors.page.listImageImports.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listImageImports with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListImageImportsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListImageImportsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listImageImports.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listImageImportsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmmigration.v1.IImageImport[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listImageImports.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listImageImports.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listImageImportJobs', () => { + it('invokes listImageImportJobs without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListImageImportJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListImageImportJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImportJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImportJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImportJob(), + ), + ]; + client.innerApiCalls.listImageImportJobs = + stubSimpleCall(expectedResponse); + const [response] = await client.listImageImportJobs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listImageImportJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listImageImportJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listImageImports without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListImageImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListImageImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImport()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImport()), - ]; - client.descriptors.page.listImageImports.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmmigration.v1.IImageImport[] = []; - const iterable = client.listImageImportsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listImageImportJobs without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListImageImportJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListImageImportJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImportJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImportJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImportJob(), + ), + ]; + client.innerApiCalls.listImageImportJobs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listImageImportJobs( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmmigration.v1.IImageImportJob[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listImageImports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listImageImports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listImageImports with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListImageImportsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListImageImportsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listImageImports.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listImageImportsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmmigration.v1.IImageImport[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listImageImports.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listImageImports.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listImageImportJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listImageImportJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listImageImportJobs', () => { - it('invokes listImageImportJobs without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListImageImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListImageImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImportJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImportJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImportJob()), - ]; - client.innerApiCalls.listImageImportJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listImageImportJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listImageImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImageImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listImageImportJobs with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListImageImportJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListImageImportJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listImageImportJobs = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listImageImportJobs(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listImageImportJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listImageImportJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listImageImportJobs without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListImageImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListImageImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImportJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImportJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImportJob()), - ]; - client.innerApiCalls.listImageImportJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listImageImportJobs( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IImageImportJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listImageImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImageImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listImageImportJobsStream without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListImageImportJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListImageImportJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImportJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImportJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImportJob(), + ), + ]; + client.descriptors.page.listImageImportJobs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listImageImportJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.ImageImportJob[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.ImageImportJob) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listImageImportJobs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listImageImportJobs, request), + ); + assert( + (client.descriptors.page.listImageImportJobs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listImageImportJobs with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListImageImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListImageImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listImageImportJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listImageImportJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listImageImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImageImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listImageImportJobsStream with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListImageImportJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListImageImportJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listImageImportJobs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listImageImportJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.ImageImportJob[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.ImageImportJob) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listImageImportJobs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listImageImportJobs, request), + ); + assert( + (client.descriptors.page.listImageImportJobs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listImageImportJobsStream without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListImageImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListImageImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImportJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImportJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImportJob()), - ]; - client.descriptors.page.listImageImportJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listImageImportJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.ImageImportJob[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.ImageImportJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listImageImportJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listImageImportJobs, request)); - assert( - (client.descriptors.page.listImageImportJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listImageImportJobs without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListImageImportJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListImageImportJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImportJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImportJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ImageImportJob(), + ), + ]; + client.descriptors.page.listImageImportJobs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmmigration.v1.IImageImportJob[] = + []; + const iterable = client.listImageImportJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listImageImportJobs.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listImageImportJobs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listImageImportJobsStream with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListImageImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListImageImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listImageImportJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listImageImportJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.ImageImportJob[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.ImageImportJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listImageImportJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listImageImportJobs, request)); - assert( - (client.descriptors.page.listImageImportJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listImageImportJobs with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListImageImportJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListImageImportJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listImageImportJobs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listImageImportJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmmigration.v1.IImageImportJob[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listImageImportJobs.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listImageImportJobs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listDiskMigrationJobs', () => { + it('invokes listDiskMigrationJobs without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DiskMigrationJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DiskMigrationJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DiskMigrationJob(), + ), + ]; + client.innerApiCalls.listDiskMigrationJobs = + stubSimpleCall(expectedResponse); + const [response] = await client.listDiskMigrationJobs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDiskMigrationJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDiskMigrationJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listImageImportJobs without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListImageImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListImageImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImportJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImportJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.ImageImportJob()), - ]; - client.descriptors.page.listImageImportJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmmigration.v1.IImageImportJob[] = []; - const iterable = client.listImageImportJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listDiskMigrationJobs without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DiskMigrationJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DiskMigrationJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DiskMigrationJob(), + ), + ]; + client.innerApiCalls.listDiskMigrationJobs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDiskMigrationJobs( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmmigration.v1.IDiskMigrationJob[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listImageImportJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listImageImportJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listImageImportJobs with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListImageImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListImageImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listImageImportJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listImageImportJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmmigration.v1.IImageImportJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listImageImportJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listImageImportJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDiskMigrationJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDiskMigrationJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listDiskMigrationJobs', () => { - it('invokes listDiskMigrationJobs without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DiskMigrationJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DiskMigrationJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DiskMigrationJob()), - ]; - client.innerApiCalls.listDiskMigrationJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listDiskMigrationJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDiskMigrationJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDiskMigrationJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDiskMigrationJobs without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DiskMigrationJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DiskMigrationJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DiskMigrationJob()), - ]; - client.innerApiCalls.listDiskMigrationJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDiskMigrationJobs( - request, - (err?: Error|null, result?: protos.google.cloud.vmmigration.v1.IDiskMigrationJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDiskMigrationJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDiskMigrationJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDiskMigrationJobs with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDiskMigrationJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDiskMigrationJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listDiskMigrationJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDiskMigrationJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listDiskMigrationJobs with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDiskMigrationJobs = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listDiskMigrationJobs(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listDiskMigrationJobs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDiskMigrationJobs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listDiskMigrationJobsStream without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DiskMigrationJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DiskMigrationJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DiskMigrationJob()), - ]; - client.descriptors.page.listDiskMigrationJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDiskMigrationJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.DiskMigrationJob[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.DiskMigrationJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listDiskMigrationJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDiskMigrationJobs, request)); - assert( - (client.descriptors.page.listDiskMigrationJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listDiskMigrationJobsStream without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DiskMigrationJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DiskMigrationJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DiskMigrationJob(), + ), + ]; + client.descriptors.page.listDiskMigrationJobs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listDiskMigrationJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.DiskMigrationJob[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.DiskMigrationJob) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listDiskMigrationJobs + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listDiskMigrationJobs, request), + ); + assert( + ( + client.descriptors.page.listDiskMigrationJobs + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listDiskMigrationJobsStream with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDiskMigrationJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDiskMigrationJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmmigration.v1.DiskMigrationJob[] = []; - stream.on('data', (response: protos.google.cloud.vmmigration.v1.DiskMigrationJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDiskMigrationJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDiskMigrationJobs, request)); - assert( - (client.descriptors.page.listDiskMigrationJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listDiskMigrationJobsStream with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDiskMigrationJobs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listDiskMigrationJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmmigration.v1.DiskMigrationJob[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmmigration.v1.DiskMigrationJob) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listDiskMigrationJobs + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listDiskMigrationJobs, request), + ); + assert( + ( + client.descriptors.page.listDiskMigrationJobs + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listDiskMigrationJobs without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DiskMigrationJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DiskMigrationJob()), - generateSampleMessage(new protos.google.cloud.vmmigration.v1.DiskMigrationJob()), - ]; - client.descriptors.page.listDiskMigrationJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmmigration.v1.IDiskMigrationJob[] = []; - const iterable = client.listDiskMigrationJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDiskMigrationJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDiskMigrationJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listDiskMigrationJobs without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DiskMigrationJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DiskMigrationJob(), + ), + generateSampleMessage( + new protos.google.cloud.vmmigration.v1.DiskMigrationJob(), + ), + ]; + client.descriptors.page.listDiskMigrationJobs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmmigration.v1.IDiskMigrationJob[] = + []; + const iterable = client.listDiskMigrationJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listDiskMigrationJobs + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listDiskMigrationJobs + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listDiskMigrationJobs with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDiskMigrationJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDiskMigrationJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmmigration.v1.IDiskMigrationJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDiskMigrationJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDiskMigrationJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listDiskMigrationJobs with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmmigration.v1.ListDiskMigrationJobsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDiskMigrationJobs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDiskMigrationJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmmigration.v1.IDiskMigrationJob[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listDiskMigrationJobs + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listDiskMigrationJobs + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('invokes getLocation with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('uses async iteration with listLocations with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.IOperation[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.IOperation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + }); + + describe('Path templates', () => { + describe('cloneJob', async () => { + const fakePath = '/rendered/path/cloneJob'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + source: 'sourceValue', + migrating_vm: 'migratingVmValue', + clone_job: 'cloneJobValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.cloneJobPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.cloneJobPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('cloneJobPath', () => { + const result = client.cloneJobPath( + 'projectValue', + 'locationValue', + 'sourceValue', + 'migratingVmValue', + 'cloneJobValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.cloneJobPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromCloneJobName', () => { + const result = client.matchProjectFromCloneJobName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.cloneJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCloneJobName', () => { + const result = client.matchLocationFromCloneJobName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.cloneJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSourceFromCloneJobName', () => { + const result = client.matchSourceFromCloneJobName(fakePath); + assert.strictEqual(result, 'sourceValue'); + assert( + (client.pathTemplates.cloneJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMigratingVmFromCloneJobName', () => { + const result = client.matchMigratingVmFromCloneJobName(fakePath); + assert.strictEqual(result, 'migratingVmValue'); + assert( + (client.pathTemplates.cloneJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCloneJobFromCloneJobName', () => { + const result = client.matchCloneJobFromCloneJobName(fakePath); + assert.strictEqual(result, 'cloneJobValue'); + assert( + (client.pathTemplates.cloneJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('cloneJob', async () => { - const fakePath = "/rendered/path/cloneJob"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - source: "sourceValue", - migrating_vm: "migratingVmValue", - clone_job: "cloneJobValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.cloneJobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cloneJobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cloneJobPath', () => { - const result = client.cloneJobPath("projectValue", "locationValue", "sourceValue", "migratingVmValue", "cloneJobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cloneJobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCloneJobName', () => { - const result = client.matchProjectFromCloneJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cloneJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCloneJobName', () => { - const result = client.matchLocationFromCloneJobName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cloneJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromCloneJobName', () => { - const result = client.matchSourceFromCloneJobName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.cloneJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMigratingVmFromCloneJobName', () => { - const result = client.matchMigratingVmFromCloneJobName(fakePath); - assert.strictEqual(result, "migratingVmValue"); - assert((client.pathTemplates.cloneJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCloneJobFromCloneJobName', () => { - const result = client.matchCloneJobFromCloneJobName(fakePath); - assert.strictEqual(result, "cloneJobValue"); - assert((client.pathTemplates.cloneJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('cryptoKey', async () => { - const fakePath = "/rendered/path/cryptoKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.cryptoKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyPath', () => { - const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyName', () => { - const result = client.matchProjectFromCryptoKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyName', () => { - const result = client.matchLocationFromCryptoKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromCryptoKeyName', () => { - const result = client.matchKeyRingFromCryptoKeyName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromCryptoKeyName', () => { - const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('cryptoKey', async () => { + const fakePath = '/rendered/path/cryptoKey'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + key_ring: 'keyRingValue', + crypto_key: 'cryptoKeyValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath( + 'projectValue', + 'locationValue', + 'keyRingValue', + 'cryptoKeyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchKeyRingFromCryptoKeyName', () => { + const result = client.matchKeyRingFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCryptoKeyFromCryptoKeyName', () => { + const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'cryptoKeyValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('cutoverJob', async () => { - const fakePath = "/rendered/path/cutoverJob"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - source: "sourceValue", - migrating_vm: "migratingVmValue", - cutover_job: "cutoverJobValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.cutoverJobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cutoverJobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cutoverJobPath', () => { - const result = client.cutoverJobPath("projectValue", "locationValue", "sourceValue", "migratingVmValue", "cutoverJobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cutoverJobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCutoverJobName', () => { - const result = client.matchProjectFromCutoverJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cutoverJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCutoverJobName', () => { - const result = client.matchLocationFromCutoverJobName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cutoverJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromCutoverJobName', () => { - const result = client.matchSourceFromCutoverJobName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.cutoverJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMigratingVmFromCutoverJobName', () => { - const result = client.matchMigratingVmFromCutoverJobName(fakePath); - assert.strictEqual(result, "migratingVmValue"); - assert((client.pathTemplates.cutoverJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCutoverJobFromCutoverJobName', () => { - const result = client.matchCutoverJobFromCutoverJobName(fakePath); - assert.strictEqual(result, "cutoverJobValue"); - assert((client.pathTemplates.cutoverJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('cutoverJob', async () => { + const fakePath = '/rendered/path/cutoverJob'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + source: 'sourceValue', + migrating_vm: 'migratingVmValue', + cutover_job: 'cutoverJobValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.cutoverJobPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.cutoverJobPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('cutoverJobPath', () => { + const result = client.cutoverJobPath( + 'projectValue', + 'locationValue', + 'sourceValue', + 'migratingVmValue', + 'cutoverJobValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.cutoverJobPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromCutoverJobName', () => { + const result = client.matchProjectFromCutoverJobName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.cutoverJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCutoverJobName', () => { + const result = client.matchLocationFromCutoverJobName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.cutoverJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSourceFromCutoverJobName', () => { + const result = client.matchSourceFromCutoverJobName(fakePath); + assert.strictEqual(result, 'sourceValue'); + assert( + (client.pathTemplates.cutoverJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMigratingVmFromCutoverJobName', () => { + const result = client.matchMigratingVmFromCutoverJobName(fakePath); + assert.strictEqual(result, 'migratingVmValue'); + assert( + (client.pathTemplates.cutoverJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCutoverJobFromCutoverJobName', () => { + const result = client.matchCutoverJobFromCutoverJobName(fakePath); + assert.strictEqual(result, 'cutoverJobValue'); + assert( + (client.pathTemplates.cutoverJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('datacenterConnector', async () => { - const fakePath = "/rendered/path/datacenterConnector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - source: "sourceValue", - datacenter_connector: "datacenterConnectorValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.datacenterConnectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.datacenterConnectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('datacenterConnectorPath', () => { - const result = client.datacenterConnectorPath("projectValue", "locationValue", "sourceValue", "datacenterConnectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.datacenterConnectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDatacenterConnectorName', () => { - const result = client.matchProjectFromDatacenterConnectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.datacenterConnectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDatacenterConnectorName', () => { - const result = client.matchLocationFromDatacenterConnectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.datacenterConnectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromDatacenterConnectorName', () => { - const result = client.matchSourceFromDatacenterConnectorName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.datacenterConnectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDatacenterConnectorFromDatacenterConnectorName', () => { - const result = client.matchDatacenterConnectorFromDatacenterConnectorName(fakePath); - assert.strictEqual(result, "datacenterConnectorValue"); - assert((client.pathTemplates.datacenterConnectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('datacenterConnector', async () => { + const fakePath = '/rendered/path/datacenterConnector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + source: 'sourceValue', + datacenter_connector: 'datacenterConnectorValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.datacenterConnectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.datacenterConnectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('datacenterConnectorPath', () => { + const result = client.datacenterConnectorPath( + 'projectValue', + 'locationValue', + 'sourceValue', + 'datacenterConnectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.datacenterConnectorPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDatacenterConnectorName', () => { + const result = client.matchProjectFromDatacenterConnectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.datacenterConnectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDatacenterConnectorName', () => { + const result = + client.matchLocationFromDatacenterConnectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.datacenterConnectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSourceFromDatacenterConnectorName', () => { + const result = client.matchSourceFromDatacenterConnectorName(fakePath); + assert.strictEqual(result, 'sourceValue'); + assert( + ( + client.pathTemplates.datacenterConnectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDatacenterConnectorFromDatacenterConnectorName', () => { + const result = + client.matchDatacenterConnectorFromDatacenterConnectorName(fakePath); + assert.strictEqual(result, 'datacenterConnectorValue'); + assert( + ( + client.pathTemplates.datacenterConnectorPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('diskMigrationJob', async () => { - const fakePath = "/rendered/path/diskMigrationJob"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - source: "sourceValue", - disk_migration_job: "diskMigrationJobValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.diskMigrationJobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.diskMigrationJobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('diskMigrationJobPath', () => { - const result = client.diskMigrationJobPath("projectValue", "locationValue", "sourceValue", "diskMigrationJobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.diskMigrationJobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDiskMigrationJobName', () => { - const result = client.matchProjectFromDiskMigrationJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.diskMigrationJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDiskMigrationJobName', () => { - const result = client.matchLocationFromDiskMigrationJobName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.diskMigrationJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromDiskMigrationJobName', () => { - const result = client.matchSourceFromDiskMigrationJobName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.diskMigrationJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDiskMigrationJobFromDiskMigrationJobName', () => { - const result = client.matchDiskMigrationJobFromDiskMigrationJobName(fakePath); - assert.strictEqual(result, "diskMigrationJobValue"); - assert((client.pathTemplates.diskMigrationJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('diskMigrationJob', async () => { + const fakePath = '/rendered/path/diskMigrationJob'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + source: 'sourceValue', + disk_migration_job: 'diskMigrationJobValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.diskMigrationJobPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.diskMigrationJobPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('diskMigrationJobPath', () => { + const result = client.diskMigrationJobPath( + 'projectValue', + 'locationValue', + 'sourceValue', + 'diskMigrationJobValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.diskMigrationJobPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDiskMigrationJobName', () => { + const result = client.matchProjectFromDiskMigrationJobName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.diskMigrationJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDiskMigrationJobName', () => { + const result = client.matchLocationFromDiskMigrationJobName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.diskMigrationJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSourceFromDiskMigrationJobName', () => { + const result = client.matchSourceFromDiskMigrationJobName(fakePath); + assert.strictEqual(result, 'sourceValue'); + assert( + (client.pathTemplates.diskMigrationJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDiskMigrationJobFromDiskMigrationJobName', () => { + const result = + client.matchDiskMigrationJobFromDiskMigrationJobName(fakePath); + assert.strictEqual(result, 'diskMigrationJobValue'); + assert( + (client.pathTemplates.diskMigrationJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('group', async () => { - const fakePath = "/rendered/path/group"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - group: "groupValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.groupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.groupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('groupPath', () => { - const result = client.groupPath("projectValue", "locationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.groupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGroupName', () => { - const result = client.matchProjectFromGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.groupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGroupName', () => { - const result = client.matchLocationFromGroupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.groupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromGroupName', () => { - const result = client.matchGroupFromGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.groupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('group', async () => { + const fakePath = '/rendered/path/group'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + group: 'groupValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.groupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.groupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('groupPath', () => { + const result = client.groupPath( + 'projectValue', + 'locationValue', + 'groupValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.groupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromGroupName', () => { + const result = client.matchProjectFromGroupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.groupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromGroupName', () => { + const result = client.matchLocationFromGroupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.groupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchGroupFromGroupName', () => { + const result = client.matchGroupFromGroupName(fakePath); + assert.strictEqual(result, 'groupValue'); + assert( + (client.pathTemplates.groupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('imageImport', async () => { - const fakePath = "/rendered/path/imageImport"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - job: "jobValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.imageImportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.imageImportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('imageImportPath', () => { - const result = client.imageImportPath("projectValue", "locationValue", "jobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.imageImportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromImageImportName', () => { - const result = client.matchProjectFromImageImportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.imageImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromImageImportName', () => { - const result = client.matchLocationFromImageImportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.imageImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchJobFromImageImportName', () => { - const result = client.matchJobFromImageImportName(fakePath); - assert.strictEqual(result, "jobValue"); - assert((client.pathTemplates.imageImportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('imageImport', async () => { + const fakePath = '/rendered/path/imageImport'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + job: 'jobValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.imageImportPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.imageImportPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('imageImportPath', () => { + const result = client.imageImportPath( + 'projectValue', + 'locationValue', + 'jobValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.imageImportPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromImageImportName', () => { + const result = client.matchProjectFromImageImportName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.imageImportPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromImageImportName', () => { + const result = client.matchLocationFromImageImportName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.imageImportPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchJobFromImageImportName', () => { + const result = client.matchJobFromImageImportName(fakePath); + assert.strictEqual(result, 'jobValue'); + assert( + (client.pathTemplates.imageImportPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('imageImportJob', async () => { - const fakePath = "/rendered/path/imageImportJob"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - job: "jobValue", - result: "resultValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.imageImportJobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.imageImportJobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('imageImportJobPath', () => { - const result = client.imageImportJobPath("projectValue", "locationValue", "jobValue", "resultValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.imageImportJobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromImageImportJobName', () => { - const result = client.matchProjectFromImageImportJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.imageImportJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromImageImportJobName', () => { - const result = client.matchLocationFromImageImportJobName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.imageImportJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchJobFromImageImportJobName', () => { - const result = client.matchJobFromImageImportJobName(fakePath); - assert.strictEqual(result, "jobValue"); - assert((client.pathTemplates.imageImportJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchResultFromImageImportJobName', () => { - const result = client.matchResultFromImageImportJobName(fakePath); - assert.strictEqual(result, "resultValue"); - assert((client.pathTemplates.imageImportJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('imageImportJob', async () => { + const fakePath = '/rendered/path/imageImportJob'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + job: 'jobValue', + result: 'resultValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.imageImportJobPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.imageImportJobPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('imageImportJobPath', () => { + const result = client.imageImportJobPath( + 'projectValue', + 'locationValue', + 'jobValue', + 'resultValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.imageImportJobPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromImageImportJobName', () => { + const result = client.matchProjectFromImageImportJobName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.imageImportJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromImageImportJobName', () => { + const result = client.matchLocationFromImageImportJobName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.imageImportJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchJobFromImageImportJobName', () => { + const result = client.matchJobFromImageImportJobName(fakePath); + assert.strictEqual(result, 'jobValue'); + assert( + (client.pathTemplates.imageImportJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchResultFromImageImportJobName', () => { + const result = client.matchResultFromImageImportJobName(fakePath); + assert.strictEqual(result, 'resultValue'); + assert( + (client.pathTemplates.imageImportJobPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('migratingVm', async () => { - const fakePath = "/rendered/path/migratingVm"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - source: "sourceValue", - migrating_vm: "migratingVmValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.migratingVmPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.migratingVmPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('migratingVmPath', () => { - const result = client.migratingVmPath("projectValue", "locationValue", "sourceValue", "migratingVmValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.migratingVmPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMigratingVmName', () => { - const result = client.matchProjectFromMigratingVmName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.migratingVmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMigratingVmName', () => { - const result = client.matchLocationFromMigratingVmName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.migratingVmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromMigratingVmName', () => { - const result = client.matchSourceFromMigratingVmName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.migratingVmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMigratingVmFromMigratingVmName', () => { - const result = client.matchMigratingVmFromMigratingVmName(fakePath); - assert.strictEqual(result, "migratingVmValue"); - assert((client.pathTemplates.migratingVmPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('migratingVm', async () => { + const fakePath = '/rendered/path/migratingVm'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + source: 'sourceValue', + migrating_vm: 'migratingVmValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.migratingVmPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.migratingVmPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('migratingVmPath', () => { + const result = client.migratingVmPath( + 'projectValue', + 'locationValue', + 'sourceValue', + 'migratingVmValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.migratingVmPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromMigratingVmName', () => { + const result = client.matchProjectFromMigratingVmName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.migratingVmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromMigratingVmName', () => { + const result = client.matchLocationFromMigratingVmName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.migratingVmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSourceFromMigratingVmName', () => { + const result = client.matchSourceFromMigratingVmName(fakePath); + assert.strictEqual(result, 'sourceValue'); + assert( + (client.pathTemplates.migratingVmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMigratingVmFromMigratingVmName', () => { + const result = client.matchMigratingVmFromMigratingVmName(fakePath); + assert.strictEqual(result, 'migratingVmValue'); + assert( + (client.pathTemplates.migratingVmPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('replicationCycle', async () => { - const fakePath = "/rendered/path/replicationCycle"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - source: "sourceValue", - migrating_vm: "migratingVmValue", - replication_cycle: "replicationCycleValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.replicationCyclePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.replicationCyclePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('replicationCyclePath', () => { - const result = client.replicationCyclePath("projectValue", "locationValue", "sourceValue", "migratingVmValue", "replicationCycleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.replicationCyclePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromReplicationCycleName', () => { - const result = client.matchProjectFromReplicationCycleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.replicationCyclePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromReplicationCycleName', () => { - const result = client.matchLocationFromReplicationCycleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.replicationCyclePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromReplicationCycleName', () => { - const result = client.matchSourceFromReplicationCycleName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.replicationCyclePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMigratingVmFromReplicationCycleName', () => { - const result = client.matchMigratingVmFromReplicationCycleName(fakePath); - assert.strictEqual(result, "migratingVmValue"); - assert((client.pathTemplates.replicationCyclePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchReplicationCycleFromReplicationCycleName', () => { - const result = client.matchReplicationCycleFromReplicationCycleName(fakePath); - assert.strictEqual(result, "replicationCycleValue"); - assert((client.pathTemplates.replicationCyclePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('replicationCycle', async () => { + const fakePath = '/rendered/path/replicationCycle'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + source: 'sourceValue', + migrating_vm: 'migratingVmValue', + replication_cycle: 'replicationCycleValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.replicationCyclePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.replicationCyclePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('replicationCyclePath', () => { + const result = client.replicationCyclePath( + 'projectValue', + 'locationValue', + 'sourceValue', + 'migratingVmValue', + 'replicationCycleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.replicationCyclePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromReplicationCycleName', () => { + const result = client.matchProjectFromReplicationCycleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.replicationCyclePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromReplicationCycleName', () => { + const result = client.matchLocationFromReplicationCycleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.replicationCyclePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSourceFromReplicationCycleName', () => { + const result = client.matchSourceFromReplicationCycleName(fakePath); + assert.strictEqual(result, 'sourceValue'); + assert( + (client.pathTemplates.replicationCyclePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchMigratingVmFromReplicationCycleName', () => { + const result = + client.matchMigratingVmFromReplicationCycleName(fakePath); + assert.strictEqual(result, 'migratingVmValue'); + assert( + (client.pathTemplates.replicationCyclePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchReplicationCycleFromReplicationCycleName', () => { + const result = + client.matchReplicationCycleFromReplicationCycleName(fakePath); + assert.strictEqual(result, 'replicationCycleValue'); + assert( + (client.pathTemplates.replicationCyclePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('serviceAccount', async () => { - const fakePath = "/rendered/path/serviceAccount"; - const expectedParameters = { - project: "projectValue", - service_account: "serviceAccountValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.serviceAccountPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.serviceAccountPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('serviceAccountPath', () => { - const result = client.serviceAccountPath("projectValue", "serviceAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.serviceAccountPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServiceAccountName', () => { - const result = client.matchProjectFromServiceAccountName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.serviceAccountPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceAccountFromServiceAccountName', () => { - const result = client.matchServiceAccountFromServiceAccountName(fakePath); - assert.strictEqual(result, "serviceAccountValue"); - assert((client.pathTemplates.serviceAccountPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('serviceAccount', async () => { + const fakePath = '/rendered/path/serviceAccount'; + const expectedParameters = { + project: 'projectValue', + service_account: 'serviceAccountValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.serviceAccountPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.serviceAccountPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('serviceAccountPath', () => { + const result = client.serviceAccountPath( + 'projectValue', + 'serviceAccountValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.serviceAccountPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromServiceAccountName', () => { + const result = client.matchProjectFromServiceAccountName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.serviceAccountPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchServiceAccountFromServiceAccountName', () => { + const result = + client.matchServiceAccountFromServiceAccountName(fakePath); + assert.strictEqual(result, 'serviceAccountValue'); + assert( + (client.pathTemplates.serviceAccountPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('source', async () => { - const fakePath = "/rendered/path/source"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - source: "sourceValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sourcePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sourcePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sourcePath', () => { - const result = client.sourcePath("projectValue", "locationValue", "sourceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sourcePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSourceName', () => { - const result = client.matchProjectFromSourceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSourceName', () => { - const result = client.matchLocationFromSourceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromSourceName', () => { - const result = client.matchSourceFromSourceName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.sourcePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('source', async () => { + const fakePath = '/rendered/path/source'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + source: 'sourceValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.sourcePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.sourcePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('sourcePath', () => { + const result = client.sourcePath( + 'projectValue', + 'locationValue', + 'sourceValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.sourcePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSourceName', () => { + const result = client.matchProjectFromSourceName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.sourcePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSourceName', () => { + const result = client.matchLocationFromSourceName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.sourcePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSourceFromSourceName', () => { + const result = client.matchSourceFromSourceName(fakePath); + assert.strictEqual(result, 'sourceValue'); + assert( + (client.pathTemplates.sourcePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('targetProject', async () => { - const fakePath = "/rendered/path/targetProject"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - target_project: "targetProjectValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.targetProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.targetProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('targetProjectPath', () => { - const result = client.targetProjectPath("projectValue", "locationValue", "targetProjectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.targetProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTargetProjectName', () => { - const result = client.matchProjectFromTargetProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.targetProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTargetProjectName', () => { - const result = client.matchLocationFromTargetProjectName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.targetProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTargetProjectFromTargetProjectName', () => { - const result = client.matchTargetProjectFromTargetProjectName(fakePath); - assert.strictEqual(result, "targetProjectValue"); - assert((client.pathTemplates.targetProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('targetProject', async () => { + const fakePath = '/rendered/path/targetProject'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + target_project: 'targetProjectValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.targetProjectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.targetProjectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('targetProjectPath', () => { + const result = client.targetProjectPath( + 'projectValue', + 'locationValue', + 'targetProjectValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.targetProjectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromTargetProjectName', () => { + const result = client.matchProjectFromTargetProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.targetProjectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromTargetProjectName', () => { + const result = client.matchLocationFromTargetProjectName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.targetProjectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchTargetProjectFromTargetProjectName', () => { + const result = client.matchTargetProjectFromTargetProjectName(fakePath); + assert.strictEqual(result, 'targetProjectValue'); + assert( + (client.pathTemplates.targetProjectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('utilizationReport', async () => { - const fakePath = "/rendered/path/utilizationReport"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - source: "sourceValue", - utilization_report: "utilizationReportValue", - }; - const client = new vmmigrationModule.v1.VmMigrationClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.utilizationReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.utilizationReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('utilizationReportPath', () => { - const result = client.utilizationReportPath("projectValue", "locationValue", "sourceValue", "utilizationReportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.utilizationReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromUtilizationReportName', () => { - const result = client.matchProjectFromUtilizationReportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.utilizationReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromUtilizationReportName', () => { - const result = client.matchLocationFromUtilizationReportName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.utilizationReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSourceFromUtilizationReportName', () => { - const result = client.matchSourceFromUtilizationReportName(fakePath); - assert.strictEqual(result, "sourceValue"); - assert((client.pathTemplates.utilizationReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUtilizationReportFromUtilizationReportName', () => { - const result = client.matchUtilizationReportFromUtilizationReportName(fakePath); - assert.strictEqual(result, "utilizationReportValue"); - assert((client.pathTemplates.utilizationReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('utilizationReport', async () => { + const fakePath = '/rendered/path/utilizationReport'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + source: 'sourceValue', + utilization_report: 'utilizationReportValue', + }; + const client = new vmmigrationModule.v1.VmMigrationClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.utilizationReportPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.utilizationReportPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('utilizationReportPath', () => { + const result = client.utilizationReportPath( + 'projectValue', + 'locationValue', + 'sourceValue', + 'utilizationReportValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.utilizationReportPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromUtilizationReportName', () => { + const result = client.matchProjectFromUtilizationReportName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.utilizationReportPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromUtilizationReportName', () => { + const result = client.matchLocationFromUtilizationReportName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.utilizationReportPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSourceFromUtilizationReportName', () => { + const result = client.matchSourceFromUtilizationReportName(fakePath); + assert.strictEqual(result, 'sourceValue'); + assert( + ( + client.pathTemplates.utilizationReportPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchUtilizationReportFromUtilizationReportName', () => { + const result = + client.matchUtilizationReportFromUtilizationReportName(fakePath); + assert.strictEqual(result, 'utilizationReportValue'); + assert( + ( + client.pathTemplates.utilizationReportPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-vmmigration/webpack.config.js b/packages/google-cloud-vmmigration/webpack.config.js index 33a8988db8a3..67a761b7a437 100644 --- a/packages/google-cloud-vmmigration/webpack.config.js +++ b/packages/google-cloud-vmmigration/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2026 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. diff --git a/packages/google-cloud-vmwareengine/.eslintignore b/packages/google-cloud-vmwareengine/.eslintignore new file mode 100644 index 000000000000..cfc348ec4d11 --- /dev/null +++ b/packages/google-cloud-vmwareengine/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/packages/google-cloud-vmwareengine/.eslintrc.json b/packages/google-cloud-vmwareengine/.eslintrc.json new file mode 100644 index 000000000000..3e8d97ccb390 --- /dev/null +++ b/packages/google-cloud-vmwareengine/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "./node_modules/gts", + "root": true +} diff --git a/packages/google-cloud-vmwareengine/README.md b/packages/google-cloud-vmwareengine/README.md index e678fda8bfef..583f2ea1ebac 100644 --- a/packages/google-cloud-vmwareengine/README.md +++ b/packages/google-cloud-vmwareengine/README.md @@ -166,7 +166,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-vmwareengine/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). Please note that this `README.md` and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) @@ -176,7 +176,7 @@ are generated from a central template. Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-vmwareengine/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project diff --git a/packages/google-cloud-vmwareengine/protos/protos.d.ts b/packages/google-cloud-vmwareengine/protos/protos.d.ts index 35417d29d798..7648bfd4a63d 100644 --- a/packages/google-cloud-vmwareengine/protos/protos.d.ts +++ b/packages/google-cloud-vmwareengine/protos/protos.d.ts @@ -16563,6 +16563,9 @@ export namespace google { /** CommonLanguageSettings destinations */ destinations?: (google.api.ClientLibraryDestination[]|null); + + /** CommonLanguageSettings selectiveGapicGeneration */ + selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); } /** Represents a CommonLanguageSettings. */ @@ -16580,6 +16583,9 @@ export namespace google { /** CommonLanguageSettings destinations. */ public destinations: google.api.ClientLibraryDestination[]; + /** CommonLanguageSettings selectiveGapicGeneration. */ + public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @param [properties] Properties to set @@ -17280,6 +17286,9 @@ export namespace google { /** PythonSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures */ + experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); } /** Represents a PythonSettings. */ @@ -17294,6 +17303,9 @@ export namespace google { /** PythonSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** PythonSettings experimentalFeatures. */ + public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + /** * Creates a new PythonSettings instance using the specified properties. * @param [properties] Properties to set @@ -17372,6 +17384,118 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace PythonSettings { + + /** Properties of an ExperimentalFeatures. */ + interface IExperimentalFeatures { + + /** ExperimentalFeatures restAsyncIoEnabled */ + restAsyncIoEnabled?: (boolean|null); + + /** ExperimentalFeatures protobufPythonicTypesEnabled */ + protobufPythonicTypesEnabled?: (boolean|null); + + /** ExperimentalFeatures unversionedPackageDisabled */ + unversionedPackageDisabled?: (boolean|null); + } + + /** Represents an ExperimentalFeatures. */ + class ExperimentalFeatures implements IExperimentalFeatures { + + /** + * Constructs a new ExperimentalFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); + + /** ExperimentalFeatures restAsyncIoEnabled. */ + public restAsyncIoEnabled: boolean; + + /** ExperimentalFeatures protobufPythonicTypesEnabled. */ + public protobufPythonicTypesEnabled: boolean; + + /** ExperimentalFeatures unversionedPackageDisabled. */ + public unversionedPackageDisabled: boolean; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns ExperimentalFeatures instance + */ + public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Verifies an ExperimentalFeatures 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 an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExperimentalFeatures + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @param message ExperimentalFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExperimentalFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Properties of a NodeSettings. */ interface INodeSettings { @@ -17698,6 +17822,9 @@ export namespace google { /** GoSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); } /** Represents a GoSettings. */ @@ -17712,6 +17839,9 @@ export namespace google { /** GoSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** GoSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + /** * Creates a new GoSettings instance using the specified properties. * @param [properties] Properties to set @@ -18036,6 +18166,109 @@ export namespace google { PACKAGE_MANAGER = 20 } + /** Properties of a SelectiveGapicGeneration. */ + interface ISelectiveGapicGeneration { + + /** SelectiveGapicGeneration methods */ + methods?: (string[]|null); + + /** SelectiveGapicGeneration generateOmittedAsInternal */ + generateOmittedAsInternal?: (boolean|null); + } + + /** Represents a SelectiveGapicGeneration. */ + class SelectiveGapicGeneration implements ISelectiveGapicGeneration { + + /** + * Constructs a new SelectiveGapicGeneration. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ISelectiveGapicGeneration); + + /** SelectiveGapicGeneration methods. */ + public methods: string[]; + + /** SelectiveGapicGeneration generateOmittedAsInternal. */ + public generateOmittedAsInternal: boolean; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectiveGapicGeneration instance + */ + public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Verifies a SelectiveGapicGeneration 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 SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectiveGapicGeneration + */ + public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @param message SelectiveGapicGeneration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** LaunchStage enum. */ enum LaunchStage { LAUNCH_STAGE_UNSPECIFIED = 0, @@ -18066,6 +18299,9 @@ export namespace google { /** FieldInfo format */ format?: (google.api.FieldInfo.Format|keyof typeof google.api.FieldInfo.Format|null); + + /** FieldInfo referencedTypes */ + referencedTypes?: (google.api.ITypeReference[]|null); } /** Represents a FieldInfo. */ @@ -18080,6 +18316,9 @@ export namespace google { /** FieldInfo format. */ public format: (google.api.FieldInfo.Format|keyof typeof google.api.FieldInfo.Format); + /** FieldInfo referencedTypes. */ + public referencedTypes: google.api.ITypeReference[]; + /** * Creates a new FieldInfo instance using the specified properties. * @param [properties] Properties to set @@ -18170,6 +18409,103 @@ export namespace google { } } + /** Properties of a TypeReference. */ + interface ITypeReference { + + /** TypeReference typeName */ + typeName?: (string|null); + } + + /** Represents a TypeReference. */ + class TypeReference implements ITypeReference { + + /** + * Constructs a new TypeReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ITypeReference); + + /** TypeReference typeName. */ + public typeName: string; + + /** + * Creates a new TypeReference instance using the specified properties. + * @param [properties] Properties to set + * @returns TypeReference instance + */ + public static create(properties?: google.api.ITypeReference): google.api.TypeReference; + + /** + * Encodes the specified TypeReference message. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @param message TypeReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ITypeReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TypeReference message, length delimited. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @param message TypeReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ITypeReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TypeReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TypeReference + * @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.api.TypeReference; + + /** + * Decodes a TypeReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TypeReference + * @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.api.TypeReference; + + /** + * Verifies a TypeReference 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 TypeReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TypeReference + */ + public static fromObject(object: { [k: string]: any }): google.api.TypeReference; + + /** + * Creates a plain object from a TypeReference message. Also converts values to other types if specified. + * @param message TypeReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.TypeReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TypeReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TypeReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a ResourceDescriptor. */ interface IResourceDescriptor { @@ -18526,6 +18862,7 @@ export namespace google { /** Edition enum. */ enum Edition { EDITION_UNKNOWN = 0, + EDITION_LEGACY = 900, EDITION_PROTO2 = 998, EDITION_PROTO3 = 999, EDITION_2023 = 1000, @@ -18556,6 +18893,9 @@ export namespace google { /** FileDescriptorProto weakDependency */ weakDependency?: (number[]|null); + /** FileDescriptorProto optionDependency */ + optionDependency?: (string[]|null); + /** FileDescriptorProto messageType */ messageType?: (google.protobuf.IDescriptorProto[]|null); @@ -18605,6 +18945,9 @@ export namespace google { /** FileDescriptorProto weakDependency. */ public weakDependency: number[]; + /** FileDescriptorProto optionDependency. */ + public optionDependency: string[]; + /** FileDescriptorProto messageType. */ public messageType: google.protobuf.IDescriptorProto[]; @@ -18739,6 +19082,9 @@ export namespace google { /** DescriptorProto reservedName */ reservedName?: (string[]|null); + + /** DescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents a DescriptorProto. */ @@ -18780,6 +19126,9 @@ export namespace google { /** DescriptorProto reservedName. */ public reservedName: string[]; + /** DescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new DescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -19627,6 +19976,9 @@ export namespace google { /** EnumDescriptorProto reservedName */ reservedName?: (string[]|null); + + /** EnumDescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents an EnumDescriptorProto. */ @@ -19653,6 +20005,9 @@ export namespace google { /** EnumDescriptorProto reservedName. */ public reservedName: string[]; + /** EnumDescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -20587,6 +20942,9 @@ export namespace google { /** FieldOptions features */ features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); @@ -20645,6 +21003,9 @@ export namespace google { /** FieldOptions features. */ public features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -20865,6 +21226,121 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a FeatureSupport. */ + interface IFeatureSupport { + + /** FeatureSupport editionIntroduced */ + editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport editionDeprecated */ + editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport deprecationWarning */ + deprecationWarning?: (string|null); + + /** FeatureSupport editionRemoved */ + editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSupport. */ + class FeatureSupport implements IFeatureSupport { + + /** + * Constructs a new FeatureSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); + + /** FeatureSupport editionIntroduced. */ + public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport editionDeprecated. */ + public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport deprecationWarning. */ + public deprecationWarning: string; + + /** FeatureSupport editionRemoved. */ + public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSupport instance + */ + public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Verifies a FeatureSupport 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 FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSupport + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @param message FeatureSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of an OneofOptions. */ @@ -21103,6 +21579,9 @@ export namespace google { /** EnumValueOptions debugRedact */ debugRedact?: (boolean|null); + /** EnumValueOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); } @@ -21125,6 +21604,9 @@ export namespace google { /** EnumValueOptions debugRedact. */ public debugRedact: boolean; + /** EnumValueOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -21717,6 +22199,12 @@ export namespace google { /** FeatureSet jsonFormat */ jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); + + /** FeatureSet enforceNamingStyle */ + enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); + + /** FeatureSet defaultSymbolVisibility */ + defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); } /** Represents a FeatureSet. */ @@ -21746,6 +22234,12 @@ export namespace google { /** FeatureSet jsonFormat. */ public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); + /** FeatureSet enforceNamingStyle. */ + public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); + + /** FeatureSet defaultSymbolVisibility. */ + public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); + /** * Creates a new FeatureSet instance using the specified properties. * @param [properties] Properties to set @@ -21868,6 +22362,116 @@ export namespace google { ALLOW = 1, LEGACY_BEST_EFFORT = 2 } + + /** EnforceNamingStyle enum. */ + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2 + } + + /** Properties of a VisibilityFeature. */ + interface IVisibilityFeature { + } + + /** Represents a VisibilityFeature. */ + class VisibilityFeature implements IVisibilityFeature { + + /** + * Constructs a new VisibilityFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns VisibilityFeature instance + */ + public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Verifies a VisibilityFeature 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 VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisibilityFeature + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @param message VisibilityFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisibilityFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisibilityFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VisibilityFeature { + + /** DefaultSymbolVisibility enum. */ + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + EXPORT_ALL = 1, + EXPORT_TOP_LEVEL = 2, + LOCAL_ALL = 3, + STRICT = 4 + } + } } /** Properties of a FeatureSetDefaults. */ @@ -21987,8 +22591,11 @@ export namespace google { /** FeatureSetEditionDefault edition */ edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - /** FeatureSetEditionDefault features */ - features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures */ + overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures */ + fixedFeatures?: (google.protobuf.IFeatureSet|null); } /** Represents a FeatureSetEditionDefault. */ @@ -22003,8 +22610,11 @@ export namespace google { /** FeatureSetEditionDefault edition. */ public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - /** FeatureSetEditionDefault features. */ - public features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures. */ + public overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures. */ + public fixedFeatures?: (google.protobuf.IFeatureSet|null); /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -22537,6 +23147,13 @@ export namespace google { } } + /** SymbolVisibility enum. */ + enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2 + } + /** Properties of a Duration. */ interface IDuration { diff --git a/packages/google-cloud-vmwareengine/protos/protos.js b/packages/google-cloud-vmwareengine/protos/protos.js index c76154be1fdc..a9f52e258e10 100644 --- a/packages/google-cloud-vmwareengine/protos/protos.js +++ b/packages/google-cloud-vmwareengine/protos/protos.js @@ -40282,6 +40282,7 @@ * @interface ICommonLanguageSettings * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri * @property {Array.|null} [destinations] CommonLanguageSettings destinations + * @property {google.api.ISelectiveGapicGeneration|null} [selectiveGapicGeneration] CommonLanguageSettings selectiveGapicGeneration */ /** @@ -40316,6 +40317,14 @@ */ CommonLanguageSettings.prototype.destinations = $util.emptyArray; + /** + * CommonLanguageSettings selectiveGapicGeneration. + * @member {google.api.ISelectiveGapicGeneration|null|undefined} selectiveGapicGeneration + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.selectiveGapicGeneration = null; + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @function create @@ -40348,6 +40357,8 @@ writer.int32(message.destinations[i]); writer.ldelim(); } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -40399,6 +40410,10 @@ message.destinations.push(reader.int32()); break; } + case 3: { + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -40450,6 +40465,11 @@ break; } } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { + var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration); + if (error) + return "selectiveGapicGeneration." + error; + } return null; }; @@ -40492,6 +40512,11 @@ break; } } + if (object.selectiveGapicGeneration != null) { + if (typeof object.selectiveGapicGeneration !== "object") + throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration); + } return message; }; @@ -40510,8 +40535,10 @@ var object = {}; if (options.arrays || options.defaults) object.destinations = []; - if (options.defaults) + if (options.defaults) { object.referenceDocsUri = ""; + object.selectiveGapicGeneration = null; + } if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) object.referenceDocsUri = message.referenceDocsUri; if (message.destinations && message.destinations.length) { @@ -40519,6 +40546,8 @@ for (var j = 0; j < message.destinations.length; ++j) object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) + object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options); return object; }; @@ -42341,6 +42370,7 @@ * @memberof google.api * @interface IPythonSettings * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common + * @property {google.api.PythonSettings.IExperimentalFeatures|null} [experimentalFeatures] PythonSettings experimentalFeatures */ /** @@ -42366,6 +42396,14 @@ */ PythonSettings.prototype.common = null; + /** + * PythonSettings experimentalFeatures. + * @member {google.api.PythonSettings.IExperimentalFeatures|null|undefined} experimentalFeatures + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.experimentalFeatures = null; + /** * Creates a new PythonSettings instance using the specified properties. * @function create @@ -42392,6 +42430,8 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -42432,6 +42472,10 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -42472,6 +42516,11 @@ if (error) return "common." + error; } + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { + var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures); + if (error) + return "experimentalFeatures." + error; + } return null; }; @@ -42492,6 +42541,11 @@ throw TypeError(".google.api.PythonSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.experimentalFeatures != null) { + if (typeof object.experimentalFeatures !== "object") + throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures); + } return message; }; @@ -42508,10 +42562,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.common = null; + object.experimentalFeatures = null; + } if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) + object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options); return object; }; @@ -42541,6 +42599,258 @@ return typeUrlPrefix + "/google.api.PythonSettings"; }; + PythonSettings.ExperimentalFeatures = (function() { + + /** + * Properties of an ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @interface IExperimentalFeatures + * @property {boolean|null} [restAsyncIoEnabled] ExperimentalFeatures restAsyncIoEnabled + * @property {boolean|null} [protobufPythonicTypesEnabled] ExperimentalFeatures protobufPythonicTypesEnabled + * @property {boolean|null} [unversionedPackageDisabled] ExperimentalFeatures unversionedPackageDisabled + */ + + /** + * Constructs a new ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @classdesc Represents an ExperimentalFeatures. + * @implements IExperimentalFeatures + * @constructor + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + */ + function ExperimentalFeatures(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]]; + } + + /** + * ExperimentalFeatures restAsyncIoEnabled. + * @member {boolean} restAsyncIoEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.restAsyncIoEnabled = false; + + /** + * ExperimentalFeatures protobufPythonicTypesEnabled. + * @member {boolean} protobufPythonicTypesEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.protobufPythonicTypesEnabled = false; + + /** + * ExperimentalFeatures unversionedPackageDisabled. + * @member {boolean} unversionedPackageDisabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.unversionedPackageDisabled = false; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures instance + */ + ExperimentalFeatures.create = function create(properties) { + return new ExperimentalFeatures(properties); + }; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.protobufPythonicTypesEnabled); + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unversionedPackageDisabled); + return writer; + }; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restAsyncIoEnabled = reader.bool(); + break; + } + case 2: { + message.protobufPythonicTypesEnabled = reader.bool(); + break; + } + case 3: { + message.unversionedPackageDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExperimentalFeatures message. + * @function verify + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExperimentalFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + if (typeof message.restAsyncIoEnabled !== "boolean") + return "restAsyncIoEnabled: boolean expected"; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + if (typeof message.protobufPythonicTypesEnabled !== "boolean") + return "protobufPythonicTypesEnabled: boolean expected"; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + if (typeof message.unversionedPackageDisabled !== "boolean") + return "unversionedPackageDisabled: boolean expected"; + return null; + }; + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + */ + ExperimentalFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) + return object; + var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + if (object.restAsyncIoEnabled != null) + message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); + if (object.protobufPythonicTypesEnabled != null) + message.protobufPythonicTypesEnabled = Boolean(object.protobufPythonicTypesEnabled); + if (object.unversionedPackageDisabled != null) + message.unversionedPackageDisabled = Boolean(object.unversionedPackageDisabled); + return message; + }; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.ExperimentalFeatures} message ExperimentalFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExperimentalFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.restAsyncIoEnabled = false; + object.protobufPythonicTypesEnabled = false; + object.unversionedPackageDisabled = false; + } + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + object.restAsyncIoEnabled = message.restAsyncIoEnabled; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + object.unversionedPackageDisabled = message.unversionedPackageDisabled; + return object; + }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @function toJSON + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + * @returns {Object.} JSON object + */ + ExperimentalFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExperimentalFeatures + * @function getTypeUrl + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExperimentalFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings.ExperimentalFeatures"; + }; + + return ExperimentalFeatures; + })(); + return PythonSettings; })(); @@ -43417,6 +43727,7 @@ * @memberof google.api * @interface IGoSettings * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common + * @property {Object.|null} [renamedServices] GoSettings renamedServices */ /** @@ -43428,6 +43739,7 @@ * @param {google.api.IGoSettings=} [properties] Properties to set */ function GoSettings(properties) { + this.renamedServices = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -43442,6 +43754,14 @@ */ GoSettings.prototype.common = null; + /** + * GoSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.renamedServices = $util.emptyObject; + /** * Creates a new GoSettings instance using the specified properties. * @function create @@ -43468,6 +43788,9 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); return writer; }; @@ -43498,7 +43821,7 @@ GoSettings.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) @@ -43508,6 +43831,29 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedServices[key] = value; + break; + } default: reader.skipType(tag & 7); break; @@ -43548,6 +43894,14 @@ if (error) return "common." + error; } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } return null; }; @@ -43568,6 +43922,13 @@ throw TypeError(".google.api.GoSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.GoSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } return message; }; @@ -43584,10 +43945,18 @@ if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) + object.renamedServices = {}; if (options.defaults) object.common = null; if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } return object; }; @@ -44226,30 +44595,275 @@ return values; })(); - /** - * LaunchStage enum. - * @name google.api.LaunchStage - * @enum {number} - * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value - * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value - * @property {number} PRELAUNCH=7 PRELAUNCH value - * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value - * @property {number} ALPHA=2 ALPHA value - * @property {number} BETA=3 BETA value - * @property {number} GA=4 GA value - * @property {number} DEPRECATED=5 DEPRECATED value - */ - api.LaunchStage = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; - values[valuesById[6] = "UNIMPLEMENTED"] = 6; - values[valuesById[7] = "PRELAUNCH"] = 7; - values[valuesById[1] = "EARLY_ACCESS"] = 1; - values[valuesById[2] = "ALPHA"] = 2; - values[valuesById[3] = "BETA"] = 3; - values[valuesById[4] = "GA"] = 4; - values[valuesById[5] = "DEPRECATED"] = 5; - return values; + api.SelectiveGapicGeneration = (function() { + + /** + * Properties of a SelectiveGapicGeneration. + * @memberof google.api + * @interface ISelectiveGapicGeneration + * @property {Array.|null} [methods] SelectiveGapicGeneration methods + * @property {boolean|null} [generateOmittedAsInternal] SelectiveGapicGeneration generateOmittedAsInternal + */ + + /** + * Constructs a new SelectiveGapicGeneration. + * @memberof google.api + * @classdesc Represents a SelectiveGapicGeneration. + * @implements ISelectiveGapicGeneration + * @constructor + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + */ + function SelectiveGapicGeneration(properties) { + this.methods = []; + 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]]; + } + + /** + * SelectiveGapicGeneration methods. + * @member {Array.} methods + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.methods = $util.emptyArray; + + /** + * SelectiveGapicGeneration generateOmittedAsInternal. + * @member {boolean} generateOmittedAsInternal + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.generateOmittedAsInternal = false; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @function create + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration instance + */ + SelectiveGapicGeneration.create = function create(properties) { + return new SelectiveGapicGeneration(properties); + }; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methods != null && message.methods.length) + for (var i = 0; i < message.methods.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.generateOmittedAsInternal); + return writer; + }; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @function decode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.methods && message.methods.length)) + message.methods = []; + message.methods.push(reader.string()); + break; + } + case 2: { + message.generateOmittedAsInternal = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectiveGapicGeneration message. + * @function verify + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectiveGapicGeneration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methods != null && message.hasOwnProperty("methods")) { + if (!Array.isArray(message.methods)) + return "methods: array expected"; + for (var i = 0; i < message.methods.length; ++i) + if (!$util.isString(message.methods[i])) + return "methods: string[] expected"; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + if (typeof message.generateOmittedAsInternal !== "boolean") + return "generateOmittedAsInternal: boolean expected"; + return null; + }; + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} object Plain object + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + */ + SelectiveGapicGeneration.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.SelectiveGapicGeneration) + return object; + var message = new $root.google.api.SelectiveGapicGeneration(); + if (object.methods) { + if (!Array.isArray(object.methods)) + throw TypeError(".google.api.SelectiveGapicGeneration.methods: array expected"); + message.methods = []; + for (var i = 0; i < object.methods.length; ++i) + message.methods[i] = String(object.methods[i]); + } + if (object.generateOmittedAsInternal != null) + message.generateOmittedAsInternal = Boolean(object.generateOmittedAsInternal); + return message; + }; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.SelectiveGapicGeneration} message SelectiveGapicGeneration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectiveGapicGeneration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.methods = []; + if (options.defaults) + object.generateOmittedAsInternal = false; + if (message.methods && message.methods.length) { + object.methods = []; + for (var j = 0; j < message.methods.length; ++j) + object.methods[j] = message.methods[j]; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + object.generateOmittedAsInternal = message.generateOmittedAsInternal; + return object; + }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @function toJSON + * @memberof google.api.SelectiveGapicGeneration + * @instance + * @returns {Object.} JSON object + */ + SelectiveGapicGeneration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @function getTypeUrl + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectiveGapicGeneration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.SelectiveGapicGeneration"; + }; + + return SelectiveGapicGeneration; + })(); + + /** + * LaunchStage enum. + * @name google.api.LaunchStage + * @enum {number} + * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value + * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value + * @property {number} PRELAUNCH=7 PRELAUNCH value + * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + */ + api.LaunchStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; + values[valuesById[6] = "UNIMPLEMENTED"] = 6; + values[valuesById[7] = "PRELAUNCH"] = 7; + values[valuesById[1] = "EARLY_ACCESS"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + return values; })(); /** @@ -44287,6 +44901,7 @@ * @memberof google.api * @interface IFieldInfo * @property {google.api.FieldInfo.Format|null} [format] FieldInfo format + * @property {Array.|null} [referencedTypes] FieldInfo referencedTypes */ /** @@ -44298,6 +44913,7 @@ * @param {google.api.IFieldInfo=} [properties] Properties to set */ function FieldInfo(properties) { + this.referencedTypes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -44312,6 +44928,14 @@ */ FieldInfo.prototype.format = 0; + /** + * FieldInfo referencedTypes. + * @member {Array.} referencedTypes + * @memberof google.api.FieldInfo + * @instance + */ + FieldInfo.prototype.referencedTypes = $util.emptyArray; + /** * Creates a new FieldInfo instance using the specified properties. * @function create @@ -44338,6 +44962,9 @@ writer = $Writer.create(); if (message.format != null && Object.hasOwnProperty.call(message, "format")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.format); + if (message.referencedTypes != null && message.referencedTypes.length) + for (var i = 0; i < message.referencedTypes.length; ++i) + $root.google.api.TypeReference.encode(message.referencedTypes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -44378,6 +45005,12 @@ message.format = reader.int32(); break; } + case 2: { + if (!(message.referencedTypes && message.referencedTypes.length)) + message.referencedTypes = []; + message.referencedTypes.push($root.google.api.TypeReference.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -44424,6 +45057,15 @@ case 4: break; } + if (message.referencedTypes != null && message.hasOwnProperty("referencedTypes")) { + if (!Array.isArray(message.referencedTypes)) + return "referencedTypes: array expected"; + for (var i = 0; i < message.referencedTypes.length; ++i) { + var error = $root.google.api.TypeReference.verify(message.referencedTypes[i]); + if (error) + return "referencedTypes." + error; + } + } return null; }; @@ -44467,6 +45109,16 @@ message.format = 4; break; } + if (object.referencedTypes) { + if (!Array.isArray(object.referencedTypes)) + throw TypeError(".google.api.FieldInfo.referencedTypes: array expected"); + message.referencedTypes = []; + for (var i = 0; i < object.referencedTypes.length; ++i) { + if (typeof object.referencedTypes[i] !== "object") + throw TypeError(".google.api.FieldInfo.referencedTypes: object expected"); + message.referencedTypes[i] = $root.google.api.TypeReference.fromObject(object.referencedTypes[i]); + } + } return message; }; @@ -44483,10 +45135,17 @@ if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.referencedTypes = []; if (options.defaults) object.format = options.enums === String ? "FORMAT_UNSPECIFIED" : 0; if (message.format != null && message.hasOwnProperty("format")) object.format = options.enums === String ? $root.google.api.FieldInfo.Format[message.format] === undefined ? message.format : $root.google.api.FieldInfo.Format[message.format] : message.format; + if (message.referencedTypes && message.referencedTypes.length) { + object.referencedTypes = []; + for (var j = 0; j < message.referencedTypes.length; ++j) + object.referencedTypes[j] = $root.google.api.TypeReference.toObject(message.referencedTypes[j], options); + } return object; }; @@ -44539,32 +45198,24 @@ return FieldInfo; })(); - api.ResourceDescriptor = (function() { + api.TypeReference = (function() { /** - * Properties of a ResourceDescriptor. + * Properties of a TypeReference. * @memberof google.api - * @interface IResourceDescriptor - * @property {string|null} [type] ResourceDescriptor type - * @property {Array.|null} [pattern] ResourceDescriptor pattern - * @property {string|null} [nameField] ResourceDescriptor nameField - * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history - * @property {string|null} [plural] ResourceDescriptor plural - * @property {string|null} [singular] ResourceDescriptor singular - * @property {Array.|null} [style] ResourceDescriptor style + * @interface ITypeReference + * @property {string|null} [typeName] TypeReference typeName */ /** - * Constructs a new ResourceDescriptor. + * Constructs a new TypeReference. * @memberof google.api - * @classdesc Represents a ResourceDescriptor. - * @implements IResourceDescriptor + * @classdesc Represents a TypeReference. + * @implements ITypeReference * @constructor - * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @param {google.api.ITypeReference=} [properties] Properties to set */ - function ResourceDescriptor(properties) { - this.pattern = []; - this.style = []; + function TypeReference(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -44572,50 +45223,263 @@ } /** - * ResourceDescriptor type. - * @member {string} type - * @memberof google.api.ResourceDescriptor + * TypeReference typeName. + * @member {string} typeName + * @memberof google.api.TypeReference * @instance */ - ResourceDescriptor.prototype.type = ""; + TypeReference.prototype.typeName = ""; /** - * ResourceDescriptor pattern. - * @member {Array.} pattern - * @memberof google.api.ResourceDescriptor - * @instance + * Creates a new TypeReference instance using the specified properties. + * @function create + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference=} [properties] Properties to set + * @returns {google.api.TypeReference} TypeReference instance */ - ResourceDescriptor.prototype.pattern = $util.emptyArray; + TypeReference.create = function create(properties) { + return new TypeReference(properties); + }; /** - * ResourceDescriptor nameField. - * @member {string} nameField - * @memberof google.api.ResourceDescriptor - * @instance + * Encodes the specified TypeReference message. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @function encode + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference} message TypeReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - ResourceDescriptor.prototype.nameField = ""; + TypeReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.typeName); + return writer; + }; /** - * ResourceDescriptor history. - * @member {google.api.ResourceDescriptor.History} history - * @memberof google.api.ResourceDescriptor - * @instance + * Encodes the specified TypeReference message, length delimited. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference} message TypeReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - ResourceDescriptor.prototype.history = 0; + TypeReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * ResourceDescriptor plural. - * @member {string} plural - * @memberof google.api.ResourceDescriptor - * @instance + * Decodes a TypeReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.TypeReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.TypeReference} TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceDescriptor.prototype.plural = ""; - - /** - * ResourceDescriptor singular. - * @member {string} singular - * @memberof google.api.ResourceDescriptor - * @instance + TypeReference.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.TypeReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.typeName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TypeReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.TypeReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.TypeReference} TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TypeReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TypeReference message. + * @function verify + * @memberof google.api.TypeReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TypeReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.typeName != null && message.hasOwnProperty("typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + return null; + }; + + /** + * Creates a TypeReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.TypeReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.TypeReference} TypeReference + */ + TypeReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.TypeReference) + return object; + var message = new $root.google.api.TypeReference(); + if (object.typeName != null) + message.typeName = String(object.typeName); + return message; + }; + + /** + * Creates a plain object from a TypeReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.TypeReference + * @static + * @param {google.api.TypeReference} message TypeReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TypeReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.typeName = ""; + if (message.typeName != null && message.hasOwnProperty("typeName")) + object.typeName = message.typeName; + return object; + }; + + /** + * Converts this TypeReference to JSON. + * @function toJSON + * @memberof google.api.TypeReference + * @instance + * @returns {Object.} JSON object + */ + TypeReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TypeReference + * @function getTypeUrl + * @memberof google.api.TypeReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TypeReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.TypeReference"; + }; + + return TypeReference; + })(); + + api.ResourceDescriptor = (function() { + + /** + * Properties of a ResourceDescriptor. + * @memberof google.api + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style + */ + + /** + * Constructs a new ResourceDescriptor. + * @memberof google.api + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor + * @constructor + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + */ + function ResourceDescriptor(properties) { + this.pattern = []; + this.style = []; + 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]]; + } + + /** + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.type = ""; + + /** + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.pattern = $util.emptyArray; + + /** + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.nameField = ""; + + /** + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.history = 0; + + /** + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.plural = ""; + + /** + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor + * @instance */ ResourceDescriptor.prototype.singular = ""; @@ -45470,6 +46334,7 @@ * @name google.protobuf.Edition * @enum {number} * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_LEGACY=900 EDITION_LEGACY value * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value * @property {number} EDITION_2023=1000 EDITION_2023 value @@ -45484,6 +46349,7 @@ protobuf.Edition = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[900] = "EDITION_LEGACY"] = 900; values[valuesById[998] = "EDITION_PROTO2"] = 998; values[valuesById[999] = "EDITION_PROTO3"] = 999; values[valuesById[1000] = "EDITION_2023"] = 1000; @@ -45508,6 +46374,7 @@ * @property {Array.|null} [dependency] FileDescriptorProto dependency * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [optionDependency] FileDescriptorProto optionDependency * @property {Array.|null} [messageType] FileDescriptorProto messageType * @property {Array.|null} [enumType] FileDescriptorProto enumType * @property {Array.|null} [service] FileDescriptorProto service @@ -45530,6 +46397,7 @@ this.dependency = []; this.publicDependency = []; this.weakDependency = []; + this.optionDependency = []; this.messageType = []; this.enumType = []; this.service = []; @@ -45580,6 +46448,14 @@ */ FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + /** + * FileDescriptorProto optionDependency. + * @member {Array.} optionDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.optionDependency = $util.emptyArray; + /** * FileDescriptorProto messageType. * @member {Array.} messageType @@ -45701,6 +46577,9 @@ writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + if (message.optionDependency != null && message.optionDependency.length) + for (var i = 0; i < message.optionDependency.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.optionDependency[i]); return writer; }; @@ -45773,6 +46652,12 @@ message.weakDependency.push(reader.int32()); break; } + case 15: { + if (!(message.optionDependency && message.optionDependency.length)) + message.optionDependency = []; + message.optionDependency.push(reader.string()); + break; + } case 4: { if (!(message.messageType && message.messageType.length)) message.messageType = []; @@ -45875,6 +46760,13 @@ if (!$util.isInteger(message.weakDependency[i])) return "weakDependency: integer[] expected"; } + if (message.optionDependency != null && message.hasOwnProperty("optionDependency")) { + if (!Array.isArray(message.optionDependency)) + return "optionDependency: array expected"; + for (var i = 0; i < message.optionDependency.length; ++i) + if (!$util.isString(message.optionDependency[i])) + return "optionDependency: string[] expected"; + } if (message.messageType != null && message.hasOwnProperty("messageType")) { if (!Array.isArray(message.messageType)) return "messageType: array expected"; @@ -45929,6 +46821,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -45981,6 +46874,13 @@ for (var i = 0; i < object.weakDependency.length; ++i) message.weakDependency[i] = object.weakDependency[i] | 0; } + if (object.optionDependency) { + if (!Array.isArray(object.optionDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.optionDependency: array expected"); + message.optionDependency = []; + for (var i = 0; i < object.optionDependency.length; ++i) + message.optionDependency[i] = String(object.optionDependency[i]); + } if (object.messageType) { if (!Array.isArray(object.messageType)) throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); @@ -46044,6 +46944,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -46109,6 +47013,7 @@ object.extension = []; object.publicDependency = []; object.weakDependency = []; + object.optionDependency = []; } if (options.defaults) { object.name = ""; @@ -46165,6 +47070,11 @@ object.syntax = message.syntax; if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.optionDependency && message.optionDependency.length) { + object.optionDependency = []; + for (var j = 0; j < message.optionDependency.length; ++j) + object.optionDependency[j] = message.optionDependency[j]; + } return object; }; @@ -46213,6 +47123,7 @@ * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options * @property {Array.|null} [reservedRange] DescriptorProto reservedRange * @property {Array.|null} [reservedName] DescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] DescriptorProto visibility */ /** @@ -46318,6 +47229,14 @@ */ DescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * DescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.visibility = 0; + /** * Creates a new DescriptorProto instance using the specified properties. * @function create @@ -46370,6 +47289,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.visibility); return writer; }; @@ -46462,6 +47383,10 @@ message.reservedName.push(reader.string()); break; } + case 11: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -46575,6 +47500,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -46674,6 +47608,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -46703,6 +47657,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -46748,6 +47703,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -48792,6 +49749,7 @@ * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] EnumDescriptorProto visibility */ /** @@ -48852,6 +49810,14 @@ */ EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * EnumDescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.visibility = 0; + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @function create @@ -48889,6 +49855,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.visibility); return writer; }; @@ -48951,6 +49919,10 @@ message.reservedName.push(reader.string()); break; } + case 6: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -49019,6 +49991,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -49068,6 +50049,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -49092,6 +50093,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -49112,6 +50114,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -51430,6 +52434,7 @@ * @property {Array.|null} [targets] FieldOptions targets * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] FieldOptions featureSupport * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior * @property {google.api.IFieldInfo|null} [".google.api.fieldInfo"] FieldOptions .google.api.fieldInfo @@ -51551,6 +52556,14 @@ */ FieldOptions.prototype.features = null; + /** + * FieldOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.featureSupport = null; + /** * FieldOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -51633,6 +52646,8 @@ $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); if (message.features != null && Object.hasOwnProperty.call(message, "features")) $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -51736,6 +52751,10 @@ message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } + case 22: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -51875,6 +52894,11 @@ if (error) return "features." + error; } + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -52068,6 +53092,11 @@ throw TypeError(".google.protobuf.FieldOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); } + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); @@ -52170,6 +53199,7 @@ object.debugRedact = false; object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; object.features = null; + object.featureSupport = null; object[".google.api.resourceReference"] = null; object[".google.api.fieldInfo"] = null; } @@ -52203,6 +53233,8 @@ } if (message.features != null && message.hasOwnProperty("features")) object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -52477,6 +53509,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -52518,103 +53551,589 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; break; case "EDITION_PROTO3": case 999: - message.edition = 999; + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EditionDefault.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + return object; + }; + + /** + * Converts this EditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + * @returns {Object.} JSON object + */ + EditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + }; + + return EditionDefault; + })(); + + FieldOptions.FeatureSupport = (function() { + + /** + * Properties of a FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @interface IFeatureSupport + * @property {google.protobuf.Edition|null} [editionIntroduced] FeatureSupport editionIntroduced + * @property {google.protobuf.Edition|null} [editionDeprecated] FeatureSupport editionDeprecated + * @property {string|null} [deprecationWarning] FeatureSupport deprecationWarning + * @property {google.protobuf.Edition|null} [editionRemoved] FeatureSupport editionRemoved + */ + + /** + * Constructs a new FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents a FeatureSupport. + * @implements IFeatureSupport + * @constructor + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + */ + function FeatureSupport(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]]; + } + + /** + * FeatureSupport editionIntroduced. + * @member {google.protobuf.Edition} editionIntroduced + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionIntroduced = 0; + + /** + * FeatureSupport editionDeprecated. + * @member {google.protobuf.Edition} editionDeprecated + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionDeprecated = 0; + + /** + * FeatureSupport deprecationWarning. + * @member {string} deprecationWarning + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.deprecationWarning = ""; + + /** + * FeatureSupport editionRemoved. + * @member {google.protobuf.Edition} editionRemoved + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionRemoved = 0; + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport instance + */ + FeatureSupport.create = function create(properties) { + return new FeatureSupport(properties); + }; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editionDeprecated); + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.deprecationWarning); + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.editionRemoved); + return writer; + }; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.editionIntroduced = reader.int32(); + break; + } + case 2: { + message.editionDeprecated = reader.int32(); + break; + } + case 3: { + message.deprecationWarning = reader.string(); + break; + } + case 4: { + message.editionRemoved = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSupport message. + * @function verify + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSupport.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + switch (message.editionIntroduced) { + default: + return "editionIntroduced: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + switch (message.editionDeprecated) { + default: + return "editionDeprecated: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + if (!$util.isString(message.deprecationWarning)) + return "deprecationWarning: string expected"; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + switch (message.editionRemoved) { + default: + return "editionRemoved: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + */ + FeatureSupport.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) + return object; + var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + switch (object.editionIntroduced) { + default: + if (typeof object.editionIntroduced === "number") { + message.editionIntroduced = object.editionIntroduced; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionIntroduced = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionIntroduced = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionIntroduced = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionIntroduced = 999; + break; + case "EDITION_2023": + case 1000: + message.editionIntroduced = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionIntroduced = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionIntroduced = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionIntroduced = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionIntroduced = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionIntroduced = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionIntroduced = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionIntroduced = 2147483647; + break; + } + switch (object.editionDeprecated) { + default: + if (typeof object.editionDeprecated === "number") { + message.editionDeprecated = object.editionDeprecated; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionDeprecated = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionDeprecated = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionDeprecated = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionDeprecated = 999; + break; + case "EDITION_2023": + case 1000: + message.editionDeprecated = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionDeprecated = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionDeprecated = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionDeprecated = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionDeprecated = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionDeprecated = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionDeprecated = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionDeprecated = 2147483647; + break; + } + if (object.deprecationWarning != null) + message.deprecationWarning = String(object.deprecationWarning); + switch (object.editionRemoved) { + default: + if (typeof object.editionRemoved === "number") { + message.editionRemoved = object.editionRemoved; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionRemoved = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionRemoved = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionRemoved = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionRemoved = 999; break; case "EDITION_2023": case 1000: - message.edition = 1000; + message.editionRemoved = 1000; break; case "EDITION_2024": case 1001: - message.edition = 1001; + message.editionRemoved = 1001; break; case "EDITION_1_TEST_ONLY": case 1: - message.edition = 1; + message.editionRemoved = 1; break; case "EDITION_2_TEST_ONLY": case 2: - message.edition = 2; + message.editionRemoved = 2; break; case "EDITION_99997_TEST_ONLY": case 99997: - message.edition = 99997; + message.editionRemoved = 99997; break; case "EDITION_99998_TEST_ONLY": case 99998: - message.edition = 99998; + message.editionRemoved = 99998; break; case "EDITION_99999_TEST_ONLY": case 99999: - message.edition = 99999; + message.editionRemoved = 99999; break; case "EDITION_MAX": case 2147483647: - message.edition = 2147483647; + message.editionRemoved = 2147483647; break; } - if (object.value != null) - message.value = String(object.value); return message; }; /** - * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {google.protobuf.FieldOptions.FeatureSupport} message FeatureSupport * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EditionDefault.toObject = function toObject(message, options) { + FeatureSupport.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.value = ""; - object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; - } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionDeprecated = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.deprecationWarning = ""; + object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + object.deprecationWarning = message.deprecationWarning; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; return object; }; /** - * Converts this EditionDefault to JSON. + * Converts this FeatureSupport to JSON. * @function toJSON - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @instance * @returns {Object.} JSON object */ - EditionDefault.prototype.toJSON = function toJSON() { + FeatureSupport.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for EditionDefault + * Gets the default type url for FeatureSupport * @function getTypeUrl - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FeatureSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + return typeUrlPrefix + "/google.protobuf.FieldOptions.FeatureSupport"; }; - return EditionDefault; + return FeatureSupport; })(); return FieldOptions; @@ -53209,6 +54728,7 @@ * @property {boolean|null} [deprecated] EnumValueOptions deprecated * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] EnumValueOptions featureSupport * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption */ @@ -53252,6 +54772,14 @@ */ EnumValueOptions.prototype.debugRedact = false; + /** + * EnumValueOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.featureSupport = null; + /** * EnumValueOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -53290,6 +54818,8 @@ $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -53341,6 +54871,10 @@ message.debugRedact = reader.bool(); break; } + case 4: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -53393,6 +54927,11 @@ if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) if (typeof message.debugRedact !== "boolean") return "debugRedact: boolean expected"; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -53426,6 +54965,11 @@ } if (object.debugRedact != null) message.debugRedact = Boolean(object.debugRedact); + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); @@ -53458,6 +55002,7 @@ object.deprecated = false; object.features = null; object.debugRedact = false; + object.featureSupport = null; } if (message.deprecated != null && message.hasOwnProperty("deprecated")) object.deprecated = message.deprecated; @@ -53465,6 +55010,8 @@ object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) object.debugRedact = message.debugRedact; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -54932,6 +56479,8 @@ * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + * @property {google.protobuf.FeatureSet.EnforceNamingStyle|null} [enforceNamingStyle] FeatureSet enforceNamingStyle + * @property {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null} [defaultSymbolVisibility] FeatureSet defaultSymbolVisibility */ /** @@ -54997,6 +56546,22 @@ */ FeatureSet.prototype.jsonFormat = 0; + /** + * FeatureSet enforceNamingStyle. + * @member {google.protobuf.FeatureSet.EnforceNamingStyle} enforceNamingStyle + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enforceNamingStyle = 0; + + /** + * FeatureSet defaultSymbolVisibility. + * @member {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility} defaultSymbolVisibility + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.defaultSymbolVisibility = 0; + /** * Creates a new FeatureSet instance using the specified properties. * @function create @@ -55033,6 +56598,10 @@ writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enforceNamingStyle); + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.defaultSymbolVisibility); return writer; }; @@ -55093,6 +56662,14 @@ message.jsonFormat = reader.int32(); break; } + case 7: { + message.enforceNamingStyle = reader.int32(); + break; + } + case 8: { + message.defaultSymbolVisibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -55183,6 +56760,26 @@ case 2: break; } + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + switch (message.enforceNamingStyle) { + default: + return "enforceNamingStyle: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + switch (message.defaultSymbolVisibility) { + default: + return "defaultSymbolVisibility: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } return null; }; @@ -55322,6 +56919,54 @@ message.jsonFormat = 2; break; } + switch (object.enforceNamingStyle) { + default: + if (typeof object.enforceNamingStyle === "number") { + message.enforceNamingStyle = object.enforceNamingStyle; + break; + } + break; + case "ENFORCE_NAMING_STYLE_UNKNOWN": + case 0: + message.enforceNamingStyle = 0; + break; + case "STYLE2024": + case 1: + message.enforceNamingStyle = 1; + break; + case "STYLE_LEGACY": + case 2: + message.enforceNamingStyle = 2; + break; + } + switch (object.defaultSymbolVisibility) { + default: + if (typeof object.defaultSymbolVisibility === "number") { + message.defaultSymbolVisibility = object.defaultSymbolVisibility; + break; + } + break; + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + case 0: + message.defaultSymbolVisibility = 0; + break; + case "EXPORT_ALL": + case 1: + message.defaultSymbolVisibility = 1; + break; + case "EXPORT_TOP_LEVEL": + case 2: + message.defaultSymbolVisibility = 2; + break; + case "LOCAL_ALL": + case 3: + message.defaultSymbolVisibility = 3; + break; + case "STRICT": + case 4: + message.defaultSymbolVisibility = 4; + break; + } return message; }; @@ -55345,6 +56990,8 @@ object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; + object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; } if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; @@ -55358,6 +57005,10 @@ object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; return object; }; @@ -55485,6 +57136,219 @@ return values; })(); + /** + * EnforceNamingStyle enum. + * @name google.protobuf.FeatureSet.EnforceNamingStyle + * @enum {number} + * @property {number} ENFORCE_NAMING_STYLE_UNKNOWN=0 ENFORCE_NAMING_STYLE_UNKNOWN value + * @property {number} STYLE2024=1 STYLE2024 value + * @property {number} STYLE_LEGACY=2 STYLE_LEGACY value + */ + FeatureSet.EnforceNamingStyle = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENFORCE_NAMING_STYLE_UNKNOWN"] = 0; + values[valuesById[1] = "STYLE2024"] = 1; + values[valuesById[2] = "STYLE_LEGACY"] = 2; + return values; + })(); + + FeatureSet.VisibilityFeature = (function() { + + /** + * Properties of a VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @interface IVisibilityFeature + */ + + /** + * Constructs a new VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @classdesc Represents a VisibilityFeature. + * @implements IVisibilityFeature + * @constructor + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + */ + function VisibilityFeature(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]]; + } + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature instance + */ + VisibilityFeature.create = function create(properties) { + return new VisibilityFeature(properties); + }; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisibilityFeature message. + * @function verify + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisibilityFeature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + */ + VisibilityFeature.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) + return object; + return new $root.google.protobuf.FeatureSet.VisibilityFeature(); + }; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.VisibilityFeature} message VisibilityFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisibilityFeature.toObject = function toObject() { + return {}; + }; + + /** + * Converts this VisibilityFeature to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @instance + * @returns {Object.} JSON object + */ + VisibilityFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VisibilityFeature + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisibilityFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet.VisibilityFeature"; + }; + + /** + * DefaultSymbolVisibility enum. + * @name google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + * @enum {number} + * @property {number} DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN value + * @property {number} EXPORT_ALL=1 EXPORT_ALL value + * @property {number} EXPORT_TOP_LEVEL=2 EXPORT_TOP_LEVEL value + * @property {number} LOCAL_ALL=3 LOCAL_ALL value + * @property {number} STRICT=4 STRICT value + */ + VisibilityFeature.DefaultSymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0; + values[valuesById[1] = "EXPORT_ALL"] = 1; + values[valuesById[2] = "EXPORT_TOP_LEVEL"] = 2; + values[valuesById[3] = "LOCAL_ALL"] = 3; + values[valuesById[4] = "STRICT"] = 4; + return values; + })(); + + return VisibilityFeature; + })(); + return FeatureSet; })(); @@ -55669,6 +57533,7 @@ default: return "minimumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -55686,6 +57551,7 @@ default: return "maximumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -55734,6 +57600,10 @@ case 0: message.minimumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.minimumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.minimumEdition = 998; @@ -55786,6 +57656,10 @@ case 0: message.maximumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.maximumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.maximumEdition = 998; @@ -55894,7 +57768,8 @@ * @memberof google.protobuf.FeatureSetDefaults * @interface IFeatureSetEditionDefault * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition - * @property {google.protobuf.IFeatureSet|null} [features] FeatureSetEditionDefault features + * @property {google.protobuf.IFeatureSet|null} [overridableFeatures] FeatureSetEditionDefault overridableFeatures + * @property {google.protobuf.IFeatureSet|null} [fixedFeatures] FeatureSetEditionDefault fixedFeatures */ /** @@ -55921,12 +57796,20 @@ FeatureSetEditionDefault.prototype.edition = 0; /** - * FeatureSetEditionDefault features. - * @member {google.protobuf.IFeatureSet|null|undefined} features + * FeatureSetEditionDefault overridableFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} overridableFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.overridableFeatures = null; + + /** + * FeatureSetEditionDefault fixedFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} fixedFeatures * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @instance */ - FeatureSetEditionDefault.prototype.features = null; + FeatureSetEditionDefault.prototype.fixedFeatures = null; /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -55952,10 +57835,12 @@ FeatureSetEditionDefault.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -55996,8 +57881,12 @@ message.edition = reader.int32(); break; } - case 2: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + case 4: { + message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 5: { + message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } default: @@ -56040,6 +57929,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -56052,10 +57942,15 @@ case 2147483647: break; } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures); + if (error) + return "overridableFeatures." + error; + } + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures); if (error) - return "features." + error; + return "fixedFeatures." + error; } return null; }; @@ -56083,6 +57978,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -56124,10 +58023,15 @@ message.edition = 2147483647; break; } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + if (object.overridableFeatures != null) { + if (typeof object.overridableFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); + message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures); + } + if (object.fixedFeatures != null) { + if (typeof object.fixedFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); + message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures); } return message; }; @@ -56146,13 +58050,16 @@ options = {}; var object = {}; if (options.defaults) { - object.features = null; object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.overridableFeatures = null; + object.fixedFeatures = null; } - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) + object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options); + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) + object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options); return object; }; @@ -57367,6 +59274,22 @@ return GeneratedCodeInfo; })(); + /** + * SymbolVisibility enum. + * @name google.protobuf.SymbolVisibility + * @enum {number} + * @property {number} VISIBILITY_UNSET=0 VISIBILITY_UNSET value + * @property {number} VISIBILITY_LOCAL=1 VISIBILITY_LOCAL value + * @property {number} VISIBILITY_EXPORT=2 VISIBILITY_EXPORT value + */ + protobuf.SymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VISIBILITY_UNSET"] = 0; + values[valuesById[1] = "VISIBILITY_LOCAL"] = 1; + values[valuesById[2] = "VISIBILITY_EXPORT"] = 2; + return values; + })(); + protobuf.Duration = (function() { /** diff --git a/packages/google-cloud-vmwareengine/protos/protos.json b/packages/google-cloud-vmwareengine/protos/protos.json index ce29016a9bb7..0ff81d5cdcd8 100644 --- a/packages/google-cloud-vmwareengine/protos/protos.json +++ b/packages/google-cloud-vmwareengine/protos/protos.json @@ -5627,8 +5627,7 @@ "java_multiple_files": true, "java_outer_classname": "ResourceProto", "java_package": "com.google.api", - "objc_class_prefix": "GAPI", - "cc_enable_arenas": true + "objc_class_prefix": "GAPI" }, "nested": { "http": { @@ -5752,6 +5751,10 @@ "rule": "repeated", "type": "ClientLibraryDestination", "id": 2 + }, + "selectiveGapicGeneration": { + "type": "SelectiveGapicGeneration", + "id": 3 } } }, @@ -5892,6 +5895,28 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "experimentalFeatures": { + "type": "ExperimentalFeatures", + "id": 2 + } + }, + "nested": { + "ExperimentalFeatures": { + "fields": { + "restAsyncIoEnabled": { + "type": "bool", + "id": 1 + }, + "protobufPythonicTypesEnabled": { + "type": "bool", + "id": 2 + }, + "unversionedPackageDisabled": { + "type": "bool", + "id": 3 + } + } } } }, @@ -5949,6 +5974,11 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 } } }, @@ -6010,6 +6040,19 @@ "PACKAGE_MANAGER": 20 } }, + "SelectiveGapicGeneration": { + "fields": { + "methods": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "generateOmittedAsInternal": { + "type": "bool", + "id": 2 + } + } + }, "LaunchStage": { "values": { "LAUNCH_STAGE_UNSPECIFIED": 0, @@ -6054,6 +6097,11 @@ "format": { "type": "Format", "id": 1 + }, + "referencedTypes": { + "rule": "repeated", + "type": "TypeReference", + "id": 2 } }, "nested": { @@ -6068,6 +6116,14 @@ } } }, + "TypeReference": { + "fields": { + "typeName": { + "type": "string", + "id": 1 + } + } + }, "resourceReference": { "type": "google.api.ResourceReference", "id": 1055, @@ -6166,12 +6222,19 @@ "type": "FileDescriptorProto", "id": 1 } - } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ] }, "Edition": { "edition": "proto2", "values": { "EDITION_UNKNOWN": 0, + "EDITION_LEGACY": 900, "EDITION_PROTO2": 998, "EDITION_PROTO3": 999, "EDITION_2023": 1000, @@ -6210,6 +6273,11 @@ "type": "int32", "id": 11 }, + "optionDependency": { + "rule": "repeated", + "type": "string", + "id": 15 + }, "messageType": { "rule": "repeated", "type": "DescriptorProto", @@ -6298,6 +6366,10 @@ "rule": "repeated", "type": "string", "id": 10 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 11 } }, "nested": { @@ -6523,6 +6595,10 @@ "rule": "repeated", "type": "string", "id": 5 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 6 } }, "nested": { @@ -6573,7 +6649,14 @@ "type": "ServiceOptions", "id": 3 } - } + }, + "reserved": [ + [ + 4, + 4 + ], + "stream" + ] }, "MethodDescriptorProto": { "edition": "proto2", @@ -6737,6 +6820,7 @@ 42, 42 ], + "php_generic_services", [ 38, 38 @@ -6872,7 +6956,8 @@ "type": "bool", "id": 10, "options": { - "default": false + "default": false, + "deprecated": true } }, "debugRedact": { @@ -6900,6 +6985,10 @@ "type": "FeatureSet", "id": 21 }, + "featureSupport": { + "type": "FeatureSupport", + "id": 22 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -6969,6 +7058,26 @@ "id": 2 } } + }, + "FeatureSupport": { + "fields": { + "editionIntroduced": { + "type": "Edition", + "id": 1 + }, + "editionDeprecated": { + "type": "Edition", + "id": 2 + }, + "deprecationWarning": { + "type": "string", + "id": 3 + }, + "editionRemoved": { + "type": "Edition", + "id": 4 + } + } } } }, @@ -7057,6 +7166,10 @@ "default": false } }, + "featureSupport": { + "type": "FieldOptions.FeatureSupport", + "id": 4 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -7199,6 +7312,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_2023", "edition_defaults.value": "EXPLICIT" } @@ -7209,6 +7323,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "OPEN" } @@ -7219,6 +7334,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "PACKED" } @@ -7229,6 +7345,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "VERIFY" } @@ -7239,7 +7356,8 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "EDITION_PROTO2", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_LEGACY", "edition_defaults.value": "LENGTH_PREFIXED" } }, @@ -7249,27 +7367,38 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "ALLOW" } + }, + "enforceNamingStyle": { + "type": "EnforceNamingStyle", + "id": 7, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_METHOD", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "STYLE2024" + } + }, + "defaultSymbolVisibility": { + "type": "VisibilityFeature.DefaultSymbolVisibility", + "id": 8, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "EXPORT_TOP_LEVEL" + } } }, "extensions": [ [ 1000, - 1000 - ], - [ - 1001, - 1001 - ], - [ - 1002, - 1002 - ], - [ - 9990, - 9990 + 9994 ], [ 9995, @@ -7314,7 +7443,13 @@ "UTF8_VALIDATION_UNKNOWN": 0, "VERIFY": 2, "NONE": 3 - } + }, + "reserved": [ + [ + 1, + 1 + ] + ] }, "MessageEncoding": { "values": { @@ -7329,6 +7464,33 @@ "ALLOW": 1, "LEGACY_BEST_EFFORT": 2 } + }, + "EnforceNamingStyle": { + "values": { + "ENFORCE_NAMING_STYLE_UNKNOWN": 0, + "STYLE2024": 1, + "STYLE_LEGACY": 2 + } + }, + "VisibilityFeature": { + "fields": {}, + "reserved": [ + [ + 1, + 536870911 + ] + ], + "nested": { + "DefaultSymbolVisibility": { + "values": { + "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, + "EXPORT_ALL": 1, + "EXPORT_TOP_LEVEL": 2, + "LOCAL_ALL": 3, + "STRICT": 4 + } + } + } } } }, @@ -7356,11 +7518,26 @@ "type": "Edition", "id": 3 }, - "features": { + "overridableFeatures": { "type": "FeatureSet", - "id": 2 + "id": 4 + }, + "fixedFeatures": { + "type": "FeatureSet", + "id": 5 } - } + }, + "reserved": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + "features" + ] } } }, @@ -7373,6 +7550,12 @@ "id": 1 } }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ], "nested": { "Location": { "fields": { @@ -7458,6 +7641,14 @@ } } }, + "SymbolVisibility": { + "edition": "proto2", + "values": { + "VISIBILITY_UNSET": 0, + "VISIBILITY_LOCAL": 1, + "VISIBILITY_EXPORT": 2 + } + }, "Duration": { "fields": { "seconds": { @@ -7516,6 +7707,7 @@ "java_multiple_files": true, "java_outer_classname": "OperationsProto", "java_package": "com.google.longrunning", + "objc_class_prefix": "GLRUN", "php_namespace": "Google\\LongRunning" }, "nested": { diff --git a/packages/google-cloud-vmwareengine/samples/generated/v1/snippet_metadata_google.cloud.vmwareengine.v1.json b/packages/google-cloud-vmwareengine/samples/generated/v1/snippet_metadata_google.cloud.vmwareengine.v1.json index e55ca886cf09..fdc14cfc4b7b 100644 --- a/packages/google-cloud-vmwareengine/samples/generated/v1/snippet_metadata_google.cloud.vmwareengine.v1.json +++ b/packages/google-cloud-vmwareengine/samples/generated/v1/snippet_metadata_google.cloud.vmwareengine.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-vmwareengine", - "version": "2.2.1", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-vmwareengine/src/v1/index.ts b/packages/google-cloud-vmwareengine/src/v1/index.ts index 13b1cec767c6..f29631338b98 100644 --- a/packages/google-cloud-vmwareengine/src/v1/index.ts +++ b/packages/google-cloud-vmwareengine/src/v1/index.ts @@ -16,4 +16,4 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {VmwareEngineClient} from './vmware_engine_client'; +export { VmwareEngineClient } from './vmware_engine_client'; diff --git a/packages/google-cloud-vmwareengine/src/v1/vmware_engine_client.ts b/packages/google-cloud-vmwareengine/src/v1/vmware_engine_client.ts index 27794465e418..61a843cc2ab9 100644 --- a/packages/google-cloud-vmwareengine/src/v1/vmware_engine_client.ts +++ b/packages/google-cloud-vmwareengine/src/v1/vmware_engine_client.ts @@ -18,11 +18,24 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + IamClient, + IamProtos, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +57,7 @@ export class VmwareEngineClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('vmwareengine'); @@ -57,12 +70,12 @@ export class VmwareEngineClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; iamClient: IamClient; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - vmwareEngineStub?: Promise<{[name: string]: Function}>; + vmwareEngineStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of VmwareEngineClient. @@ -103,21 +116,42 @@ export class VmwareEngineClient { * const client = new VmwareEngineClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof VmwareEngineClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'vmwareengine.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -142,7 +176,7 @@ export class VmwareEngineClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,18 +189,14 @@ export class VmwareEngineClient { this.auth.defaultScopes = staticMembers.scopes; } this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - + this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -188,58 +218,58 @@ export class VmwareEngineClient { // Create useful helper objects for these. this.pathTemplates = { clusterPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}' + 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}', ), dnsBindPermissionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/dnsBindPermission' + 'projects/{project}/locations/{location}/dnsBindPermission', ), dnsForwardingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/dnsForwarding' + 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/dnsForwarding', ), externalAccessRulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/networkPolicies/{network_policy}/externalAccessRules/{external_access_rule}' + 'projects/{project}/locations/{location}/networkPolicies/{network_policy}/externalAccessRules/{external_access_rule}', ), externalAddressPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/externalAddresses/{external_address}' + 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/externalAddresses/{external_address}', ), hcxActivationKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/hcxActivationKeys/{hcx_activation_key}' + 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/hcxActivationKeys/{hcx_activation_key}', ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), loggingServerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/loggingServers/{logging_server}' + 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/loggingServers/{logging_server}', ), managementDnsZoneBindingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/managementDnsZoneBindings/{management_dns_zone_binding}' + 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/managementDnsZoneBindings/{management_dns_zone_binding}', ), networkPeeringPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/networkPeerings/{network_peering}' + 'projects/{project}/locations/{location}/networkPeerings/{network_peering}', ), networkPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/networkPolicies/{network_policy}' + 'projects/{project}/locations/{location}/networkPolicies/{network_policy}', ), nodePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node}' + 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node}', ), nodeTypePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/nodeTypes/{node_type}' + 'projects/{project}/locations/{location}/nodeTypes/{node_type}', ), privateCloudPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}' + 'projects/{project}/locations/{location}/privateClouds/{private_cloud}', ), privateConnectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateConnections/{private_connection}' + 'projects/{project}/locations/{location}/privateConnections/{private_connection}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), subnetPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/subnets/{subnet}' + 'projects/{project}/locations/{location}/privateClouds/{private_cloud}/subnets/{subnet}', ), vmwareEngineNetworkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network}' + 'projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network}', ), }; @@ -247,40 +277,91 @@ export class VmwareEngineClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listPrivateClouds: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'privateClouds'), - listClusters: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'clusters'), - listNodes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'nodes'), - listExternalAddresses: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'externalAddresses'), - fetchNetworkPolicyExternalAddresses: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'externalAddresses'), - listSubnets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'subnets'), - listExternalAccessRules: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'externalAccessRules'), - listLoggingServers: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'loggingServers'), - listNodeTypes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'nodeTypes'), - listNetworkPeerings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'networkPeerings'), - listPeeringRoutes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'peeringRoutes'), - listHcxActivationKeys: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'hcxActivationKeys'), - listNetworkPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'networkPolicies'), - listManagementDnsZoneBindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'managementDnsZoneBindings'), - listVmwareEngineNetworks: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'vmwareEngineNetworks'), - listPrivateConnections: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'privateConnections'), - listPrivateConnectionPeeringRoutes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'peeringRoutes') + listPrivateClouds: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'privateClouds', + ), + listClusters: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'clusters', + ), + listNodes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'nodes', + ), + listExternalAddresses: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'externalAddresses', + ), + fetchNetworkPolicyExternalAddresses: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'externalAddresses', + ), + listSubnets: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'subnets', + ), + listExternalAccessRules: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'externalAccessRules', + ), + listLoggingServers: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'loggingServers', + ), + listNodeTypes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'nodeTypes', + ), + listNetworkPeerings: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'networkPeerings', + ), + listPeeringRoutes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'peeringRoutes', + ), + listHcxActivationKeys: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'hcxActivationKeys', + ), + listNetworkPolicies: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'networkPolicies', + ), + listManagementDnsZoneBindings: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'managementDnsZoneBindings', + ), + listVmwareEngineNetworks: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'vmwareEngineNetworks', + ), + listPrivateConnections: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'privateConnections', + ), + listPrivateConnectionPeeringRoutes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'peeringRoutes', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -289,336 +370,598 @@ export class VmwareEngineClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/*/privateClouds/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/*/privateClouds/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/*/privateClouds/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + }, + { + selector: 'google.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1/{resource=projects/*/locations/*/privateClouds/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1/{resource=projects/*/locations/*/privateClouds/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1/{resource=projects/*/locations/*/privateClouds/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/privateClouds/*/clusters/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/*/privateClouds/*/hcxActivationKeys/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createPrivateCloudResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.PrivateCloud', + ) as gax.protobuf.Type; const createPrivateCloudMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const updatePrivateCloudResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.PrivateCloud', + ) as gax.protobuf.Type; const updatePrivateCloudMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const deletePrivateCloudResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.PrivateCloud', + ) as gax.protobuf.Type; const deletePrivateCloudMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const undeletePrivateCloudResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.PrivateCloud', + ) as gax.protobuf.Type; const undeletePrivateCloudMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const createClusterResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.Cluster') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.Cluster', + ) as gax.protobuf.Type; const createClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateClusterResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.Cluster') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.Cluster', + ) as gax.protobuf.Type; const updateClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteClusterResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteClusterMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const createExternalAddressResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.ExternalAddress') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.ExternalAddress', + ) as gax.protobuf.Type; const createExternalAddressMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateExternalAddressResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.ExternalAddress') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.ExternalAddress', + ) as gax.protobuf.Type; const updateExternalAddressMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteExternalAddressResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteExternalAddressMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateSubnetResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.Subnet') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.Subnet', + ) as gax.protobuf.Type; const updateSubnetMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const createExternalAccessRuleResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.ExternalAccessRule') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.ExternalAccessRule', + ) as gax.protobuf.Type; const createExternalAccessRuleMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateExternalAccessRuleResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.ExternalAccessRule') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.ExternalAccessRule', + ) as gax.protobuf.Type; const updateExternalAccessRuleMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteExternalAccessRuleResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteExternalAccessRuleMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const createLoggingServerResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.LoggingServer') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.LoggingServer', + ) as gax.protobuf.Type; const createLoggingServerMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateLoggingServerResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.LoggingServer') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.LoggingServer', + ) as gax.protobuf.Type; const updateLoggingServerMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteLoggingServerResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteLoggingServerMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const resetNsxCredentialsResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.PrivateCloud', + ) as gax.protobuf.Type; const resetNsxCredentialsMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const resetVcenterCredentialsResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateCloud') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.PrivateCloud', + ) as gax.protobuf.Type; const resetVcenterCredentialsMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateDnsForwardingResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.DnsForwarding') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.DnsForwarding', + ) as gax.protobuf.Type; const updateDnsForwardingMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const createNetworkPeeringResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.NetworkPeering') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.NetworkPeering', + ) as gax.protobuf.Type; const createNetworkPeeringMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteNetworkPeeringResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteNetworkPeeringMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateNetworkPeeringResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.NetworkPeering') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.NetworkPeering', + ) as gax.protobuf.Type; const updateNetworkPeeringMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const createHcxActivationKeyResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.HcxActivationKey') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.HcxActivationKey', + ) as gax.protobuf.Type; const createHcxActivationKeyMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const createNetworkPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.NetworkPolicy') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.NetworkPolicy', + ) as gax.protobuf.Type; const createNetworkPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateNetworkPolicyResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.NetworkPolicy') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.NetworkPolicy', + ) as gax.protobuf.Type; const updateNetworkPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteNetworkPolicyResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteNetworkPolicyMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const createManagementDnsZoneBindingResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding', + ) as gax.protobuf.Type; const createManagementDnsZoneBindingMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateManagementDnsZoneBindingResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding', + ) as gax.protobuf.Type; const updateManagementDnsZoneBindingMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteManagementDnsZoneBindingResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteManagementDnsZoneBindingMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const repairManagementDnsZoneBindingResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding', + ) as gax.protobuf.Type; const repairManagementDnsZoneBindingMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const createVmwareEngineNetworkResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.VmwareEngineNetwork') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.VmwareEngineNetwork', + ) as gax.protobuf.Type; const createVmwareEngineNetworkMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateVmwareEngineNetworkResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.VmwareEngineNetwork') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.VmwareEngineNetwork', + ) as gax.protobuf.Type; const updateVmwareEngineNetworkMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteVmwareEngineNetworkResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteVmwareEngineNetworkMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const createPrivateConnectionResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateConnection') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.PrivateConnection', + ) as gax.protobuf.Type; const createPrivateConnectionMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const updatePrivateConnectionResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.PrivateConnection') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.PrivateConnection', + ) as gax.protobuf.Type; const updatePrivateConnectionMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const deletePrivateConnectionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deletePrivateConnectionMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const grantDnsBindPermissionResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.DnsBindPermission') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.DnsBindPermission', + ) as gax.protobuf.Type; const grantDnsBindPermissionMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; const revokeDnsBindPermissionResponse = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.DnsBindPermission') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.DnsBindPermission', + ) as gax.protobuf.Type; const revokeDnsBindPermissionMetadata = protoFilesRoot.lookup( - '.google.cloud.vmwareengine.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vmwareengine.v1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createPrivateCloud: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createPrivateCloudResponse.decode.bind(createPrivateCloudResponse), - createPrivateCloudMetadata.decode.bind(createPrivateCloudMetadata)), + createPrivateCloudMetadata.decode.bind(createPrivateCloudMetadata), + ), updatePrivateCloud: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updatePrivateCloudResponse.decode.bind(updatePrivateCloudResponse), - updatePrivateCloudMetadata.decode.bind(updatePrivateCloudMetadata)), + updatePrivateCloudMetadata.decode.bind(updatePrivateCloudMetadata), + ), deletePrivateCloud: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deletePrivateCloudResponse.decode.bind(deletePrivateCloudResponse), - deletePrivateCloudMetadata.decode.bind(deletePrivateCloudMetadata)), + deletePrivateCloudMetadata.decode.bind(deletePrivateCloudMetadata), + ), undeletePrivateCloud: new this._gaxModule.LongrunningDescriptor( this.operationsClient, undeletePrivateCloudResponse.decode.bind(undeletePrivateCloudResponse), - undeletePrivateCloudMetadata.decode.bind(undeletePrivateCloudMetadata)), + undeletePrivateCloudMetadata.decode.bind(undeletePrivateCloudMetadata), + ), createCluster: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createClusterResponse.decode.bind(createClusterResponse), - createClusterMetadata.decode.bind(createClusterMetadata)), + createClusterMetadata.decode.bind(createClusterMetadata), + ), updateCluster: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateClusterResponse.decode.bind(updateClusterResponse), - updateClusterMetadata.decode.bind(updateClusterMetadata)), + updateClusterMetadata.decode.bind(updateClusterMetadata), + ), deleteCluster: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteClusterResponse.decode.bind(deleteClusterResponse), - deleteClusterMetadata.decode.bind(deleteClusterMetadata)), + deleteClusterMetadata.decode.bind(deleteClusterMetadata), + ), createExternalAddress: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createExternalAddressResponse.decode.bind(createExternalAddressResponse), - createExternalAddressMetadata.decode.bind(createExternalAddressMetadata)), + createExternalAddressResponse.decode.bind( + createExternalAddressResponse, + ), + createExternalAddressMetadata.decode.bind( + createExternalAddressMetadata, + ), + ), updateExternalAddress: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateExternalAddressResponse.decode.bind(updateExternalAddressResponse), - updateExternalAddressMetadata.decode.bind(updateExternalAddressMetadata)), + updateExternalAddressResponse.decode.bind( + updateExternalAddressResponse, + ), + updateExternalAddressMetadata.decode.bind( + updateExternalAddressMetadata, + ), + ), deleteExternalAddress: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteExternalAddressResponse.decode.bind(deleteExternalAddressResponse), - deleteExternalAddressMetadata.decode.bind(deleteExternalAddressMetadata)), + deleteExternalAddressResponse.decode.bind( + deleteExternalAddressResponse, + ), + deleteExternalAddressMetadata.decode.bind( + deleteExternalAddressMetadata, + ), + ), updateSubnet: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateSubnetResponse.decode.bind(updateSubnetResponse), - updateSubnetMetadata.decode.bind(updateSubnetMetadata)), + updateSubnetMetadata.decode.bind(updateSubnetMetadata), + ), createExternalAccessRule: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createExternalAccessRuleResponse.decode.bind(createExternalAccessRuleResponse), - createExternalAccessRuleMetadata.decode.bind(createExternalAccessRuleMetadata)), + createExternalAccessRuleResponse.decode.bind( + createExternalAccessRuleResponse, + ), + createExternalAccessRuleMetadata.decode.bind( + createExternalAccessRuleMetadata, + ), + ), updateExternalAccessRule: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateExternalAccessRuleResponse.decode.bind(updateExternalAccessRuleResponse), - updateExternalAccessRuleMetadata.decode.bind(updateExternalAccessRuleMetadata)), + updateExternalAccessRuleResponse.decode.bind( + updateExternalAccessRuleResponse, + ), + updateExternalAccessRuleMetadata.decode.bind( + updateExternalAccessRuleMetadata, + ), + ), deleteExternalAccessRule: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteExternalAccessRuleResponse.decode.bind(deleteExternalAccessRuleResponse), - deleteExternalAccessRuleMetadata.decode.bind(deleteExternalAccessRuleMetadata)), + deleteExternalAccessRuleResponse.decode.bind( + deleteExternalAccessRuleResponse, + ), + deleteExternalAccessRuleMetadata.decode.bind( + deleteExternalAccessRuleMetadata, + ), + ), createLoggingServer: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createLoggingServerResponse.decode.bind(createLoggingServerResponse), - createLoggingServerMetadata.decode.bind(createLoggingServerMetadata)), + createLoggingServerMetadata.decode.bind(createLoggingServerMetadata), + ), updateLoggingServer: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateLoggingServerResponse.decode.bind(updateLoggingServerResponse), - updateLoggingServerMetadata.decode.bind(updateLoggingServerMetadata)), + updateLoggingServerMetadata.decode.bind(updateLoggingServerMetadata), + ), deleteLoggingServer: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteLoggingServerResponse.decode.bind(deleteLoggingServerResponse), - deleteLoggingServerMetadata.decode.bind(deleteLoggingServerMetadata)), + deleteLoggingServerMetadata.decode.bind(deleteLoggingServerMetadata), + ), resetNsxCredentials: new this._gaxModule.LongrunningDescriptor( this.operationsClient, resetNsxCredentialsResponse.decode.bind(resetNsxCredentialsResponse), - resetNsxCredentialsMetadata.decode.bind(resetNsxCredentialsMetadata)), + resetNsxCredentialsMetadata.decode.bind(resetNsxCredentialsMetadata), + ), resetVcenterCredentials: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - resetVcenterCredentialsResponse.decode.bind(resetVcenterCredentialsResponse), - resetVcenterCredentialsMetadata.decode.bind(resetVcenterCredentialsMetadata)), + resetVcenterCredentialsResponse.decode.bind( + resetVcenterCredentialsResponse, + ), + resetVcenterCredentialsMetadata.decode.bind( + resetVcenterCredentialsMetadata, + ), + ), updateDnsForwarding: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateDnsForwardingResponse.decode.bind(updateDnsForwardingResponse), - updateDnsForwardingMetadata.decode.bind(updateDnsForwardingMetadata)), + updateDnsForwardingMetadata.decode.bind(updateDnsForwardingMetadata), + ), createNetworkPeering: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createNetworkPeeringResponse.decode.bind(createNetworkPeeringResponse), - createNetworkPeeringMetadata.decode.bind(createNetworkPeeringMetadata)), + createNetworkPeeringMetadata.decode.bind(createNetworkPeeringMetadata), + ), deleteNetworkPeering: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteNetworkPeeringResponse.decode.bind(deleteNetworkPeeringResponse), - deleteNetworkPeeringMetadata.decode.bind(deleteNetworkPeeringMetadata)), + deleteNetworkPeeringMetadata.decode.bind(deleteNetworkPeeringMetadata), + ), updateNetworkPeering: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateNetworkPeeringResponse.decode.bind(updateNetworkPeeringResponse), - updateNetworkPeeringMetadata.decode.bind(updateNetworkPeeringMetadata)), + updateNetworkPeeringMetadata.decode.bind(updateNetworkPeeringMetadata), + ), createHcxActivationKey: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createHcxActivationKeyResponse.decode.bind(createHcxActivationKeyResponse), - createHcxActivationKeyMetadata.decode.bind(createHcxActivationKeyMetadata)), + createHcxActivationKeyResponse.decode.bind( + createHcxActivationKeyResponse, + ), + createHcxActivationKeyMetadata.decode.bind( + createHcxActivationKeyMetadata, + ), + ), createNetworkPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createNetworkPolicyResponse.decode.bind(createNetworkPolicyResponse), - createNetworkPolicyMetadata.decode.bind(createNetworkPolicyMetadata)), + createNetworkPolicyMetadata.decode.bind(createNetworkPolicyMetadata), + ), updateNetworkPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateNetworkPolicyResponse.decode.bind(updateNetworkPolicyResponse), - updateNetworkPolicyMetadata.decode.bind(updateNetworkPolicyMetadata)), + updateNetworkPolicyMetadata.decode.bind(updateNetworkPolicyMetadata), + ), deleteNetworkPolicy: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteNetworkPolicyResponse.decode.bind(deleteNetworkPolicyResponse), - deleteNetworkPolicyMetadata.decode.bind(deleteNetworkPolicyMetadata)), + deleteNetworkPolicyMetadata.decode.bind(deleteNetworkPolicyMetadata), + ), createManagementDnsZoneBinding: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createManagementDnsZoneBindingResponse.decode.bind(createManagementDnsZoneBindingResponse), - createManagementDnsZoneBindingMetadata.decode.bind(createManagementDnsZoneBindingMetadata)), + createManagementDnsZoneBindingResponse.decode.bind( + createManagementDnsZoneBindingResponse, + ), + createManagementDnsZoneBindingMetadata.decode.bind( + createManagementDnsZoneBindingMetadata, + ), + ), updateManagementDnsZoneBinding: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateManagementDnsZoneBindingResponse.decode.bind(updateManagementDnsZoneBindingResponse), - updateManagementDnsZoneBindingMetadata.decode.bind(updateManagementDnsZoneBindingMetadata)), + updateManagementDnsZoneBindingResponse.decode.bind( + updateManagementDnsZoneBindingResponse, + ), + updateManagementDnsZoneBindingMetadata.decode.bind( + updateManagementDnsZoneBindingMetadata, + ), + ), deleteManagementDnsZoneBinding: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteManagementDnsZoneBindingResponse.decode.bind(deleteManagementDnsZoneBindingResponse), - deleteManagementDnsZoneBindingMetadata.decode.bind(deleteManagementDnsZoneBindingMetadata)), + deleteManagementDnsZoneBindingResponse.decode.bind( + deleteManagementDnsZoneBindingResponse, + ), + deleteManagementDnsZoneBindingMetadata.decode.bind( + deleteManagementDnsZoneBindingMetadata, + ), + ), repairManagementDnsZoneBinding: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - repairManagementDnsZoneBindingResponse.decode.bind(repairManagementDnsZoneBindingResponse), - repairManagementDnsZoneBindingMetadata.decode.bind(repairManagementDnsZoneBindingMetadata)), + repairManagementDnsZoneBindingResponse.decode.bind( + repairManagementDnsZoneBindingResponse, + ), + repairManagementDnsZoneBindingMetadata.decode.bind( + repairManagementDnsZoneBindingMetadata, + ), + ), createVmwareEngineNetwork: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createVmwareEngineNetworkResponse.decode.bind(createVmwareEngineNetworkResponse), - createVmwareEngineNetworkMetadata.decode.bind(createVmwareEngineNetworkMetadata)), + createVmwareEngineNetworkResponse.decode.bind( + createVmwareEngineNetworkResponse, + ), + createVmwareEngineNetworkMetadata.decode.bind( + createVmwareEngineNetworkMetadata, + ), + ), updateVmwareEngineNetwork: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updateVmwareEngineNetworkResponse.decode.bind(updateVmwareEngineNetworkResponse), - updateVmwareEngineNetworkMetadata.decode.bind(updateVmwareEngineNetworkMetadata)), + updateVmwareEngineNetworkResponse.decode.bind( + updateVmwareEngineNetworkResponse, + ), + updateVmwareEngineNetworkMetadata.decode.bind( + updateVmwareEngineNetworkMetadata, + ), + ), deleteVmwareEngineNetwork: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deleteVmwareEngineNetworkResponse.decode.bind(deleteVmwareEngineNetworkResponse), - deleteVmwareEngineNetworkMetadata.decode.bind(deleteVmwareEngineNetworkMetadata)), + deleteVmwareEngineNetworkResponse.decode.bind( + deleteVmwareEngineNetworkResponse, + ), + deleteVmwareEngineNetworkMetadata.decode.bind( + deleteVmwareEngineNetworkMetadata, + ), + ), createPrivateConnection: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - createPrivateConnectionResponse.decode.bind(createPrivateConnectionResponse), - createPrivateConnectionMetadata.decode.bind(createPrivateConnectionMetadata)), + createPrivateConnectionResponse.decode.bind( + createPrivateConnectionResponse, + ), + createPrivateConnectionMetadata.decode.bind( + createPrivateConnectionMetadata, + ), + ), updatePrivateConnection: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - updatePrivateConnectionResponse.decode.bind(updatePrivateConnectionResponse), - updatePrivateConnectionMetadata.decode.bind(updatePrivateConnectionMetadata)), + updatePrivateConnectionResponse.decode.bind( + updatePrivateConnectionResponse, + ), + updatePrivateConnectionMetadata.decode.bind( + updatePrivateConnectionMetadata, + ), + ), deletePrivateConnection: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - deletePrivateConnectionResponse.decode.bind(deletePrivateConnectionResponse), - deletePrivateConnectionMetadata.decode.bind(deletePrivateConnectionMetadata)), + deletePrivateConnectionResponse.decode.bind( + deletePrivateConnectionResponse, + ), + deletePrivateConnectionMetadata.decode.bind( + deletePrivateConnectionMetadata, + ), + ), grantDnsBindPermission: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - grantDnsBindPermissionResponse.decode.bind(grantDnsBindPermissionResponse), - grantDnsBindPermissionMetadata.decode.bind(grantDnsBindPermissionMetadata)), + grantDnsBindPermissionResponse.decode.bind( + grantDnsBindPermissionResponse, + ), + grantDnsBindPermissionMetadata.decode.bind( + grantDnsBindPermissionMetadata, + ), + ), revokeDnsBindPermission: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - revokeDnsBindPermissionResponse.decode.bind(revokeDnsBindPermissionResponse), - revokeDnsBindPermissionMetadata.decode.bind(revokeDnsBindPermissionMetadata)) + revokeDnsBindPermissionResponse.decode.bind( + revokeDnsBindPermissionResponse, + ), + revokeDnsBindPermissionMetadata.decode.bind( + revokeDnsBindPermissionMetadata, + ), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.vmwareengine.v1.VmwareEngine', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.vmwareengine.v1.VmwareEngine', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -649,28 +992,108 @@ export class VmwareEngineClient { // Put together the "service stub" for // google.cloud.vmwareengine.v1.VmwareEngine. this.vmwareEngineStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.vmwareengine.v1.VmwareEngine') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.vmwareengine.v1.VmwareEngine', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.vmwareengine.v1.VmwareEngine, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const vmwareEngineStubMethods = - ['listPrivateClouds', 'getPrivateCloud', 'createPrivateCloud', 'updatePrivateCloud', 'deletePrivateCloud', 'undeletePrivateCloud', 'listClusters', 'getCluster', 'createCluster', 'updateCluster', 'deleteCluster', 'listNodes', 'getNode', 'listExternalAddresses', 'fetchNetworkPolicyExternalAddresses', 'getExternalAddress', 'createExternalAddress', 'updateExternalAddress', 'deleteExternalAddress', 'listSubnets', 'getSubnet', 'updateSubnet', 'listExternalAccessRules', 'getExternalAccessRule', 'createExternalAccessRule', 'updateExternalAccessRule', 'deleteExternalAccessRule', 'listLoggingServers', 'getLoggingServer', 'createLoggingServer', 'updateLoggingServer', 'deleteLoggingServer', 'listNodeTypes', 'getNodeType', 'showNsxCredentials', 'showVcenterCredentials', 'resetNsxCredentials', 'resetVcenterCredentials', 'getDnsForwarding', 'updateDnsForwarding', 'getNetworkPeering', 'listNetworkPeerings', 'createNetworkPeering', 'deleteNetworkPeering', 'updateNetworkPeering', 'listPeeringRoutes', 'createHcxActivationKey', 'listHcxActivationKeys', 'getHcxActivationKey', 'getNetworkPolicy', 'listNetworkPolicies', 'createNetworkPolicy', 'updateNetworkPolicy', 'deleteNetworkPolicy', 'listManagementDnsZoneBindings', 'getManagementDnsZoneBinding', 'createManagementDnsZoneBinding', 'updateManagementDnsZoneBinding', 'deleteManagementDnsZoneBinding', 'repairManagementDnsZoneBinding', 'createVmwareEngineNetwork', 'updateVmwareEngineNetwork', 'deleteVmwareEngineNetwork', 'getVmwareEngineNetwork', 'listVmwareEngineNetworks', 'createPrivateConnection', 'getPrivateConnection', 'listPrivateConnections', 'updatePrivateConnection', 'deletePrivateConnection', 'listPrivateConnectionPeeringRoutes', 'grantDnsBindPermission', 'getDnsBindPermission', 'revokeDnsBindPermission']; + const vmwareEngineStubMethods = [ + 'listPrivateClouds', + 'getPrivateCloud', + 'createPrivateCloud', + 'updatePrivateCloud', + 'deletePrivateCloud', + 'undeletePrivateCloud', + 'listClusters', + 'getCluster', + 'createCluster', + 'updateCluster', + 'deleteCluster', + 'listNodes', + 'getNode', + 'listExternalAddresses', + 'fetchNetworkPolicyExternalAddresses', + 'getExternalAddress', + 'createExternalAddress', + 'updateExternalAddress', + 'deleteExternalAddress', + 'listSubnets', + 'getSubnet', + 'updateSubnet', + 'listExternalAccessRules', + 'getExternalAccessRule', + 'createExternalAccessRule', + 'updateExternalAccessRule', + 'deleteExternalAccessRule', + 'listLoggingServers', + 'getLoggingServer', + 'createLoggingServer', + 'updateLoggingServer', + 'deleteLoggingServer', + 'listNodeTypes', + 'getNodeType', + 'showNsxCredentials', + 'showVcenterCredentials', + 'resetNsxCredentials', + 'resetVcenterCredentials', + 'getDnsForwarding', + 'updateDnsForwarding', + 'getNetworkPeering', + 'listNetworkPeerings', + 'createNetworkPeering', + 'deleteNetworkPeering', + 'updateNetworkPeering', + 'listPeeringRoutes', + 'createHcxActivationKey', + 'listHcxActivationKeys', + 'getHcxActivationKey', + 'getNetworkPolicy', + 'listNetworkPolicies', + 'createNetworkPolicy', + 'updateNetworkPolicy', + 'deleteNetworkPolicy', + 'listManagementDnsZoneBindings', + 'getManagementDnsZoneBinding', + 'createManagementDnsZoneBinding', + 'updateManagementDnsZoneBinding', + 'deleteManagementDnsZoneBinding', + 'repairManagementDnsZoneBinding', + 'createVmwareEngineNetwork', + 'updateVmwareEngineNetwork', + 'deleteVmwareEngineNetwork', + 'getVmwareEngineNetwork', + 'listVmwareEngineNetworks', + 'createPrivateConnection', + 'getPrivateConnection', + 'listPrivateConnections', + 'updatePrivateConnection', + 'deletePrivateConnection', + 'listPrivateConnectionPeeringRoutes', + 'grantDnsBindPermission', + 'getDnsBindPermission', + 'revokeDnsBindPermission', + ]; for (const methodName of vmwareEngineStubMethods) { const callPromise = this.vmwareEngineStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); const descriptor = this.descriptors.page[methodName] || @@ -680,7 +1103,7 @@ export class VmwareEngineClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -695,8 +1118,14 @@ export class VmwareEngineClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'vmwareengine.googleapis.com'; } @@ -707,8 +1136,14 @@ export class VmwareEngineClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'vmwareengine.googleapis.com'; } @@ -739,9 +1174,7 @@ export class VmwareEngineClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -750,8 +1183,9 @@ export class VmwareEngineClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -762,7083 +1196,10349 @@ export class VmwareEngineClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Retrieves a `PrivateCloud` resource by its resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the private cloud to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @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 protos.google.cloud.vmwareengine.v1.PrivateCloud|PrivateCloud}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetPrivateCloud_async - */ + /** + * Retrieves a `PrivateCloud` resource by its resource name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the private cloud to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @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 protos.google.cloud.vmwareengine.v1.PrivateCloud|PrivateCloud}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetPrivateCloud_async + */ getPrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateCloud, - protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest | undefined, + {} | undefined, + ] + >; getPrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IPrivateCloud, - protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + | protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getPrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IPrivateCloud, - protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + | protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getPrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.IPrivateCloud, - protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.IPrivateCloud, - protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateCloud, - protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + | protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getPrivateCloud request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.IPrivateCloud, - protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + | protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getPrivateCloud response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getPrivateCloud(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.IPrivateCloud, - protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest|undefined, - {}|undefined - ]) => { - this._log.info('getPrivateCloud response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getPrivateCloud(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + ( + | protos.google.cloud.vmwareengine.v1.IGetPrivateCloudRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getPrivateCloud response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a `Cluster` resource by its resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The cluster resource name to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` - * @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 protos.google.cloud.vmwareengine.v1.Cluster|Cluster}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_cluster.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetCluster_async - */ + /** + * Retrieves a `Cluster` resource by its resource name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The cluster resource name to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * @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 protos.google.cloud.vmwareengine.v1.Cluster|Cluster}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_cluster.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetCluster_async + */ getCluster( - request?: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICluster, - protos.google.cloud.vmwareengine.v1.IGetClusterRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IGetClusterRequest | undefined, + {} | undefined, + ] + >; getCluster( - request: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ICluster, - protos.google.cloud.vmwareengine.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IGetClusterRequest | null | undefined, + {} | null | undefined + >, + ): void; getCluster( - request: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ICluster, - protos.google.cloud.vmwareengine.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IGetClusterRequest | null | undefined, + {} | null | undefined + >, + ): void; getCluster( - request?: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.ICluster, - protos.google.cloud.vmwareengine.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetClusterRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.ICluster, - protos.google.cloud.vmwareengine.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICluster, - protos.google.cloud.vmwareengine.v1.IGetClusterRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetClusterRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IGetClusterRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IGetClusterRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getCluster request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.ICluster, - protos.google.cloud.vmwareengine.v1.IGetClusterRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.ICluster, + | protos.google.cloud.vmwareengine.v1.IGetClusterRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getCluster response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getCluster(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.ICluster, - protos.google.cloud.vmwareengine.v1.IGetClusterRequest|undefined, - {}|undefined - ]) => { - this._log.info('getCluster response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getCluster(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IGetClusterRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getCluster response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single node. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the node to retrieve. - * For example: - * `projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node}` - * @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 protos.google.cloud.vmwareengine.v1.Node|Node}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_node.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetNode_async - */ + /** + * Gets details of a single node. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the node to retrieve. + * For example: + * `projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}/nodes/{node}` + * @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 protos.google.cloud.vmwareengine.v1.Node|Node}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_node.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetNode_async + */ getNode( - request?: protos.google.cloud.vmwareengine.v1.IGetNodeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.INode, - protos.google.cloud.vmwareengine.v1.IGetNodeRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetNodeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INode, + protos.google.cloud.vmwareengine.v1.IGetNodeRequest | undefined, + {} | undefined, + ] + >; getNode( - request: protos.google.cloud.vmwareengine.v1.IGetNodeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.INode, - protos.google.cloud.vmwareengine.v1.IGetNodeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetNodeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.INode, + protos.google.cloud.vmwareengine.v1.IGetNodeRequest | null | undefined, + {} | null | undefined + >, + ): void; getNode( - request: protos.google.cloud.vmwareengine.v1.IGetNodeRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.INode, - protos.google.cloud.vmwareengine.v1.IGetNodeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetNodeRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.INode, + protos.google.cloud.vmwareengine.v1.IGetNodeRequest | null | undefined, + {} | null | undefined + >, + ): void; getNode( - request?: protos.google.cloud.vmwareengine.v1.IGetNodeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.INode, - protos.google.cloud.vmwareengine.v1.IGetNodeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetNodeRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.INode, - protos.google.cloud.vmwareengine.v1.IGetNodeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.INode, - protos.google.cloud.vmwareengine.v1.IGetNodeRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetNodeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.INode, + protos.google.cloud.vmwareengine.v1.IGetNodeRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INode, + protos.google.cloud.vmwareengine.v1.IGetNodeRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getNode request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.INode, - protos.google.cloud.vmwareengine.v1.IGetNodeRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.INode, + | protos.google.cloud.vmwareengine.v1.IGetNodeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getNode response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getNode(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.INode, - protos.google.cloud.vmwareengine.v1.IGetNodeRequest|undefined, - {}|undefined - ]) => { - this._log.info('getNode response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getNode(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.INode, + protos.google.cloud.vmwareengine.v1.IGetNodeRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getNode response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single external IP address. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the external IP address to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` - * @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 protos.google.cloud.vmwareengine.v1.ExternalAddress|ExternalAddress}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_external_address.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetExternalAddress_async - */ + /** + * Gets details of a single external IP address. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the external IP address to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` + * @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 protos.google.cloud.vmwareengine.v1.ExternalAddress|ExternalAddress}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_external_address.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetExternalAddress_async + */ getExternalAddress( - request?: protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IExternalAddress, - protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IExternalAddress, + ( + | protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest + | undefined + ), + {} | undefined, + ] + >; getExternalAddress( - request: protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IExternalAddress, - protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + | protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getExternalAddress( - request: protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IExternalAddress, - protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + | protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getExternalAddress( - request?: protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.IExternalAddress, - protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.IExternalAddress, - protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IExternalAddress, - protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + | protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IExternalAddress, + ( + | protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getExternalAddress request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.IExternalAddress, - protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + | protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getExternalAddress response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getExternalAddress(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.IExternalAddress, - protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest|undefined, - {}|undefined - ]) => { - this._log.info('getExternalAddress response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getExternalAddress(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.IExternalAddress, + ( + | protos.google.cloud.vmwareengine.v1.IGetExternalAddressRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getExternalAddress response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single subnet. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the subnet to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` - * @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 protos.google.cloud.vmwareengine.v1.Subnet|Subnet}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_subnet.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetSubnet_async - */ + /** + * Gets details of a single subnet. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the subnet to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet` + * @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 protos.google.cloud.vmwareengine.v1.Subnet|Subnet}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_subnet.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetSubnet_async + */ getSubnet( - request?: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.ISubnet, - protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IGetSubnetRequest | undefined, + {} | undefined, + ] + >; getSubnet( - request: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ISubnet, - protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IGetSubnetRequest | null | undefined, + {} | null | undefined + >, + ): void; getSubnet( - request: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ISubnet, - protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IGetSubnetRequest | null | undefined, + {} | null | undefined + >, + ): void; getSubnet( - request?: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.ISubnet, - protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetSubnetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.ISubnet, - protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.ISubnet, - protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetSubnetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IGetSubnetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IGetSubnetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getSubnet request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.ISubnet, - protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.ISubnet, + | protos.google.cloud.vmwareengine.v1.IGetSubnetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getSubnet response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getSubnet(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.ISubnet, - protos.google.cloud.vmwareengine.v1.IGetSubnetRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSubnet response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getSubnet(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IGetSubnetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getSubnet response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single external access rule. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the external access firewall rule to - * retrieve. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` - * @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 protos.google.cloud.vmwareengine.v1.ExternalAccessRule|ExternalAccessRule}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_external_access_rule.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetExternalAccessRule_async - */ + /** + * Gets details of a single external access rule. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the external access firewall rule to + * retrieve. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * @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 protos.google.cloud.vmwareengine.v1.ExternalAccessRule|ExternalAccessRule}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_external_access_rule.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetExternalAccessRule_async + */ getExternalAccessRule( - request?: protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IExternalAccessRule, - protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + ( + | protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest + | undefined + ), + {} | undefined, + ] + >; getExternalAccessRule( - request: protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IExternalAccessRule, - protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + | protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getExternalAccessRule( - request: protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IExternalAccessRule, - protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + | protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getExternalAccessRule( - request?: protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.IExternalAccessRule, - protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.IExternalAccessRule, - protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IExternalAccessRule, - protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + | protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + ( + | protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getExternalAccessRule request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.IExternalAccessRule, - protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + | protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getExternalAccessRule response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getExternalAccessRule(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.IExternalAccessRule, - protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest|undefined, - {}|undefined - ]) => { - this._log.info('getExternalAccessRule response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getExternalAccessRule(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + ( + | protos.google.cloud.vmwareengine.v1.IGetExternalAccessRuleRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getExternalAccessRule response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a logging server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Logging Server to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` - * @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 protos.google.cloud.vmwareengine.v1.LoggingServer|LoggingServer}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_logging_server.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetLoggingServer_async - */ + /** + * Gets details of a logging server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Logging Server to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * @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 protos.google.cloud.vmwareengine.v1.LoggingServer|LoggingServer}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_logging_server.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetLoggingServer_async + */ getLoggingServer( - request?: protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.ILoggingServer, - protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest | undefined, + {} | undefined, + ] + >; getLoggingServer( - request: protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ILoggingServer, - protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + | protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getLoggingServer( - request: protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ILoggingServer, - protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + | protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getLoggingServer( - request?: protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.ILoggingServer, - protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.ILoggingServer, - protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.ILoggingServer, - protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + | protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getLoggingServer request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.ILoggingServer, - protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + | protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getLoggingServer response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getLoggingServer(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.ILoggingServer, - protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest|undefined, - {}|undefined - ]) => { - this._log.info('getLoggingServer response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getLoggingServer(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.ILoggingServer, + ( + | protos.google.cloud.vmwareengine.v1.IGetLoggingServerRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getLoggingServer response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single `NodeType`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the node type to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` - * @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 protos.google.cloud.vmwareengine.v1.NodeType|NodeType}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_node_type.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetNodeType_async - */ + /** + * Gets details of a single `NodeType`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the node type to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72` + * @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 protos.google.cloud.vmwareengine.v1.NodeType|NodeType}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_node_type.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetNodeType_async + */ getNodeType( - request?: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.INodeType, - protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INodeType, + protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest | undefined, + {} | undefined, + ] + >; getNodeType( - request: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.INodeType, - protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.INodeType, + | protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getNodeType( - request: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.INodeType, - protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.INodeType, + | protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getNodeType( - request?: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.INodeType, - protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.INodeType, - protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.INodeType, - protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.INodeType, + | protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INodeType, + protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getNodeType request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.INodeType, - protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.INodeType, + | protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getNodeType response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getNodeType(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.INodeType, - protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest|undefined, - {}|undefined - ]) => { - this._log.info('getNodeType response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getNodeType(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.INodeType, + protos.google.cloud.vmwareengine.v1.IGetNodeTypeRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getNodeType response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of credentials for NSX appliance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.privateCloud - * Required. The resource name of the private cloud - * to be queried for credentials. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @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 protos.google.cloud.vmwareengine.v1.Credentials|Credentials}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.show_nsx_credentials.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ShowNsxCredentials_async - */ + /** + * Gets details of credentials for NSX appliance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.privateCloud + * Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @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 protos.google.cloud.vmwareengine.v1.Credentials|Credentials}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.show_nsx_credentials.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ShowNsxCredentials_async + */ showNsxCredentials( - request?: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ICredentials, + ( + | protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest + | undefined + ), + {} | undefined, + ] + >; showNsxCredentials( - request: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + | protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; showNsxCredentials( - request: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + | protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; showNsxCredentials( - request?: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + | protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ICredentials, + ( + | protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'private_cloud': request.privateCloud ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + private_cloud: request.privateCloud ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('showNsxCredentials request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + | protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('showNsxCredentials response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.showNsxCredentials(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest|undefined, - {}|undefined - ]) => { - this._log.info('showNsxCredentials response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .showNsxCredentials(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.ICredentials, + ( + | protos.google.cloud.vmwareengine.v1.IShowNsxCredentialsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('showNsxCredentials response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of credentials for Vcenter appliance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.privateCloud - * Required. The resource name of the private cloud - * to be queried for credentials. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {string} [request.username] - * Optional. The username of the user to be queried for credentials. - * The default value of this field is CloudOwner@gve.local. - * The provided value must be one of the following: - * CloudOwner@gve.local, - * solution-user-01@gve.local, - * solution-user-02@gve.local, - * solution-user-03@gve.local, - * solution-user-04@gve.local, - * solution-user-05@gve.local, - * zertoadmin@gve.local. - * @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 protos.google.cloud.vmwareengine.v1.Credentials|Credentials}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.show_vcenter_credentials.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ShowVcenterCredentials_async - */ + /** + * Gets details of credentials for Vcenter appliance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.privateCloud + * Required. The resource name of the private cloud + * to be queried for credentials. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {string} [request.username] + * Optional. The username of the user to be queried for credentials. + * The default value of this field is CloudOwner@gve.local. + * The provided value must be one of the following: + * CloudOwner@gve.local, + * solution-user-01@gve.local, + * solution-user-02@gve.local, + * solution-user-03@gve.local, + * solution-user-04@gve.local, + * solution-user-05@gve.local, + * zertoadmin@gve.local. + * @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 protos.google.cloud.vmwareengine.v1.Credentials|Credentials}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.show_vcenter_credentials.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ShowVcenterCredentials_async + */ showVcenterCredentials( - request?: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ICredentials, + ( + | protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest + | undefined + ), + {} | undefined, + ] + >; showVcenterCredentials( - request: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + | protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; showVcenterCredentials( - request: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + | protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; showVcenterCredentials( - request?: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; + | protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + | protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ICredentials, + ( + | protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'private_cloud': request.privateCloud ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + private_cloud: request.privateCloud ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('showVcenterCredentials request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.ICredentials, + | protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('showVcenterCredentials response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.showVcenterCredentials(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.ICredentials, - protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest|undefined, - {}|undefined - ]) => { - this._log.info('showVcenterCredentials response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .showVcenterCredentials(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.ICredentials, + ( + | protos.google.cloud.vmwareengine.v1.IShowVcenterCredentialsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('showVcenterCredentials response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of the `DnsForwarding` config. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of a `DnsForwarding` to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/dnsForwarding` - * @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 protos.google.cloud.vmwareengine.v1.DnsForwarding|DnsForwarding}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_dns_forwarding.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetDnsForwarding_async - */ + /** + * Gets details of the `DnsForwarding` config. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of a `DnsForwarding` to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/dnsForwarding` + * @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 protos.google.cloud.vmwareengine.v1.DnsForwarding|DnsForwarding}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_dns_forwarding.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetDnsForwarding_async + */ getDnsForwarding( - request?: protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IDnsForwarding, - protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest | undefined, + {} | undefined, + ] + >; getDnsForwarding( - request: protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IDnsForwarding, - protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + | protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDnsForwarding( - request: protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IDnsForwarding, - protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + | protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDnsForwarding( - request?: protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.IDnsForwarding, - protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.IDnsForwarding, - protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IDnsForwarding, - protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + | protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getDnsForwarding request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.IDnsForwarding, - protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + | protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getDnsForwarding response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getDnsForwarding(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.IDnsForwarding, - protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDnsForwarding response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getDnsForwarding(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + ( + | protos.google.cloud.vmwareengine.v1.IGetDnsForwardingRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getDnsForwarding response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a `NetworkPeering` resource by its resource name. The resource - * contains details of the network peering, such as peered - * networks, import and export custom route configurations, and peering state. - * NetworkPeering is a global resource and location can only be global. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the network peering to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/global/networkPeerings/my-peering` - * @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 protos.google.cloud.vmwareengine.v1.NetworkPeering|NetworkPeering}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_network_peering.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetNetworkPeering_async - */ + /** + * Retrieves a `NetworkPeering` resource by its resource name. The resource + * contains details of the network peering, such as peered + * networks, import and export custom route configurations, and peering state. + * NetworkPeering is a global resource and location can only be global. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the network peering to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * @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 protos.google.cloud.vmwareengine.v1.NetworkPeering|NetworkPeering}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_network_peering.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetNetworkPeering_async + */ getNetworkPeering( - request?: protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.INetworkPeering, - protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest | undefined, + {} | undefined, + ] + >; getNetworkPeering( - request: protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.INetworkPeering, - protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + | protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getNetworkPeering( - request: protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.INetworkPeering, - protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + | protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getNetworkPeering( - request?: protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.INetworkPeering, - protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.INetworkPeering, - protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.INetworkPeering, - protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + | protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getNetworkPeering request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.INetworkPeering, - protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + | protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getNetworkPeering response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getNetworkPeering(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.INetworkPeering, - protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest|undefined, - {}|undefined - ]) => { - this._log.info('getNetworkPeering response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getNetworkPeering(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.INetworkPeering, + ( + | protos.google.cloud.vmwareengine.v1.IGetNetworkPeeringRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getNetworkPeering response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a `HcxActivationKey` resource by its resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the HCX activation key to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` - * @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 protos.google.cloud.vmwareengine.v1.HcxActivationKey|HcxActivationKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_hcx_activation_key.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetHcxActivationKey_async - */ + /** + * Retrieves a `HcxActivationKey` resource by its resource name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the HCX activation key to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key` + * @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 protos.google.cloud.vmwareengine.v1.HcxActivationKey|HcxActivationKey}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_hcx_activation_key.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetHcxActivationKey_async + */ getHcxActivationKey( - request?: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IHcxActivationKey, - protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + ( + | protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest + | undefined + ), + {} | undefined, + ] + >; getHcxActivationKey( - request: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IHcxActivationKey, - protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + | protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getHcxActivationKey( - request: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IHcxActivationKey, - protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + | protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getHcxActivationKey( - request?: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.IHcxActivationKey, - protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.IHcxActivationKey, - protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IHcxActivationKey, - protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + | protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + ( + | protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getHcxActivationKey request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.IHcxActivationKey, - protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + | protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getHcxActivationKey response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getHcxActivationKey(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.IHcxActivationKey, - protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getHcxActivationKey response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getHcxActivationKey(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + ( + | protos.google.cloud.vmwareengine.v1.IGetHcxActivationKeyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getHcxActivationKey response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a `NetworkPolicy` resource by its resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the network policy to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` - * @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 protos.google.cloud.vmwareengine.v1.NetworkPolicy|NetworkPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_network_policy.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetNetworkPolicy_async - */ + /** + * Retrieves a `NetworkPolicy` resource by its resource name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the network policy to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * @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 protos.google.cloud.vmwareengine.v1.NetworkPolicy|NetworkPolicy}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_network_policy.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetNetworkPolicy_async + */ getNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.INetworkPolicy, - protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest | undefined, + {} | undefined, + ] + >; getNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.INetworkPolicy, - protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + | protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.INetworkPolicy, - protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + | protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.INetworkPolicy, - protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.INetworkPolicy, - protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.INetworkPolicy, - protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + | protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getNetworkPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.INetworkPolicy, - protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + | protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getNetworkPolicy response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getNetworkPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.INetworkPolicy, - protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getNetworkPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getNetworkPolicy(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + ( + | protos.google.cloud.vmwareengine.v1.IGetNetworkPolicyRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getNetworkPolicy response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a 'ManagementDnsZoneBinding' resource by its resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the management DNS zone binding to - * retrieve. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` - * @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 protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding|ManagementDnsZoneBinding}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_management_dns_zone_binding.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetManagementDnsZoneBinding_async - */ + /** + * Retrieves a 'ManagementDnsZoneBinding' resource by its resource name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the management DNS zone binding to + * retrieve. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * @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 protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding|ManagementDnsZoneBinding}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_management_dns_zone_binding.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetManagementDnsZoneBinding_async + */ getManagementDnsZoneBinding( - request?: protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, - protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + ( + | protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest + | undefined + ), + {} | undefined, + ] + >; getManagementDnsZoneBinding( - request: protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, - protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + | protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getManagementDnsZoneBinding( - request: protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, - protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + | protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getManagementDnsZoneBinding( - request?: protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, - protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, - protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, - protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + | protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + ( + | protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getManagementDnsZoneBinding request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, - protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + | protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getManagementDnsZoneBinding response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getManagementDnsZoneBinding(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, - protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest|undefined, - {}|undefined - ]) => { - this._log.info('getManagementDnsZoneBinding response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getManagementDnsZoneBinding(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + ( + | protos.google.cloud.vmwareengine.v1.IGetManagementDnsZoneBindingRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getManagementDnsZoneBinding response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a `VmwareEngineNetwork` resource by its resource name. The - * resource contains details of the VMware Engine network, such as its VMware - * Engine network type, peered networks in a service project, and state - * (for example, `CREATING`, `ACTIVE`, `DELETING`). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the VMware Engine network to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` - * @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 protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_vmware_engine_network.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetVmwareEngineNetwork_async - */ + /** + * Retrieves a `VmwareEngineNetwork` resource by its resource name. The + * resource contains details of the VMware Engine network, such as its VMware + * Engine network type, peered networks in a service project, and state + * (for example, `CREATING`, `ACTIVE`, `DELETING`). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the VMware Engine network to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * @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 protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_vmware_engine_network.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetVmwareEngineNetwork_async + */ getVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, - protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + ( + | protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest + | undefined + ), + {} | undefined, + ] + >; getVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, - protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + | protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, - protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + | protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, - protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, - protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, - protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + | protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + ( + | protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getVmwareEngineNetwork request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, - protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + | protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getVmwareEngineNetwork response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getVmwareEngineNetwork(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, - protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest|undefined, - {}|undefined - ]) => { - this._log.info('getVmwareEngineNetwork response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getVmwareEngineNetwork(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + ( + | protos.google.cloud.vmwareengine.v1.IGetVmwareEngineNetworkRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getVmwareEngineNetwork response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a `PrivateConnection` resource by its resource name. The resource - * contains details of the private connection, such as connected - * network, routing mode and state. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the private connection to retrieve. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateConnections/my-connection` - * @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 protos.google.cloud.vmwareengine.v1.PrivateConnection|PrivateConnection}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_private_connection.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetPrivateConnection_async - */ + /** + * Retrieves a `PrivateConnection` resource by its resource name. The resource + * contains details of the private connection, such as connected + * network, routing mode and state. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the private connection to retrieve. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * @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 protos.google.cloud.vmwareengine.v1.PrivateConnection|PrivateConnection}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_private_connection.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetPrivateConnection_async + */ getPrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateConnection, - protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + ( + | protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest + | undefined + ), + {} | undefined, + ] + >; getPrivateConnection( - request: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IPrivateConnection, - protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + | protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getPrivateConnection( - request: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IPrivateConnection, - protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + | protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getPrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.IPrivateConnection, - protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.IPrivateConnection, - protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateConnection, - protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + | protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + ( + | protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getPrivateConnection request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.IPrivateConnection, - protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + | protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getPrivateConnection response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getPrivateConnection(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.IPrivateConnection, - protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest|undefined, - {}|undefined - ]) => { - this._log.info('getPrivateConnection response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getPrivateConnection(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + ( + | protos.google.cloud.vmwareengine.v1.IGetPrivateConnectionRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getPrivateConnection response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets all the principals having bind permission on the intranet VPC - * associated with the consumer project granted by the Grant API. - * DnsBindPermission is a global resource and location can only be global. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the resource which stores the users/service accounts - * having the permission to bind to the corresponding intranet VPC of the - * consumer project. DnsBindPermission is a global resource. Resource names - * are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/global/dnsBindPermission` - * @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 protos.google.cloud.vmwareengine.v1.DnsBindPermission|DnsBindPermission}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.get_dns_bind_permission.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GetDnsBindPermission_async - */ + /** + * Gets all the principals having bind permission on the intranet VPC + * associated with the consumer project granted by the Grant API. + * DnsBindPermission is a global resource and location can only be global. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * @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 protos.google.cloud.vmwareengine.v1.DnsBindPermission|DnsBindPermission}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.get_dns_bind_permission.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GetDnsBindPermission_async + */ getDnsBindPermission( - request?: protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IDnsBindPermission, - protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + ( + | protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest + | undefined + ), + {} | undefined, + ] + >; getDnsBindPermission( - request: protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IDnsBindPermission, - protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + | protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDnsBindPermission( - request: protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest, - callback: Callback< - protos.google.cloud.vmwareengine.v1.IDnsBindPermission, - protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest, + callback: Callback< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + | protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDnsBindPermission( - request?: protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vmwareengine.v1.IDnsBindPermission, - protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vmwareengine.v1.IDnsBindPermission, - protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IDnsBindPermission, - protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + | protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + ( + | protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getDnsBindPermission request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vmwareengine.v1.IDnsBindPermission, - protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + | protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getDnsBindPermission response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getDnsBindPermission(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vmwareengine.v1.IDnsBindPermission, - protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDnsBindPermission response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getDnsBindPermission(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + ( + | protos.google.cloud.vmwareengine.v1.IGetDnsBindPermissionRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getDnsBindPermission response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new `PrivateCloud` resource in a given project and location. - * Private clouds of type `STANDARD` and - * `TIME_LIMITED` are zonal resources, `STRETCHED` private clouds are - * regional. - * Creating a private cloud also creates a [management - * cluster](https://cloud.google.com/vmware-engine/docs/concepts-vmware-components) - * for that private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to create the new - * private cloud in. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param {string} request.privateCloudId - * Required. The user-provided identifier of the private cloud to be created. - * This identifier must be unique among each `PrivateCloud` within the parent - * and becomes the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {google.cloud.vmwareengine.v1.PrivateCloud} request.privateCloud - * Required. The initial description of the new private cloud. - * @param {string} [request.requestId] - * Optional. The request ID must be a valid UUID with the exception that zero - * UUID is not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.validateOnly] - * Optional. True if you want the request to be validated and not executed; - * false otherwise. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_async - */ + /** + * Creates a new `PrivateCloud` resource in a given project and location. + * Private clouds of type `STANDARD` and + * `TIME_LIMITED` are zonal resources, `STRETCHED` private clouds are + * regional. + * Creating a private cloud also creates a [management + * cluster](https://cloud.google.com/vmware-engine/docs/concepts-vmware-components) + * for that private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to create the new + * private cloud in. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param {string} request.privateCloudId + * Required. The user-provided identifier of the private cloud to be created. + * This identifier must be unique among each `PrivateCloud` within the parent + * and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {google.cloud.vmwareengine.v1.PrivateCloud} request.privateCloud + * Required. The initial description of the new private cloud. + * @param {string} [request.requestId] + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.validateOnly] + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_async + */ createPrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createPrivateCloud( - request: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createPrivateCloud( - request: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createPrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateCloudRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createPrivateCloud response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createPrivateCloud request %j', request); - return this.innerApiCalls.createPrivateCloud(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createPrivateCloud response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createPrivateCloud(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createPrivateCloud response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createPrivateCloud()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_async - */ - async checkCreatePrivateCloudProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createPrivateCloud()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateCloud_async + */ + async checkCreatePrivateCloudProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.PrivateCloud, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('createPrivateCloud long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createPrivateCloud, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createPrivateCloud, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.PrivateCloud, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Modifies a `PrivateCloud` resource. Only the following fields can be - * updated: `description`. - * Only fields specified in `updateMask` are applied. - * - * During operation processing, the resource is temporarily in the `ACTIVE` - * state before the operation fully completes. For that period of time, you - * can't update the resource. Use the operation status to determine when the - * processing fully completes. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.vmwareengine.v1.PrivateCloud} request.privateCloud - * Required. Private cloud description. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `PrivateCloud` resource by the update. The fields specified in `updateMask` - * are relative to the resource, not the full request. A field will be - * overwritten if it is in the mask. If the user does not provide a mask then - * all fields will be overwritten. - * @param {string} [request.requestId] - * Optional. The request ID must be a valid UUID with the exception that zero - * UUID is not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_async - */ + /** + * Modifies a `PrivateCloud` resource. Only the following fields can be + * updated: `description`. + * Only fields specified in `updateMask` are applied. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vmwareengine.v1.PrivateCloud} request.privateCloud + * Required. Private cloud description. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateCloud` resource by the update. The fields specified in `updateMask` + * are relative to the resource, not the full request. A field will be + * overwritten if it is in the mask. If the user does not provide a mask then + * all fields will be overwritten. + * @param {string} [request.requestId] + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_async + */ updatePrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updatePrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updatePrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updatePrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateCloudRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'private_cloud.name': request.privateCloud!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'private_cloud.name': request.privateCloud!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updatePrivateCloud response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updatePrivateCloud request %j', request); - return this.innerApiCalls.updatePrivateCloud(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updatePrivateCloud response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updatePrivateCloud(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updatePrivateCloud response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updatePrivateCloud()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_async - */ - async checkUpdatePrivateCloudProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updatePrivateCloud()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateCloud_async + */ + async checkUpdatePrivateCloudProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.PrivateCloud, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('updatePrivateCloud long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updatePrivateCloud, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updatePrivateCloud, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.PrivateCloud, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Schedules a `PrivateCloud` resource for deletion. - * - * A `PrivateCloud` resource scheduled for deletion has `PrivateCloud.state` - * set to `DELETED` and `expireTime` set to the time when deletion is final - * and can no longer be reversed. The delete operation is marked as done - * as soon as the `PrivateCloud` is successfully scheduled for deletion - * (this also applies when `delayHours` is set to zero), and the operation is - * not kept in pending state until `PrivateCloud` is purged. - * `PrivateCloud` can be restored using `UndeletePrivateCloud` method before - * the `expireTime` elapses. When `expireTime` is reached, deletion is final - * and all private cloud resources are irreversibly removed and billing stops. - * During the final removal process, `PrivateCloud.state` is set to `PURGING`. - * `PrivateCloud` can be polled using standard `GET` method for the whole - * period of deletion and purging. It will not be returned only - * when it is completely purged. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the private cloud to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {string} [request.requestId] - * Optional. The request ID must be a valid UUID with the exception that zero - * UUID is not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.force] - * Optional. If set to true, cascade delete is enabled and all children of - * this private cloud resource are also deleted. When this flag is set to - * false, the private cloud will not be deleted if there are any children - * other than the management cluster. The management cluster is always - * deleted. - * @param {number} [request.delayHours] - * Optional. Time delay of the deletion specified in hours. The default value - * is `3`. Specifying a non-zero value for this field changes the value of - * `PrivateCloud.state` to `DELETED` and sets `expire_time` to the planned - * deletion time. Deletion can be cancelled before `expire_time` elapses using - * {@link protos.google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud|VmwareEngine.UndeletePrivateCloud}. - * Specifying a value of `0` for this field instead begins the deletion - * process and ceases billing immediately. During the final deletion process, - * the value of `PrivateCloud.state` becomes `PURGING`. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_async - */ + /** + * Schedules a `PrivateCloud` resource for deletion. + * + * A `PrivateCloud` resource scheduled for deletion has `PrivateCloud.state` + * set to `DELETED` and `expireTime` set to the time when deletion is final + * and can no longer be reversed. The delete operation is marked as done + * as soon as the `PrivateCloud` is successfully scheduled for deletion + * (this also applies when `delayHours` is set to zero), and the operation is + * not kept in pending state until `PrivateCloud` is purged. + * `PrivateCloud` can be restored using `UndeletePrivateCloud` method before + * the `expireTime` elapses. When `expireTime` is reached, deletion is final + * and all private cloud resources are irreversibly removed and billing stops. + * During the final removal process, `PrivateCloud.state` is set to `PURGING`. + * `PrivateCloud` can be polled using standard `GET` method for the whole + * period of deletion and purging. It will not be returned only + * when it is completely purged. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the private cloud to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {string} [request.requestId] + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.force] + * Optional. If set to true, cascade delete is enabled and all children of + * this private cloud resource are also deleted. When this flag is set to + * false, the private cloud will not be deleted if there are any children + * other than the management cluster. The management cluster is always + * deleted. + * @param {number} [request.delayHours] + * Optional. Time delay of the deletion specified in hours. The default value + * is `3`. Specifying a non-zero value for this field changes the value of + * `PrivateCloud.state` to `DELETED` and sets `expire_time` to the planned + * deletion time. Deletion can be cancelled before `expire_time` elapses using + * {@link protos.google.cloud.vmwareengine.v1.VmwareEngine.UndeletePrivateCloud|VmwareEngine.UndeletePrivateCloud}. + * Specifying a value of `0` for this field instead begins the deletion + * process and ceases billing immediately. During the final deletion process, + * the value of `PrivateCloud.state` becomes `PURGING`. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_async + */ deletePrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deletePrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deletePrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deletePrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateCloudRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deletePrivateCloud response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deletePrivateCloud request %j', request); - return this.innerApiCalls.deletePrivateCloud(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deletePrivateCloud response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deletePrivateCloud(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deletePrivateCloud response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deletePrivateCloud()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_async - */ - async checkDeletePrivateCloudProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deletePrivateCloud()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateCloud_async + */ + async checkDeletePrivateCloudProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.PrivateCloud, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('deletePrivateCloud long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePrivateCloud, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deletePrivateCloud, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.PrivateCloud, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Restores a private cloud that was previously scheduled for deletion by - * `DeletePrivateCloud`. A `PrivateCloud` resource scheduled for deletion has - * `PrivateCloud.state` set to `DELETED` and `PrivateCloud.expireTime` set to - * the time when deletion can no longer be reversed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the private cloud scheduled for deletion. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {string} [request.requestId] - * Optional. The request ID must be a valid UUID with the exception that zero - * UUID is not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.undelete_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_async - */ + /** + * Restores a private cloud that was previously scheduled for deletion by + * `DeletePrivateCloud`. A `PrivateCloud` resource scheduled for deletion has + * `PrivateCloud.state` set to `DELETED` and `PrivateCloud.expireTime` set to + * the time when deletion can no longer be reversed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the private cloud scheduled for deletion. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {string} [request.requestId] + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.undelete_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_async + */ undeletePrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; undeletePrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; undeletePrivateCloud( - request: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; undeletePrivateCloud( - request?: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IUndeletePrivateCloudRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('undeletePrivateCloud response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('undeletePrivateCloud request %j', request); - return this.innerApiCalls.undeletePrivateCloud(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('undeletePrivateCloud response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .undeletePrivateCloud(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('undeletePrivateCloud response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `undeletePrivateCloud()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.undelete_private_cloud.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_async - */ - async checkUndeletePrivateCloudProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `undeletePrivateCloud()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.undelete_private_cloud.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UndeletePrivateCloud_async + */ + async checkUndeletePrivateCloudProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.PrivateCloud, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('undeletePrivateCloud long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.undeletePrivateCloud, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.undeletePrivateCloud, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.PrivateCloud, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Creates a new cluster in a given private cloud. - * Creating a new cluster provides additional nodes for - * use in the parent private cloud and requires sufficient [node - * quota](https://cloud.google.com/vmware-engine/quotas). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to create a new cluster - * in. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {string} request.clusterId - * Required. The user-provided identifier of the new `Cluster`. - * This identifier must be unique among clusters within the parent and becomes - * the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {google.cloud.vmwareengine.v1.Cluster} request.cluster - * Required. The initial description of the new cluster. - * @param {string} [request.requestId] - * Optional. The request ID must be a valid UUID with the exception that zero - * UUID is not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.validateOnly] - * Optional. True if you want the request to be validated and not executed; - * false otherwise. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_cluster.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateCluster_async - */ + /** + * Creates a new cluster in a given private cloud. + * Creating a new cluster provides additional nodes for + * use in the parent private cloud and requires sufficient [node + * quota](https://cloud.google.com/vmware-engine/quotas). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to create a new cluster + * in. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {string} request.clusterId + * Required. The user-provided identifier of the new `Cluster`. + * This identifier must be unique among clusters within the parent and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {google.cloud.vmwareengine.v1.Cluster} request.cluster + * Required. The initial description of the new cluster. + * @param {string} [request.requestId] + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.validateOnly] + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_cluster.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateCluster_async + */ createCluster( - request?: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createCluster( - request: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createCluster( - request: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createCluster( - request?: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.ICreateClusterRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createCluster response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createCluster request %j', request); - return this.innerApiCalls.createCluster(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createCluster response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createCluster(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createCluster response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_cluster.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateCluster_async - */ - async checkCreateClusterProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_cluster.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateCluster_async + */ + async checkCreateClusterProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.Cluster, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('createCluster long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createCluster, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.Cluster, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Modifies a `Cluster` resource. Only fields specified in `updateMask` are - * applied. - * - * During operation processing, the resource is temporarily in the `ACTIVE` - * state before the operation fully completes. For that period of time, you - * can't update the resource. Use the operation status to determine when the - * processing fully completes. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `Cluster` resource by the update. The fields specified in the `updateMask` - * are relative to the resource, not the full request. A field will be - * overwritten if it is in the mask. If the user does not provide a mask then - * all fields will be overwritten. - * @param {google.cloud.vmwareengine.v1.Cluster} request.cluster - * Required. The description of the cluster. - * @param {string} [request.requestId] - * Optional. The request ID must be a valid UUID with the exception that - * zero UUID is not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.validateOnly] - * Optional. True if you want the request to be validated and not executed; - * false otherwise. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_cluster.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateCluster_async - */ + /** + * Modifies a `Cluster` resource. Only fields specified in `updateMask` are + * applied. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `Cluster` resource by the update. The fields specified in the `updateMask` + * are relative to the resource, not the full request. A field will be + * overwritten if it is in the mask. If the user does not provide a mask then + * all fields will be overwritten. + * @param {google.cloud.vmwareengine.v1.Cluster} request.cluster + * Required. The description of the cluster. + * @param {string} [request.requestId] + * Optional. The request ID must be a valid UUID with the exception that + * zero UUID is not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.validateOnly] + * Optional. True if you want the request to be validated and not executed; + * false otherwise. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_cluster.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateCluster_async + */ updateCluster( - request?: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateCluster( - request: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateCluster( - request: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateCluster( - request?: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IUpdateClusterRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'cluster.name': request.cluster!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'cluster.name': request.cluster!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateCluster response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateCluster request %j', request); - return this.innerApiCalls.updateCluster(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateCluster response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateCluster(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateCluster response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_cluster.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateCluster_async - */ - async checkUpdateClusterProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_cluster.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateCluster_async + */ + async checkUpdateClusterProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.Cluster, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('updateCluster long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateCluster, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.Cluster, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Deletes a `Cluster` resource. To avoid unintended data loss, migrate or - * gracefully shut down any workloads running on the cluster before deletion. - * You cannot delete the management cluster of a private cloud using this - * method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the cluster to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` - * @param {string} [request.requestId] - * Optional. The request ID must be a valid UUID with the exception that zero - * UUID is not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_cluster.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteCluster_async - */ + /** + * Deletes a `Cluster` resource. To avoid unintended data loss, migrate or + * gracefully shut down any workloads running on the cluster before deletion. + * You cannot delete the management cluster of a private cloud using this + * method. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the cluster to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * @param {string} [request.requestId] + * Optional. The request ID must be a valid UUID with the exception that zero + * UUID is not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_cluster.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteCluster_async + */ deleteCluster( - request?: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteCluster( - request: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteCluster( - request: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteCluster( - request?: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IDeleteClusterRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteCluster response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteCluster request %j', request); - return this.innerApiCalls.deleteCluster(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteCluster response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteCluster(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteCluster response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteCluster()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_cluster.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteCluster_async - */ - async checkDeleteClusterProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteCluster()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_cluster.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteCluster_async + */ + async checkDeleteClusterProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('deleteCluster long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteCluster, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteCluster, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Creates a new `ExternalAddress` resource in a given private cloud. The - * network policy that corresponds to the private cloud must have the external - * IP address network service enabled (`NetworkPolicy.external_ip`). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud - * to create a new external IP address in. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {google.cloud.vmwareengine.v1.ExternalAddress} request.externalAddress - * Required. The initial description of a new external IP address. - * @param {string} request.externalAddressId - * Required. The user-provided identifier of the `ExternalAddress` to be - * created. This identifier must be unique among `ExternalAddress` resources - * within the parent and becomes the final token in the name URI. The - * identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if the original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_external_address.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateExternalAddress_async - */ + /** + * Creates a new `ExternalAddress` resource in a given private cloud. The + * network policy that corresponds to the private cloud must have the external + * IP address network service enabled (`NetworkPolicy.external_ip`). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud + * to create a new external IP address in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {google.cloud.vmwareengine.v1.ExternalAddress} request.externalAddress + * Required. The initial description of a new external IP address. + * @param {string} request.externalAddressId + * Required. The user-provided identifier of the `ExternalAddress` to be + * created. This identifier must be unique among `ExternalAddress` resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_external_address.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateExternalAddress_async + */ createExternalAddress( - request?: protos.google.cloud.vmwareengine.v1.ICreateExternalAddressRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.ICreateExternalAddressRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createExternalAddress( - request: protos.google.cloud.vmwareengine.v1.ICreateExternalAddressRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateExternalAddressRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createExternalAddress( - request: protos.google.cloud.vmwareengine.v1.ICreateExternalAddressRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateExternalAddressRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createExternalAddress( - request?: protos.google.cloud.vmwareengine.v1.ICreateExternalAddressRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.ICreateExternalAddressRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createExternalAddress response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createExternalAddress request %j', request); - return this.innerApiCalls.createExternalAddress(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createExternalAddress response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createExternalAddress(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createExternalAddress response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createExternalAddress()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_external_address.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateExternalAddress_async - */ - async checkCreateExternalAddressProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createExternalAddress()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_external_address.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateExternalAddress_async + */ + async checkCreateExternalAddressProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.ExternalAddress, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('createExternalAddress long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createExternalAddress, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createExternalAddress, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.ExternalAddress, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single external IP address. - * Only fields specified in `update_mask` are applied. - * - * During operation processing, the resource is temporarily in the `ACTIVE` - * state before the operation fully completes. For that period of time, you - * can't update the resource. Use the operation status to determine when the - * processing fully completes. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `ExternalAddress` resource by the update. - * The fields specified in the `update_mask` are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.vmwareengine.v1.ExternalAddress} request.externalAddress - * Required. External IP address description. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if the original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_external_address.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateExternalAddress_async - */ + /** + * Updates the parameters of a single external IP address. + * Only fields specified in `update_mask` are applied. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `ExternalAddress` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.vmwareengine.v1.ExternalAddress} request.externalAddress + * Required. External IP address description. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_external_address.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateExternalAddress_async + */ updateExternalAddress( - request?: protos.google.cloud.vmwareengine.v1.IUpdateExternalAddressRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IUpdateExternalAddressRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateExternalAddress( - request: protos.google.cloud.vmwareengine.v1.IUpdateExternalAddressRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateExternalAddressRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateExternalAddress( - request: protos.google.cloud.vmwareengine.v1.IUpdateExternalAddressRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateExternalAddressRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateExternalAddress( - request?: protos.google.cloud.vmwareengine.v1.IUpdateExternalAddressRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IUpdateExternalAddressRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'external_address.name': request.externalAddress!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'external_address.name': request.externalAddress!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateExternalAddress response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateExternalAddress request %j', request); - return this.innerApiCalls.updateExternalAddress(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateExternalAddress response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateExternalAddress(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateExternalAddress response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateExternalAddress()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_external_address.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateExternalAddress_async - */ - async checkUpdateExternalAddressProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateExternalAddress()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_external_address.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateExternalAddress_async + */ + async checkUpdateExternalAddressProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.ExternalAddress, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('updateExternalAddress long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateExternalAddress, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateExternalAddress, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.ExternalAddress, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Deletes a single external IP address. When you delete an external IP - * address, connectivity between the external IP address and the corresponding - * internal IP address is lost. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the external IP address to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if the original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_external_address.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteExternalAddress_async - */ + /** + * Deletes a single external IP address. When you delete an external IP + * address, connectivity between the external IP address and the corresponding + * internal IP address is lost. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the external IP address to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-ip` + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_external_address.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteExternalAddress_async + */ deleteExternalAddress( - request?: protos.google.cloud.vmwareengine.v1.IDeleteExternalAddressRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IDeleteExternalAddressRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteExternalAddress( - request: protos.google.cloud.vmwareengine.v1.IDeleteExternalAddressRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteExternalAddressRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteExternalAddress( - request: protos.google.cloud.vmwareengine.v1.IDeleteExternalAddressRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteExternalAddressRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteExternalAddress( - request?: protos.google.cloud.vmwareengine.v1.IDeleteExternalAddressRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IDeleteExternalAddressRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteExternalAddress response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteExternalAddress request %j', request); - return this.innerApiCalls.deleteExternalAddress(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteExternalAddress response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteExternalAddress(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteExternalAddress response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteExternalAddress()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_external_address.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteExternalAddress_async - */ - async checkDeleteExternalAddressProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteExternalAddress()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_external_address.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteExternalAddress_async + */ + async checkDeleteExternalAddressProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('deleteExternalAddress long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteExternalAddress, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteExternalAddress, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single subnet. Only fields specified in - * `update_mask` are applied. - * - * *Note*: This API is synchronous and always returns a successful - * `google.longrunning.Operation` (LRO). The returned LRO will only have - * `done` and `response` fields. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `Subnet` resource by the update. - * The fields specified in the `update_mask` are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.vmwareengine.v1.Subnet} request.subnet - * Required. Subnet description. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_subnet.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_async - */ + /** + * Updates the parameters of a single subnet. Only fields specified in + * `update_mask` are applied. + * + * *Note*: This API is synchronous and always returns a successful + * `google.longrunning.Operation` (LRO). The returned LRO will only have + * `done` and `response` fields. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `Subnet` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.vmwareengine.v1.Subnet} request.subnet + * Required. Subnet description. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_subnet.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_async + */ updateSubnet( - request?: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateSubnet( - request: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateSubnet( - request: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateSubnet( - request?: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IUpdateSubnetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'subnet.name': request.subnet!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'subnet.name': request.subnet!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateSubnet response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateSubnet request %j', request); - return this.innerApiCalls.updateSubnet(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateSubnet response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateSubnet(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateSubnet response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateSubnet()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_subnet.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_async - */ - async checkUpdateSubnetProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateSubnet()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_subnet.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateSubnet_async + */ + async checkUpdateSubnetProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.Subnet, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('updateSubnet long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateSubnet, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateSubnet, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.Subnet, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Creates a new external access rule in a given network policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the network policy - * to create a new external access firewall rule in. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/networkPolicies/my-policy` - * @param {google.cloud.vmwareengine.v1.ExternalAccessRule} request.externalAccessRule - * Required. The initial description of a new external access rule. - * @param {string} request.externalAccessRuleId - * Required. The user-provided identifier of the `ExternalAccessRule` to be - * created. This identifier must be unique among `ExternalAccessRule` - * resources within the parent and becomes the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if the original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_external_access_rule.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateExternalAccessRule_async - */ + /** + * Creates a new external access rule in a given network policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the network policy + * to create a new external access firewall rule in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * @param {google.cloud.vmwareengine.v1.ExternalAccessRule} request.externalAccessRule + * Required. The initial description of a new external access rule. + * @param {string} request.externalAccessRuleId + * Required. The user-provided identifier of the `ExternalAccessRule` to be + * created. This identifier must be unique among `ExternalAccessRule` + * resources within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_external_access_rule.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateExternalAccessRule_async + */ createExternalAccessRule( - request?: protos.google.cloud.vmwareengine.v1.ICreateExternalAccessRuleRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.ICreateExternalAccessRuleRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createExternalAccessRule( - request: protos.google.cloud.vmwareengine.v1.ICreateExternalAccessRuleRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateExternalAccessRuleRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createExternalAccessRule( - request: protos.google.cloud.vmwareengine.v1.ICreateExternalAccessRuleRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateExternalAccessRuleRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createExternalAccessRule( - request?: protos.google.cloud.vmwareengine.v1.ICreateExternalAccessRuleRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.ICreateExternalAccessRuleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createExternalAccessRule response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createExternalAccessRule request %j', request); - return this.innerApiCalls.createExternalAccessRule(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createExternalAccessRule response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createExternalAccessRule(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createExternalAccessRule response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createExternalAccessRule()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_external_access_rule.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateExternalAccessRule_async - */ - async checkCreateExternalAccessRuleProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createExternalAccessRule()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_external_access_rule.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateExternalAccessRule_async + */ + async checkCreateExternalAccessRuleProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.ExternalAccessRule, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('createExternalAccessRule long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createExternalAccessRule, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createExternalAccessRule, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.ExternalAccessRule, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single external access rule. - * Only fields specified in `update_mask` are applied. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `ExternalAccessRule` resource by the update. - * The fields specified in the `update_mask` are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.vmwareengine.v1.ExternalAccessRule} request.externalAccessRule - * Required. Description of the external access rule. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if the original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_external_access_rule.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateExternalAccessRule_async - */ + /** + * Updates the parameters of a single external access rule. + * Only fields specified in `update_mask` are applied. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `ExternalAccessRule` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.vmwareengine.v1.ExternalAccessRule} request.externalAccessRule + * Required. Description of the external access rule. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_external_access_rule.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateExternalAccessRule_async + */ updateExternalAccessRule( - request?: protos.google.cloud.vmwareengine.v1.IUpdateExternalAccessRuleRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IUpdateExternalAccessRuleRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateExternalAccessRule( - request: protos.google.cloud.vmwareengine.v1.IUpdateExternalAccessRuleRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateExternalAccessRuleRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateExternalAccessRule( - request: protos.google.cloud.vmwareengine.v1.IUpdateExternalAccessRuleRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateExternalAccessRuleRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateExternalAccessRule( - request?: protos.google.cloud.vmwareengine.v1.IUpdateExternalAccessRuleRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IUpdateExternalAccessRuleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'external_access_rule.name': request.externalAccessRule!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'external_access_rule.name': request.externalAccessRule!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateExternalAccessRule response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateExternalAccessRule request %j', request); - return this.innerApiCalls.updateExternalAccessRule(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateExternalAccessRule response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateExternalAccessRule(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateExternalAccessRule response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateExternalAccessRule()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_external_access_rule.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateExternalAccessRule_async - */ - async checkUpdateExternalAccessRuleProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateExternalAccessRule()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_external_access_rule.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateExternalAccessRule_async + */ + async checkUpdateExternalAccessRuleProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.ExternalAccessRule, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('updateExternalAccessRule long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateExternalAccessRule, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateExternalAccessRule, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.ExternalAccessRule, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Deletes a single external access rule. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the external access firewall rule to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if the original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_external_access_rule.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteExternalAccessRule_async - */ + /** + * Deletes a single external access rule. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the external access firewall rule to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule` + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_external_access_rule.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteExternalAccessRule_async + */ deleteExternalAccessRule( - request?: protos.google.cloud.vmwareengine.v1.IDeleteExternalAccessRuleRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IDeleteExternalAccessRuleRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteExternalAccessRule( - request: protos.google.cloud.vmwareengine.v1.IDeleteExternalAccessRuleRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteExternalAccessRuleRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteExternalAccessRule( - request: protos.google.cloud.vmwareengine.v1.IDeleteExternalAccessRuleRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteExternalAccessRuleRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteExternalAccessRule( - request?: protos.google.cloud.vmwareengine.v1.IDeleteExternalAccessRuleRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IDeleteExternalAccessRuleRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteExternalAccessRule response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteExternalAccessRule request %j', request); - return this.innerApiCalls.deleteExternalAccessRule(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteExternalAccessRule response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteExternalAccessRule(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteExternalAccessRule response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteExternalAccessRule()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_external_access_rule.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteExternalAccessRule_async - */ - async checkDeleteExternalAccessRuleProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteExternalAccessRule()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_external_access_rule.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteExternalAccessRule_async + */ + async checkDeleteExternalAccessRuleProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('deleteExternalAccessRule long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteExternalAccessRule, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteExternalAccessRule, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Create a new logging server for a given private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud - * to create a new Logging Server in. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {google.cloud.vmwareengine.v1.LoggingServer} request.loggingServer - * Required. The initial description of a new logging server. - * @param {string} request.loggingServerId - * Required. The user-provided identifier of the `LoggingServer` to be - * created. This identifier must be unique among `LoggingServer` resources - * within the parent and becomes the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_logging_server.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateLoggingServer_async - */ + /** + * Create a new logging server for a given private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud + * to create a new Logging Server in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {google.cloud.vmwareengine.v1.LoggingServer} request.loggingServer + * Required. The initial description of a new logging server. + * @param {string} request.loggingServerId + * Required. The user-provided identifier of the `LoggingServer` to be + * created. This identifier must be unique among `LoggingServer` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_logging_server.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateLoggingServer_async + */ createLoggingServer( - request?: protos.google.cloud.vmwareengine.v1.ICreateLoggingServerRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.ICreateLoggingServerRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createLoggingServer( - request: protos.google.cloud.vmwareengine.v1.ICreateLoggingServerRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateLoggingServerRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createLoggingServer( - request: protos.google.cloud.vmwareengine.v1.ICreateLoggingServerRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateLoggingServerRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createLoggingServer( - request?: protos.google.cloud.vmwareengine.v1.ICreateLoggingServerRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.ICreateLoggingServerRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createLoggingServer response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createLoggingServer request %j', request); - return this.innerApiCalls.createLoggingServer(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createLoggingServer response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createLoggingServer(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createLoggingServer response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createLoggingServer()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_logging_server.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateLoggingServer_async - */ - async checkCreateLoggingServerProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createLoggingServer()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_logging_server.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateLoggingServer_async + */ + async checkCreateLoggingServerProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.LoggingServer, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('createLoggingServer long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createLoggingServer, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createLoggingServer, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.LoggingServer, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single logging server. - * Only fields specified in `update_mask` are applied. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `LoggingServer` resource by the update. - * The fields specified in the `update_mask` are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.vmwareengine.v1.LoggingServer} request.loggingServer - * Required. Logging server description. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_logging_server.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateLoggingServer_async - */ + /** + * Updates the parameters of a single logging server. + * Only fields specified in `update_mask` are applied. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `LoggingServer` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.vmwareengine.v1.LoggingServer} request.loggingServer + * Required. Logging server description. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_logging_server.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateLoggingServer_async + */ updateLoggingServer( - request?: protos.google.cloud.vmwareengine.v1.IUpdateLoggingServerRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IUpdateLoggingServerRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateLoggingServer( - request: protos.google.cloud.vmwareengine.v1.IUpdateLoggingServerRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateLoggingServerRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateLoggingServer( - request: protos.google.cloud.vmwareengine.v1.IUpdateLoggingServerRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateLoggingServerRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateLoggingServer( - request?: protos.google.cloud.vmwareengine.v1.IUpdateLoggingServerRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IUpdateLoggingServerRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'logging_server.name': request.loggingServer!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'logging_server.name': request.loggingServer!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateLoggingServer response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateLoggingServer request %j', request); - return this.innerApiCalls.updateLoggingServer(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateLoggingServer response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateLoggingServer(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateLoggingServer response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateLoggingServer()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_logging_server.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateLoggingServer_async - */ - async checkUpdateLoggingServerProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateLoggingServer()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_logging_server.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateLoggingServer_async + */ + async checkUpdateLoggingServerProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.LoggingServer, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('updateLoggingServer long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateLoggingServer, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateLoggingServer, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.LoggingServer, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Deletes a single logging server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the logging server to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_logging_server.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteLoggingServer_async - */ + /** + * Deletes a single logging server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the logging server to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/loggingServers/my-logging-server` + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_logging_server.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteLoggingServer_async + */ deleteLoggingServer( - request?: protos.google.cloud.vmwareengine.v1.IDeleteLoggingServerRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IDeleteLoggingServerRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteLoggingServer( - request: protos.google.cloud.vmwareengine.v1.IDeleteLoggingServerRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteLoggingServerRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteLoggingServer( - request: protos.google.cloud.vmwareengine.v1.IDeleteLoggingServerRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteLoggingServerRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteLoggingServer( - request?: protos.google.cloud.vmwareengine.v1.IDeleteLoggingServerRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IDeleteLoggingServerRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteLoggingServer response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteLoggingServer request %j', request); - return this.innerApiCalls.deleteLoggingServer(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteLoggingServer response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteLoggingServer(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteLoggingServer response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteLoggingServer()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_logging_server.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteLoggingServer_async - */ - async checkDeleteLoggingServerProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteLoggingServer()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_logging_server.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteLoggingServer_async + */ + async checkDeleteLoggingServerProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('deleteLoggingServer long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteLoggingServer, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteLoggingServer, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Resets credentials of the NSX appliance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.privateCloud - * Required. The resource name of the private cloud - * to reset credentials for. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.reset_nsx_credentials.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_async - */ + /** + * Resets credentials of the NSX appliance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.privateCloud + * Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.reset_nsx_credentials.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_async + */ resetNsxCredentials( - request?: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; resetNsxCredentials( - request: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; resetNsxCredentials( - request: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; resetNsxCredentials( - request?: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IResetNsxCredentialsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'private_cloud': request.privateCloud ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + private_cloud: request.privateCloud ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('resetNsxCredentials response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('resetNsxCredentials request %j', request); - return this.innerApiCalls.resetNsxCredentials(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('resetNsxCredentials response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .resetNsxCredentials(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('resetNsxCredentials response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `resetNsxCredentials()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.reset_nsx_credentials.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_async - */ - async checkResetNsxCredentialsProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `resetNsxCredentials()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.reset_nsx_credentials.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetNsxCredentials_async + */ + async checkResetNsxCredentialsProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.PrivateCloud, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('resetNsxCredentials long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.resetNsxCredentials, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.resetNsxCredentials, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.PrivateCloud, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Resets credentials of the Vcenter appliance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.privateCloud - * Required. The resource name of the private cloud - * to reset credentials for. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {string} [request.username] - * Optional. The username of the user to be to reset the credentials. - * The default value of this field is CloudOwner@gve.local. - * The provided value should be one of the following: - * solution-user-01@gve.local, - * solution-user-02@gve.local, - * solution-user-03@gve.local, - * solution-user-04@gve.local, - * solution-user-05@gve.local, - * zertoadmin@gve.local. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.reset_vcenter_credentials.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_async - */ + /** + * Resets credentials of the Vcenter appliance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.privateCloud + * Required. The resource name of the private cloud + * to reset credentials for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {string} [request.username] + * Optional. The username of the user to be to reset the credentials. + * The default value of this field is CloudOwner@gve.local. + * The provided value should be one of the following: + * solution-user-01@gve.local, + * solution-user-02@gve.local, + * solution-user-03@gve.local, + * solution-user-04@gve.local, + * solution-user-05@gve.local, + * zertoadmin@gve.local. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.reset_vcenter_credentials.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_async + */ resetVcenterCredentials( - request?: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; resetVcenterCredentials( - request: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; resetVcenterCredentials( - request: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; resetVcenterCredentials( - request?: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IResetVcenterCredentialsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'private_cloud': request.privateCloud ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + private_cloud: request.privateCloud ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('resetVcenterCredentials response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('resetVcenterCredentials request %j', request); - return this.innerApiCalls.resetVcenterCredentials(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('resetVcenterCredentials response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .resetVcenterCredentials(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('resetVcenterCredentials response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `resetVcenterCredentials()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.reset_vcenter_credentials.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_async - */ - async checkResetVcenterCredentialsProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `resetVcenterCredentials()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.reset_vcenter_credentials.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ResetVcenterCredentials_async + */ + async checkResetVcenterCredentialsProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.PrivateCloud, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('resetVcenterCredentials long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.resetVcenterCredentials, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.resetVcenterCredentials, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.PrivateCloud, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Updates the parameters of the `DnsForwarding` config, like associated - * domains. Only fields specified in `update_mask` are applied. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.vmwareengine.v1.DnsForwarding} request.dnsForwarding - * Required. DnsForwarding config details. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `DnsForwarding` resource by the update. - * The fields specified in the `update_mask` are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_dns_forwarding.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateDnsForwarding_async - */ + /** + * Updates the parameters of the `DnsForwarding` config, like associated + * domains. Only fields specified in `update_mask` are applied. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vmwareengine.v1.DnsForwarding} request.dnsForwarding + * Required. DnsForwarding config details. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `DnsForwarding` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_dns_forwarding.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateDnsForwarding_async + */ updateDnsForwarding( - request?: protos.google.cloud.vmwareengine.v1.IUpdateDnsForwardingRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IUpdateDnsForwardingRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateDnsForwarding( - request: protos.google.cloud.vmwareengine.v1.IUpdateDnsForwardingRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateDnsForwardingRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateDnsForwarding( - request: protos.google.cloud.vmwareengine.v1.IUpdateDnsForwardingRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateDnsForwardingRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateDnsForwarding( - request?: protos.google.cloud.vmwareengine.v1.IUpdateDnsForwardingRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IUpdateDnsForwardingRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'dns_forwarding.name': request.dnsForwarding!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'dns_forwarding.name': request.dnsForwarding!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateDnsForwarding response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateDnsForwarding request %j', request); - return this.innerApiCalls.updateDnsForwarding(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateDnsForwarding response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateDnsForwarding(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateDnsForwarding response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateDnsForwarding()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_dns_forwarding.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateDnsForwarding_async - */ - async checkUpdateDnsForwardingProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateDnsForwarding()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_dns_forwarding.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateDnsForwarding_async + */ + async checkUpdateDnsForwardingProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.DnsForwarding, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('updateDnsForwarding long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDnsForwarding, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateDnsForwarding, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.DnsForwarding, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Creates a new network peering between the peer network and VMware Engine - * network provided in a `NetworkPeering` resource. NetworkPeering is a - * global resource and location can only be global. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to create the new network - * peering in. This value is always `global`, because `NetworkPeering` is a - * global resource. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/global` - * @param {string} request.networkPeeringId - * Required. The user-provided identifier of the new `NetworkPeering`. - * This identifier must be unique among `NetworkPeering` resources within the - * parent and becomes the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {google.cloud.vmwareengine.v1.NetworkPeering} request.networkPeering - * Required. The initial description of the new network peering. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_network_peering.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateNetworkPeering_async - */ + /** + * Creates a new network peering between the peer network and VMware Engine + * network provided in a `NetworkPeering` resource. NetworkPeering is a + * global resource and location can only be global. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to create the new network + * peering in. This value is always `global`, because `NetworkPeering` is a + * global resource. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @param {string} request.networkPeeringId + * Required. The user-provided identifier of the new `NetworkPeering`. + * This identifier must be unique among `NetworkPeering` resources within the + * parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {google.cloud.vmwareengine.v1.NetworkPeering} request.networkPeering + * Required. The initial description of the new network peering. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_network_peering.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateNetworkPeering_async + */ createNetworkPeering( - request?: protos.google.cloud.vmwareengine.v1.ICreateNetworkPeeringRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.ICreateNetworkPeeringRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createNetworkPeering( - request: protos.google.cloud.vmwareengine.v1.ICreateNetworkPeeringRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateNetworkPeeringRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createNetworkPeering( - request: protos.google.cloud.vmwareengine.v1.ICreateNetworkPeeringRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateNetworkPeeringRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createNetworkPeering( - request?: protos.google.cloud.vmwareengine.v1.ICreateNetworkPeeringRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.ICreateNetworkPeeringRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createNetworkPeering response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createNetworkPeering request %j', request); - return this.innerApiCalls.createNetworkPeering(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createNetworkPeering response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createNetworkPeering(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createNetworkPeering response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createNetworkPeering()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_network_peering.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateNetworkPeering_async - */ - async checkCreateNetworkPeeringProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createNetworkPeering()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_network_peering.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateNetworkPeering_async + */ + async checkCreateNetworkPeeringProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.NetworkPeering, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('createNetworkPeering long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createNetworkPeering, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createNetworkPeering, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.NetworkPeering, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Deletes a `NetworkPeering` resource. When a network peering is deleted for - * a VMware Engine network, the peer network becomes inaccessible to that - * VMware Engine network. NetworkPeering is a global resource and location can - * only be global. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the network peering to be deleted. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/global/networkPeerings/my-peering` - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_network_peering.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPeering_async - */ + /** + * Deletes a `NetworkPeering` resource. When a network peering is deleted for + * a VMware Engine network, the peer network becomes inaccessible to that + * VMware Engine network. NetworkPeering is a global resource and location can + * only be global. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the network peering to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_network_peering.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPeering_async + */ deleteNetworkPeering( - request?: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPeeringRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPeeringRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteNetworkPeering( - request: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPeeringRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPeeringRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteNetworkPeering( - request: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPeeringRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPeeringRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteNetworkPeering( - request?: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPeeringRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPeeringRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteNetworkPeering response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteNetworkPeering request %j', request); - return this.innerApiCalls.deleteNetworkPeering(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteNetworkPeering response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteNetworkPeering(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteNetworkPeering response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteNetworkPeering()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_network_peering.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPeering_async - */ - async checkDeleteNetworkPeeringProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteNetworkPeering()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_network_peering.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPeering_async + */ + async checkDeleteNetworkPeeringProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('deleteNetworkPeering long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteNetworkPeering, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteNetworkPeering, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Modifies a `NetworkPeering` resource. Only the `description` field can be - * updated. Only fields specified in `updateMask` are applied. NetworkPeering - * is a global resource and location can only be global. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.vmwareengine.v1.NetworkPeering} request.networkPeering - * Required. Network peering description. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `NetworkPeering` resource by the update. - * The fields specified in the `update_mask` are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_network_peering.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPeering_async - */ + /** + * Modifies a `NetworkPeering` resource. Only the `description` field can be + * updated. Only fields specified in `updateMask` are applied. NetworkPeering + * is a global resource and location can only be global. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vmwareengine.v1.NetworkPeering} request.networkPeering + * Required. Network peering description. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPeering` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_network_peering.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPeering_async + */ updateNetworkPeering( - request?: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPeeringRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPeeringRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateNetworkPeering( - request: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPeeringRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPeeringRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateNetworkPeering( - request: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPeeringRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPeeringRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateNetworkPeering( - request?: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPeeringRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPeeringRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'network_peering.name': request.networkPeering!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'network_peering.name': request.networkPeering!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateNetworkPeering response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateNetworkPeering request %j', request); - return this.innerApiCalls.updateNetworkPeering(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateNetworkPeering response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateNetworkPeering(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateNetworkPeering response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateNetworkPeering()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_network_peering.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPeering_async - */ - async checkUpdateNetworkPeeringProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateNetworkPeering()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_network_peering.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPeering_async + */ + async checkUpdateNetworkPeeringProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.NetworkPeering, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('updateNetworkPeering long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateNetworkPeering, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateNetworkPeering, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.NetworkPeering, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Creates a new HCX activation key in a given private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to create the key for. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud` - * @param {google.cloud.vmwareengine.v1.HcxActivationKey} request.hcxActivationKey - * Required. The initial description of a new HCX activation key. When - * creating a new key, this field must be an empty object. - * @param {string} request.hcxActivationKeyId - * Required. The user-provided identifier of the `HcxActivationKey` to be - * created. This identifier must be unique among `HcxActivationKey` resources - * within the parent and becomes the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {string} request.requestId - * A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_hcx_activation_key.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_async - */ + /** + * Creates a new HCX activation key in a given private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to create the key for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * @param {google.cloud.vmwareengine.v1.HcxActivationKey} request.hcxActivationKey + * Required. The initial description of a new HCX activation key. When + * creating a new key, this field must be an empty object. + * @param {string} request.hcxActivationKeyId + * Required. The user-provided identifier of the `HcxActivationKey` to be + * created. This identifier must be unique among `HcxActivationKey` resources + * within the parent and becomes the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {string} request.requestId + * A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_hcx_activation_key.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_async + */ createHcxActivationKey( - request?: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createHcxActivationKey( - request: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createHcxActivationKey( - request: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createHcxActivationKey( - request?: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.ICreateHcxActivationKeyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createHcxActivationKey response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createHcxActivationKey request %j', request); - return this.innerApiCalls.createHcxActivationKey(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createHcxActivationKey response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createHcxActivationKey(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createHcxActivationKey response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createHcxActivationKey()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_hcx_activation_key.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_async - */ - async checkCreateHcxActivationKeyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createHcxActivationKey()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_hcx_activation_key.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateHcxActivationKey_async + */ + async checkCreateHcxActivationKeyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.HcxActivationKey, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('createHcxActivationKey long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createHcxActivationKey, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createHcxActivationKey, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.HcxActivationKey, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Creates a new network policy in a given VMware Engine network of a - * project and location (region). A new network policy cannot be created if - * another network policy already exists in the same scope. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location (region) - * to create the new network policy in. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1` - * @param {string} request.networkPolicyId - * Required. The user-provided identifier of the network policy to be created. - * This identifier must be unique within parent - * `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes - * the final token in the name URI. - * The identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {google.cloud.vmwareengine.v1.NetworkPolicy} request.networkPolicy - * Required. The network policy configuration to use in the request. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_network_policy.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_async - */ + /** + * Creates a new network policy in a given VMware Engine network of a + * project and location (region). A new network policy cannot be created if + * another network policy already exists in the same scope. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location (region) + * to create the new network policy in. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1` + * @param {string} request.networkPolicyId + * Required. The user-provided identifier of the network policy to be created. + * This identifier must be unique within parent + * `projects/{my-project}/locations/{us-central1}/networkPolicies` and becomes + * the final token in the name URI. + * The identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {google.cloud.vmwareengine.v1.NetworkPolicy} request.networkPolicy + * Required. The network policy configuration to use in the request. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_network_policy.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_async + */ createNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.ICreateNetworkPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createNetworkPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createNetworkPolicy request %j', request); - return this.innerApiCalls.createNetworkPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createNetworkPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createNetworkPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createNetworkPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createNetworkPolicy()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_network_policy.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_async - */ - async checkCreateNetworkPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createNetworkPolicy()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_network_policy.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateNetworkPolicy_async + */ + async checkCreateNetworkPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.NetworkPolicy, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('createNetworkPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createNetworkPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createNetworkPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.NetworkPolicy, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Modifies a `NetworkPolicy` resource. Only the following fields can be - * updated: `internet_access`, `external_ip`, `edge_services_cidr`. - * Only fields specified in `updateMask` are applied. When updating a network - * policy, the external IP network service can only be disabled if there are - * no external IP addresses present in the scope of the policy. Also, a - * `NetworkService` cannot be updated when `NetworkService.state` is set - * to `RECONCILING`. - * - * During operation processing, the resource is temporarily in the `ACTIVE` - * state before the operation fully completes. For that period of time, you - * can't update the resource. Use the operation status to determine when the - * processing fully completes. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.vmwareengine.v1.NetworkPolicy} request.networkPolicy - * Required. Network policy description. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `NetworkPolicy` resource by the update. - * The fields specified in the `update_mask` are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_network_policy.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_async - */ + /** + * Modifies a `NetworkPolicy` resource. Only the following fields can be + * updated: `internet_access`, `external_ip`, `edge_services_cidr`. + * Only fields specified in `updateMask` are applied. When updating a network + * policy, the external IP network service can only be disabled if there are + * no external IP addresses present in the scope of the policy. Also, a + * `NetworkService` cannot be updated when `NetworkService.state` is set + * to `RECONCILING`. + * + * During operation processing, the resource is temporarily in the `ACTIVE` + * state before the operation fully completes. For that period of time, you + * can't update the resource. Use the operation status to determine when the + * processing fully completes. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vmwareengine.v1.NetworkPolicy} request.networkPolicy + * Required. Network policy description. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `NetworkPolicy` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_network_policy.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_async + */ updateNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IUpdateNetworkPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'network_policy.name': request.networkPolicy!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'network_policy.name': request.networkPolicy!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateNetworkPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateNetworkPolicy request %j', request); - return this.innerApiCalls.updateNetworkPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateNetworkPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateNetworkPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateNetworkPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateNetworkPolicy()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_network_policy.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_async - */ - async checkUpdateNetworkPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateNetworkPolicy()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_network_policy.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateNetworkPolicy_async + */ + async checkUpdateNetworkPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.NetworkPolicy, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('updateNetworkPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateNetworkPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateNetworkPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.NetworkPolicy, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Deletes a `NetworkPolicy` resource. A network policy cannot be deleted - * when `NetworkService.state` is set to `RECONCILING` for either its external - * IP or internet access service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the network policy to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_network_policy.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_async - */ + /** + * Deletes a `NetworkPolicy` resource. A network policy cannot be deleted + * when `NetworkService.state` is set to `RECONCILING` for either its external + * IP or internet access service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the network policy to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/networkPolicies/my-network-policy` + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_network_policy.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_async + */ deleteNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteNetworkPolicy( - request: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteNetworkPolicy( - request?: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IDeleteNetworkPolicyRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteNetworkPolicy response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteNetworkPolicy request %j', request); - return this.innerApiCalls.deleteNetworkPolicy(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteNetworkPolicy response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteNetworkPolicy(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteNetworkPolicy response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteNetworkPolicy()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_network_policy.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_async - */ - async checkDeleteNetworkPolicyProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteNetworkPolicy()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_network_policy.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteNetworkPolicy_async + */ + async checkDeleteNetworkPolicyProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('deleteNetworkPolicy long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteNetworkPolicy, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteNetworkPolicy, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Creates a new `ManagementDnsZoneBinding` resource in a private cloud. - * This RPC creates the DNS binding and the resource that represents the - * DNS binding of the consumer VPC network to the management DNS zone. A - * management DNS zone is the Cloud DNS cross-project binding zone that - * VMware Engine creates for each private cloud. It contains FQDNs and - * corresponding IP addresses for the private cloud's ESXi hosts and - * management VM appliances like vCenter and NSX Manager. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud - * to create a new management DNS zone binding for. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {google.cloud.vmwareengine.v1.ManagementDnsZoneBinding} request.managementDnsZoneBinding - * Required. The initial values for a new management DNS zone binding. - * @param {string} request.managementDnsZoneBindingId - * Required. The user-provided identifier of the `ManagementDnsZoneBinding` - * resource to be created. This identifier must be unique among - * `ManagementDnsZoneBinding` resources within the parent and becomes the - * final token in the name URI. The identifier must meet the following - * requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if the original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_management_dns_zone_binding.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateManagementDnsZoneBinding_async - */ + /** + * Creates a new `ManagementDnsZoneBinding` resource in a private cloud. + * This RPC creates the DNS binding and the resource that represents the + * DNS binding of the consumer VPC network to the management DNS zone. A + * management DNS zone is the Cloud DNS cross-project binding zone that + * VMware Engine creates for each private cloud. It contains FQDNs and + * corresponding IP addresses for the private cloud's ESXi hosts and + * management VM appliances like vCenter and NSX Manager. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud + * to create a new management DNS zone binding for. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {google.cloud.vmwareengine.v1.ManagementDnsZoneBinding} request.managementDnsZoneBinding + * Required. The initial values for a new management DNS zone binding. + * @param {string} request.managementDnsZoneBindingId + * Required. The user-provided identifier of the `ManagementDnsZoneBinding` + * resource to be created. This identifier must be unique among + * `ManagementDnsZoneBinding` resources within the parent and becomes the + * final token in the name URI. The identifier must meet the following + * requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_management_dns_zone_binding.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateManagementDnsZoneBinding_async + */ createManagementDnsZoneBinding( - request?: protos.google.cloud.vmwareengine.v1.ICreateManagementDnsZoneBindingRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.ICreateManagementDnsZoneBindingRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createManagementDnsZoneBinding( - request: protos.google.cloud.vmwareengine.v1.ICreateManagementDnsZoneBindingRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateManagementDnsZoneBindingRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createManagementDnsZoneBinding( - request: protos.google.cloud.vmwareengine.v1.ICreateManagementDnsZoneBindingRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateManagementDnsZoneBindingRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createManagementDnsZoneBinding( - request?: protos.google.cloud.vmwareengine.v1.ICreateManagementDnsZoneBindingRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.ICreateManagementDnsZoneBindingRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('createManagementDnsZoneBinding response %j', rawResponse); + this._log.info( + 'createManagementDnsZoneBinding response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createManagementDnsZoneBinding request %j', request); - return this.innerApiCalls.createManagementDnsZoneBinding(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createManagementDnsZoneBinding response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createManagementDnsZoneBinding(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'createManagementDnsZoneBinding response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createManagementDnsZoneBinding()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_management_dns_zone_binding.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateManagementDnsZoneBinding_async - */ - async checkCreateManagementDnsZoneBindingProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createManagementDnsZoneBinding()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_management_dns_zone_binding.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateManagementDnsZoneBinding_async + */ + async checkCreateManagementDnsZoneBindingProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('createManagementDnsZoneBinding long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createManagementDnsZoneBinding, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createManagementDnsZoneBinding, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Updates a `ManagementDnsZoneBinding` resource. - * Only fields specified in `update_mask` are applied. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `ManagementDnsZoneBinding` resource by the update. - * The fields specified in the `update_mask` are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.vmwareengine.v1.ManagementDnsZoneBinding} request.managementDnsZoneBinding - * Required. New values to update the management DNS zone binding with. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if the original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_management_dns_zone_binding.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateManagementDnsZoneBinding_async - */ + /** + * Updates a `ManagementDnsZoneBinding` resource. + * Only fields specified in `update_mask` are applied. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `ManagementDnsZoneBinding` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.vmwareengine.v1.ManagementDnsZoneBinding} request.managementDnsZoneBinding + * Required. New values to update the management DNS zone binding with. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_management_dns_zone_binding.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateManagementDnsZoneBinding_async + */ updateManagementDnsZoneBinding( - request?: protos.google.cloud.vmwareengine.v1.IUpdateManagementDnsZoneBindingRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IUpdateManagementDnsZoneBindingRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateManagementDnsZoneBinding( - request: protos.google.cloud.vmwareengine.v1.IUpdateManagementDnsZoneBindingRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateManagementDnsZoneBindingRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateManagementDnsZoneBinding( - request: protos.google.cloud.vmwareengine.v1.IUpdateManagementDnsZoneBindingRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateManagementDnsZoneBindingRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateManagementDnsZoneBinding( - request?: protos.google.cloud.vmwareengine.v1.IUpdateManagementDnsZoneBindingRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IUpdateManagementDnsZoneBindingRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'management_dns_zone_binding.name': request.managementDnsZoneBinding!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'management_dns_zone_binding.name': + request.managementDnsZoneBinding!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('updateManagementDnsZoneBinding response %j', rawResponse); + this._log.info( + 'updateManagementDnsZoneBinding response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateManagementDnsZoneBinding request %j', request); - return this.innerApiCalls.updateManagementDnsZoneBinding(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateManagementDnsZoneBinding response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateManagementDnsZoneBinding(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'updateManagementDnsZoneBinding response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateManagementDnsZoneBinding()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_management_dns_zone_binding.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateManagementDnsZoneBinding_async - */ - async checkUpdateManagementDnsZoneBindingProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateManagementDnsZoneBinding()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_management_dns_zone_binding.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateManagementDnsZoneBinding_async + */ + async checkUpdateManagementDnsZoneBindingProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('updateManagementDnsZoneBinding long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateManagementDnsZoneBinding, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateManagementDnsZoneBinding, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Deletes a `ManagementDnsZoneBinding` resource. When a management DNS zone - * binding is deleted, the corresponding consumer VPC network is no longer - * bound to the management DNS zone. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the management DNS zone binding to delete. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if the original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_management_dns_zone_binding.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteManagementDnsZoneBinding_async - */ + /** + * Deletes a `ManagementDnsZoneBinding` resource. When a management DNS zone + * binding is deleted, the corresponding consumer VPC network is no longer + * bound to the management DNS zone. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the management DNS zone binding to delete. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if the original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_management_dns_zone_binding.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteManagementDnsZoneBinding_async + */ deleteManagementDnsZoneBinding( - request?: protos.google.cloud.vmwareengine.v1.IDeleteManagementDnsZoneBindingRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IDeleteManagementDnsZoneBindingRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteManagementDnsZoneBinding( - request: protos.google.cloud.vmwareengine.v1.IDeleteManagementDnsZoneBindingRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteManagementDnsZoneBindingRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteManagementDnsZoneBinding( - request: protos.google.cloud.vmwareengine.v1.IDeleteManagementDnsZoneBindingRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteManagementDnsZoneBindingRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteManagementDnsZoneBinding( - request?: protos.google.cloud.vmwareengine.v1.IDeleteManagementDnsZoneBindingRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IDeleteManagementDnsZoneBindingRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('deleteManagementDnsZoneBinding response %j', rawResponse); + this._log.info( + 'deleteManagementDnsZoneBinding response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteManagementDnsZoneBinding request %j', request); - return this.innerApiCalls.deleteManagementDnsZoneBinding(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteManagementDnsZoneBinding response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteManagementDnsZoneBinding(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'deleteManagementDnsZoneBinding response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteManagementDnsZoneBinding()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_management_dns_zone_binding.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteManagementDnsZoneBinding_async - */ - async checkDeleteManagementDnsZoneBindingProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteManagementDnsZoneBinding()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_management_dns_zone_binding.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteManagementDnsZoneBinding_async + */ + async checkDeleteManagementDnsZoneBindingProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('deleteManagementDnsZoneBinding long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteManagementDnsZoneBinding, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteManagementDnsZoneBinding, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Retries to create a `ManagementDnsZoneBinding` resource that is - * in failed state. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the management DNS zone binding to repair. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if the original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.repair_management_dns_zone_binding.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_RepairManagementDnsZoneBinding_async - */ + /** + * Retries to create a `ManagementDnsZoneBinding` resource that is + * in failed state. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the management DNS zone binding to repair. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/managementDnsZoneBindings/my-management-dns-zone-binding` + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if the original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.repair_management_dns_zone_binding.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_RepairManagementDnsZoneBinding_async + */ repairManagementDnsZoneBinding( - request?: protos.google.cloud.vmwareengine.v1.IRepairManagementDnsZoneBindingRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IRepairManagementDnsZoneBindingRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; repairManagementDnsZoneBinding( - request: protos.google.cloud.vmwareengine.v1.IRepairManagementDnsZoneBindingRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IRepairManagementDnsZoneBindingRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; repairManagementDnsZoneBinding( - request: protos.google.cloud.vmwareengine.v1.IRepairManagementDnsZoneBindingRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IRepairManagementDnsZoneBindingRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; repairManagementDnsZoneBinding( - request?: protos.google.cloud.vmwareengine.v1.IRepairManagementDnsZoneBindingRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IRepairManagementDnsZoneBindingRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { - this._log.info('repairManagementDnsZoneBinding response %j', rawResponse); + this._log.info( + 'repairManagementDnsZoneBinding response %j', + rawResponse, + ); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('repairManagementDnsZoneBinding request %j', request); - return this.innerApiCalls.repairManagementDnsZoneBinding(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('repairManagementDnsZoneBinding response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .repairManagementDnsZoneBinding(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info( + 'repairManagementDnsZoneBinding response %j', + rawResponse, + ); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `repairManagementDnsZoneBinding()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.repair_management_dns_zone_binding.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_RepairManagementDnsZoneBinding_async - */ - async checkRepairManagementDnsZoneBindingProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `repairManagementDnsZoneBinding()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.repair_management_dns_zone_binding.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_RepairManagementDnsZoneBinding_async + */ + async checkRepairManagementDnsZoneBindingProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('repairManagementDnsZoneBinding long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.repairManagementDnsZoneBinding, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.repairManagementDnsZoneBinding, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Creates a new VMware Engine network that can be used by a private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to create the new VMware Engine - * network in. A VMware Engine network of type - * `LEGACY` is a regional resource, and a VMware - * Engine network of type `STANDARD` is a global resource. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/global` - * @param {string} request.vmwareEngineNetworkId - * Required. The user-provided identifier of the new VMware Engine network. - * This identifier must be unique among VMware Engine network resources - * within the parent and becomes the final token in the name URI. The - * identifier must meet the following requirements: - * - * * For networks of type LEGACY, adheres to the format: - * `{region-id}-default`. Replace `{region-id}` with the region where you want - * to create the VMware Engine network. For example, "us-central1-default". - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {google.cloud.vmwareengine.v1.VmwareEngineNetwork} request.vmwareEngineNetwork - * Required. The initial description of the new VMware Engine network. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_vmware_engine_network.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_async - */ + /** + * Creates a new VMware Engine network that can be used by a private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to create the new VMware Engine + * network in. A VMware Engine network of type + * `LEGACY` is a regional resource, and a VMware + * Engine network of type `STANDARD` is a global resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global` + * @param {string} request.vmwareEngineNetworkId + * Required. The user-provided identifier of the new VMware Engine network. + * This identifier must be unique among VMware Engine network resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * + * * For networks of type LEGACY, adheres to the format: + * `{region-id}-default`. Replace `{region-id}` with the region where you want + * to create the VMware Engine network. For example, "us-central1-default". + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {google.cloud.vmwareengine.v1.VmwareEngineNetwork} request.vmwareEngineNetwork + * Required. The initial description of the new VMware Engine network. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_vmware_engine_network.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_async + */ createVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.ICreateVmwareEngineNetworkRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createVmwareEngineNetwork response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createVmwareEngineNetwork request %j', request); - return this.innerApiCalls.createVmwareEngineNetwork(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createVmwareEngineNetwork response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createVmwareEngineNetwork(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createVmwareEngineNetwork response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createVmwareEngineNetwork()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_vmware_engine_network.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_async - */ - async checkCreateVmwareEngineNetworkProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createVmwareEngineNetwork()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_vmware_engine_network.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreateVmwareEngineNetwork_async + */ + async checkCreateVmwareEngineNetworkProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('createVmwareEngineNetwork long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createVmwareEngineNetwork, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createVmwareEngineNetwork, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Modifies a VMware Engine network resource. Only the following fields can be - * updated: `description`. Only fields specified in `updateMask` are - * applied. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.vmwareengine.v1.VmwareEngineNetwork} request.vmwareEngineNetwork - * Required. VMware Engine network description. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * VMware Engine network resource by the update. - * The fields specified in the `update_mask` are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. Only the - * following fields can be updated: `description`. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_vmware_engine_network.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_async - */ + /** + * Modifies a VMware Engine network resource. Only the following fields can be + * updated: `description`. Only fields specified in `updateMask` are + * applied. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vmwareengine.v1.VmwareEngineNetwork} request.vmwareEngineNetwork + * Required. VMware Engine network description. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * VMware Engine network resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. Only the + * following fields can be updated: `description`. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_vmware_engine_network.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_async + */ updateVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IUpdateVmwareEngineNetworkRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'vmware_engine_network.name': request.vmwareEngineNetwork!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'vmware_engine_network.name': request.vmwareEngineNetwork!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateVmwareEngineNetwork response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateVmwareEngineNetwork request %j', request); - return this.innerApiCalls.updateVmwareEngineNetwork(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateVmwareEngineNetwork response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateVmwareEngineNetwork(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateVmwareEngineNetwork response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateVmwareEngineNetwork()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_vmware_engine_network.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_async - */ - async checkUpdateVmwareEngineNetworkProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateVmwareEngineNetwork()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_vmware_engine_network.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdateVmwareEngineNetwork_async + */ + async checkUpdateVmwareEngineNetworkProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('updateVmwareEngineNetwork long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateVmwareEngineNetwork, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateVmwareEngineNetwork, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Deletes a `VmwareEngineNetwork` resource. You can only delete a VMware - * Engine network after all resources that refer to it are deleted. For - * example, a private cloud, a network peering, and a network policy can all - * refer to the same VMware Engine network. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the VMware Engine network to be deleted. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {string} [request.etag] - * Optional. Checksum used to ensure that the user-provided value is up to - * date before the server processes the request. The server compares provided - * checksum with the current checksum of the resource. If the user-provided - * value is out of date, this request returns an `ABORTED` error. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_vmware_engine_network.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_async - */ + /** + * Deletes a `VmwareEngineNetwork` resource. You can only delete a VMware + * Engine network after all resources that refer to it are deleted. For + * example, a private cloud, a network peering, and a network policy can all + * refer to the same VMware Engine network. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the VMware Engine network to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/global/vmwareEngineNetworks/my-network` + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {string} [request.etag] + * Optional. Checksum used to ensure that the user-provided value is up to + * date before the server processes the request. The server compares provided + * checksum with the current checksum of the resource. If the user-provided + * value is out of date, this request returns an `ABORTED` error. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_vmware_engine_network.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_async + */ deleteVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteVmwareEngineNetwork( - request: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteVmwareEngineNetwork( - request?: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IDeleteVmwareEngineNetworkRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteVmwareEngineNetwork response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteVmwareEngineNetwork request %j', request); - return this.innerApiCalls.deleteVmwareEngineNetwork(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteVmwareEngineNetwork response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteVmwareEngineNetwork(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteVmwareEngineNetwork response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteVmwareEngineNetwork()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_vmware_engine_network.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_async - */ - async checkDeleteVmwareEngineNetworkProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteVmwareEngineNetwork()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_vmware_engine_network.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeleteVmwareEngineNetwork_async + */ + async checkDeleteVmwareEngineNetworkProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('deleteVmwareEngineNetwork long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteVmwareEngineNetwork, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteVmwareEngineNetwork, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Creates a new private connection that can be used for accessing private - * Clouds. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to create the new private - * connection in. Private connection is a regional resource. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/us-central1` - * @param {string} request.privateConnectionId - * Required. The user-provided identifier of the new private connection. - * This identifier must be unique among private connection resources - * within the parent and becomes the final token in the name URI. The - * identifier must meet the following requirements: - * - * * Only contains 1-63 alphanumeric characters and hyphens - * * Begins with an alphabetical character - * * Ends with a non-hyphen character - * * Not formatted as a UUID - * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) - * (section 3.5) - * @param {google.cloud.vmwareengine.v1.PrivateConnection} request.privateConnection - * Required. The initial description of the new private connection. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_private_connection.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_async - */ + /** + * Creates a new private connection that can be used for accessing private + * Clouds. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to create the new private + * connection in. Private connection is a regional resource. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-central1` + * @param {string} request.privateConnectionId + * Required. The user-provided identifier of the new private connection. + * This identifier must be unique among private connection resources + * within the parent and becomes the final token in the name URI. The + * identifier must meet the following requirements: + * + * * Only contains 1-63 alphanumeric characters and hyphens + * * Begins with an alphabetical character + * * Ends with a non-hyphen character + * * Not formatted as a UUID + * * Complies with [RFC 1034](https://datatracker.ietf.org/doc/html/rfc1034) + * (section 3.5) + * @param {google.cloud.vmwareengine.v1.PrivateConnection} request.privateConnection + * Required. The initial description of the new private connection. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_private_connection.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_async + */ createPrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createPrivateConnection( - request: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createPrivateConnection( - request: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createPrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.ICreatePrivateConnectionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createPrivateConnection response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createPrivateConnection request %j', request); - return this.innerApiCalls.createPrivateConnection(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createPrivateConnection response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createPrivateConnection(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createPrivateConnection response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createPrivateConnection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.create_private_connection.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_async - */ - async checkCreatePrivateConnectionProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createPrivateConnection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.create_private_connection.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_CreatePrivateConnection_async + */ + async checkCreatePrivateConnectionProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.PrivateConnection, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('createPrivateConnection long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createPrivateConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createPrivateConnection, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.PrivateConnection, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Modifies a `PrivateConnection` resource. Only `description` and - * `routing_mode` fields can be updated. Only fields specified in `updateMask` - * are applied. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.vmwareengine.v1.PrivateConnection} request.privateConnection - * Required. Private connection description. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * `PrivateConnection` resource by the update. - * The fields specified in the `update_mask` are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_private_connection.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_async - */ + /** + * Modifies a `PrivateConnection` resource. Only `description` and + * `routing_mode` fields can be updated. Only fields specified in `updateMask` + * are applied. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vmwareengine.v1.PrivateConnection} request.privateConnection + * Required. Private connection description. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * `PrivateConnection` resource by the update. + * The fields specified in the `update_mask` are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_private_connection.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_async + */ updatePrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updatePrivateConnection( - request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updatePrivateConnection( - request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updatePrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IUpdatePrivateConnectionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'private_connection.name': request.privateConnection!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'private_connection.name': request.privateConnection!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updatePrivateConnection response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updatePrivateConnection request %j', request); - return this.innerApiCalls.updatePrivateConnection(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updatePrivateConnection response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updatePrivateConnection(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updatePrivateConnection response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updatePrivateConnection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.update_private_connection.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_async - */ - async checkUpdatePrivateConnectionProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updatePrivateConnection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.update_private_connection.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_UpdatePrivateConnection_async + */ + async checkUpdatePrivateConnectionProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.PrivateConnection, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('updatePrivateConnection long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updatePrivateConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updatePrivateConnection, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.PrivateConnection, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Deletes a `PrivateConnection` resource. When a private connection is - * deleted for a VMware Engine network, the connected network becomes - * inaccessible to that VMware Engine network. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the private connection to be deleted. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateConnections/my-connection` - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_private_connection.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_async - */ + /** + * Deletes a `PrivateConnection` resource. When a private connection is + * deleted for a VMware Engine network, the connected network becomes + * inaccessible to that VMware Engine network. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the private connection to be deleted. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateConnections/my-connection` + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_private_connection.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_async + */ deletePrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deletePrivateConnection( - request: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deletePrivateConnection( - request: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deletePrivateConnection( - request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IDeletePrivateConnectionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deletePrivateConnection response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deletePrivateConnection request %j', request); - return this.innerApiCalls.deletePrivateConnection(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deletePrivateConnection response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deletePrivateConnection(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deletePrivateConnection response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deletePrivateConnection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.delete_private_connection.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_async - */ - async checkDeletePrivateConnectionProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deletePrivateConnection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.delete_private_connection.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_DeletePrivateConnection_async + */ + async checkDeletePrivateConnectionProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('deletePrivateConnection long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePrivateConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deletePrivateConnection, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Grants the bind permission to the customer provided principal(user / - * service account) to bind their DNS zone with the intranet VPC associated - * with the project. DnsBindPermission is a global resource and location can - * only be global. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the resource which stores the users/service accounts - * having the permission to bind to the corresponding intranet VPC of the - * consumer project. DnsBindPermission is a global resource. Resource names - * are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/global/dnsBindPermission` - * @param {google.cloud.vmwareengine.v1.Principal} request.principal - * Required. The consumer provided user/service account which needs to be - * granted permission to bind with the intranet VPC corresponding to the - * consumer project. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.grant_dns_bind_permission.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GrantDnsBindPermission_async - */ + /** + * Grants the bind permission to the customer provided principal(user / + * service account) to bind their DNS zone with the intranet VPC associated + * with the project. DnsBindPermission is a global resource and location can + * only be global. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * @param {google.cloud.vmwareengine.v1.Principal} request.principal + * Required. The consumer provided user/service account which needs to be + * granted permission to bind with the intranet VPC corresponding to the + * consumer project. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.grant_dns_bind_permission.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GrantDnsBindPermission_async + */ grantDnsBindPermission( - request?: protos.google.cloud.vmwareengine.v1.IGrantDnsBindPermissionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IGrantDnsBindPermissionRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; grantDnsBindPermission( - request: protos.google.cloud.vmwareengine.v1.IGrantDnsBindPermissionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGrantDnsBindPermissionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; grantDnsBindPermission( - request: protos.google.cloud.vmwareengine.v1.IGrantDnsBindPermissionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IGrantDnsBindPermissionRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; grantDnsBindPermission( - request?: protos.google.cloud.vmwareengine.v1.IGrantDnsBindPermissionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IGrantDnsBindPermissionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('grantDnsBindPermission response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('grantDnsBindPermission request %j', request); - return this.innerApiCalls.grantDnsBindPermission(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('grantDnsBindPermission response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .grantDnsBindPermission(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('grantDnsBindPermission response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `grantDnsBindPermission()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.grant_dns_bind_permission.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_GrantDnsBindPermission_async - */ - async checkGrantDnsBindPermissionProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `grantDnsBindPermission()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.grant_dns_bind_permission.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_GrantDnsBindPermission_async + */ + async checkGrantDnsBindPermissionProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.DnsBindPermission, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('grantDnsBindPermission long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.grantDnsBindPermission, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.grantDnsBindPermission, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.DnsBindPermission, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; } -/** - * Revokes the bind permission from the customer provided principal(user / - * service account) on the intranet VPC associated with the consumer project. - * DnsBindPermission is a global resource and location can only be global. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the resource which stores the users/service accounts - * having the permission to bind to the corresponding intranet VPC of the - * consumer project. DnsBindPermission is a global resource. Resource names - * are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/global/dnsBindPermission` - * @param {google.cloud.vmwareengine.v1.Principal} request.principal - * Required. The consumer provided user/service account which needs to be - * granted permission to bind with the intranet VPC corresponding to the - * consumer project. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server guarantees that a - * request doesn't result in creation of duplicate commitments for at least 60 - * minutes. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.revoke_dns_bind_permission.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_RevokeDnsBindPermission_async - */ + /** + * Revokes the bind permission from the customer provided principal(user / + * service account) on the intranet VPC associated with the consumer project. + * DnsBindPermission is a global resource and location can only be global. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the resource which stores the users/service accounts + * having the permission to bind to the corresponding intranet VPC of the + * consumer project. DnsBindPermission is a global resource. Resource names + * are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/dnsBindPermission` + * @param {google.cloud.vmwareengine.v1.Principal} request.principal + * Required. The consumer provided user/service account which needs to be + * granted permission to bind with the intranet VPC corresponding to the + * consumer project. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server guarantees that a + * request doesn't result in creation of duplicate commitments for at least 60 + * minutes. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.revoke_dns_bind_permission.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_RevokeDnsBindPermission_async + */ revokeDnsBindPermission( - request?: protos.google.cloud.vmwareengine.v1.IRevokeDnsBindPermissionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vmwareengine.v1.IRevokeDnsBindPermissionRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; revokeDnsBindPermission( - request: protos.google.cloud.vmwareengine.v1.IRevokeDnsBindPermissionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IRevokeDnsBindPermissionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; revokeDnsBindPermission( - request: protos.google.cloud.vmwareengine.v1.IRevokeDnsBindPermissionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vmwareengine.v1.IRevokeDnsBindPermissionRequest, + callback: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; revokeDnsBindPermission( - request?: protos.google.cloud.vmwareengine.v1.IRevokeDnsBindPermissionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vmwareengine.v1.IRevokeDnsBindPermissionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('revokeDnsBindPermission response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('revokeDnsBindPermission request %j', request); - return this.innerApiCalls.revokeDnsBindPermission(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('revokeDnsBindPermission response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .revokeDnsBindPermission(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('revokeDnsBindPermission response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `revokeDnsBindPermission()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.revoke_dns_bind_permission.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_RevokeDnsBindPermission_async - */ - async checkRevokeDnsBindPermissionProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `revokeDnsBindPermission()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.revoke_dns_bind_permission.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_RevokeDnsBindPermission_async + */ + async checkRevokeDnsBindPermissionProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vmwareengine.v1.DnsBindPermission, + protos.google.cloud.vmwareengine.v1.OperationMetadata + > + > { this._log.info('revokeDnsBindPermission long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.revokeDnsBindPermission, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists `PrivateCloud` resources in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * clusters. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param {number} request.pageSize - * The maximum number of private clouds to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateClouds` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListPrivateClouds` must - * match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison operator, and the - * value that you want to use for filtering. The value must be a string, a - * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or - * `<`. - * - * For example, if you are filtering a list of private clouds, you can exclude - * the ones named `example-pc` by specifying `name != "example-pc"`. - * - * You can also filter nested fields. For example, you could specify - * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds - * only if they have a matching address in their network configuration. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-pc") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "private-cloud-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "private-cloud-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.PrivateCloud|PrivateCloud}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listPrivateCloudsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.revokeDnsBindPermission, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vmwareengine.v1.DnsBindPermission, + protos.google.cloud.vmwareengine.v1.OperationMetadata + >; + } + /** + * Lists `PrivateCloud` resources in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * clusters. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param {number} request.pageSize + * The maximum number of private clouds to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateClouds` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListPrivateClouds` must + * match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison operator, and the + * value that you want to use for filtering. The value must be a string, a + * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or + * `<`. + * + * For example, if you are filtering a list of private clouds, you can exclude + * the ones named `example-pc` by specifying `name != "example-pc"`. + * + * You can also filter nested fields. For example, you could specify + * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds + * only if they have a matching address in their network configuration. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-pc") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "private-cloud-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "private-cloud-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.PrivateCloud|PrivateCloud}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listPrivateCloudsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listPrivateClouds( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateCloud[], - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IPrivateCloud[], + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest | null, + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse, + ] + >; listPrivateClouds( - request: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateCloud>): void; + request: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + | protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPrivateCloud + >, + ): void; listPrivateClouds( - request: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateCloud>): void; + request: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + | protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPrivateCloud + >, + ): void; listPrivateClouds( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateCloud>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateCloud>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateCloud[], - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPrivateCloud + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + | protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPrivateCloud + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IPrivateCloud[], + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest | null, + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateCloud>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + | protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPrivateCloud + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listPrivateClouds values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -7847,309 +11547,338 @@ export class VmwareEngineClient { this._log.info('listPrivateClouds request %j', request); return this.innerApiCalls .listPrivateClouds(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.IPrivateCloud[], - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse - ]) => { - this._log.info('listPrivateClouds values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.IPrivateCloud[], + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest | null, + protos.google.cloud.vmwareengine.v1.IListPrivateCloudsResponse, + ]) => { + this._log.info('listPrivateClouds values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listPrivateClouds`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * clusters. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param {number} request.pageSize - * The maximum number of private clouds to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateClouds` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListPrivateClouds` must - * match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison operator, and the - * value that you want to use for filtering. The value must be a string, a - * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or - * `<`. - * - * For example, if you are filtering a list of private clouds, you can exclude - * the ones named `example-pc` by specifying `name != "example-pc"`. - * - * You can also filter nested fields. For example, you could specify - * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds - * only if they have a matching address in their network configuration. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-pc") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "private-cloud-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "private-cloud-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.PrivateCloud|PrivateCloud} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listPrivateCloudsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listPrivateClouds`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * clusters. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param {number} request.pageSize + * The maximum number of private clouds to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateClouds` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListPrivateClouds` must + * match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison operator, and the + * value that you want to use for filtering. The value must be a string, a + * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or + * `<`. + * + * For example, if you are filtering a list of private clouds, you can exclude + * the ones named `example-pc` by specifying `name != "example-pc"`. + * + * You can also filter nested fields. For example, you could specify + * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds + * only if they have a matching address in their network configuration. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-pc") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "private-cloud-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "private-cloud-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.PrivateCloud|PrivateCloud} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listPrivateCloudsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listPrivateCloudsStream( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listPrivateClouds']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listPrivateClouds stream %j', request); return this.descriptors.page.listPrivateClouds.createStream( this.innerApiCalls.listPrivateClouds as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listPrivateClouds`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * clusters. Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param {number} request.pageSize - * The maximum number of private clouds to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateClouds` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListPrivateClouds` must - * match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison operator, and the - * value that you want to use for filtering. The value must be a string, a - * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or - * `<`. - * - * For example, if you are filtering a list of private clouds, you can exclude - * the ones named `example-pc` by specifying `name != "example-pc"`. - * - * You can also filter nested fields. For example, you could specify - * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds - * only if they have a matching address in their network configuration. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-pc") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "private-cloud-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "private-cloud-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.PrivateCloud|PrivateCloud}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_private_clouds.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListPrivateClouds_async - */ + /** + * Equivalent to `listPrivateClouds`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * clusters. Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param {number} request.pageSize + * The maximum number of private clouds to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateClouds` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListPrivateClouds` must + * match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison operator, and the + * value that you want to use for filtering. The value must be a string, a + * number, or a boolean. The comparison operator must be `=`, `!=`, `>`, or + * `<`. + * + * For example, if you are filtering a list of private clouds, you can exclude + * the ones named `example-pc` by specifying `name != "example-pc"`. + * + * You can also filter nested fields. For example, you could specify + * `networkConfig.managementCidr = "192.168.0.0/24"` to include private clouds + * only if they have a matching address in their network configuration. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-pc") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "private-cloud-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "private-cloud-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.PrivateCloud|PrivateCloud}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_private_clouds.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListPrivateClouds_async + */ listPrivateCloudsAsync( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListPrivateCloudsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listPrivateClouds']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listPrivateClouds iterate %j', request); return this.descriptors.page.listPrivateClouds.asyncIterate( this.innerApiCalls['listPrivateClouds'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists `Cluster` resources in a given private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to query for clusters. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of clusters to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListClusters` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListClusters` - * must match the call that provided the page token. - * @param {string} request.filter - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-cluster") - * (nodeCount = "3") - * ``` - * - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "example-cluster-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-cluster-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.Cluster|Cluster}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists `Cluster` resources in a given private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to query for clusters. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of clusters to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListClusters` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListClusters` + * must match the call that provided the page token. + * @param {string} request.filter + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-cluster") + * (nodeCount = "3") + * ``` + * + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "example-cluster-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-cluster-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.Cluster|Cluster}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listClusters( - request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICluster[], - protos.google.cloud.vmwareengine.v1.IListClustersRequest|null, - protos.google.cloud.vmwareengine.v1.IListClustersResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ICluster[], + protos.google.cloud.vmwareengine.v1.IListClustersRequest | null, + protos.google.cloud.vmwareengine.v1.IListClustersResponse, + ] + >; listClusters( - request: protos.google.cloud.vmwareengine.v1.IListClustersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListClustersRequest, - protos.google.cloud.vmwareengine.v1.IListClustersResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ICluster>): void; + request: protos.google.cloud.vmwareengine.v1.IListClustersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListClustersRequest, + | protos.google.cloud.vmwareengine.v1.IListClustersResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ICluster + >, + ): void; listClusters( - request: protos.google.cloud.vmwareengine.v1.IListClustersRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListClustersRequest, - protos.google.cloud.vmwareengine.v1.IListClustersResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ICluster>): void; + request: protos.google.cloud.vmwareengine.v1.IListClustersRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListClustersRequest, + | protos.google.cloud.vmwareengine.v1.IListClustersResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ICluster + >, + ): void; listClusters( - request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListClustersRequest, - protos.google.cloud.vmwareengine.v1.IListClustersResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ICluster>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListClustersRequest, - protos.google.cloud.vmwareengine.v1.IListClustersResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ICluster>): - Promise<[ - protos.google.cloud.vmwareengine.v1.ICluster[], - protos.google.cloud.vmwareengine.v1.IListClustersRequest|null, - protos.google.cloud.vmwareengine.v1.IListClustersResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListClustersResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ICluster + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListClustersRequest, + | protos.google.cloud.vmwareengine.v1.IListClustersResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ICluster + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ICluster[], + protos.google.cloud.vmwareengine.v1.IListClustersRequest | null, + protos.google.cloud.vmwareengine.v1.IListClustersResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListClustersRequest, - protos.google.cloud.vmwareengine.v1.IListClustersResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ICluster>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListClustersRequest, + | protos.google.cloud.vmwareengine.v1.IListClustersResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ICluster + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listClusters values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -8158,265 +11887,288 @@ export class VmwareEngineClient { this._log.info('listClusters request %j', request); return this.innerApiCalls .listClusters(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.ICluster[], - protos.google.cloud.vmwareengine.v1.IListClustersRequest|null, - protos.google.cloud.vmwareengine.v1.IListClustersResponse - ]) => { - this._log.info('listClusters values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.ICluster[], + protos.google.cloud.vmwareengine.v1.IListClustersRequest | null, + protos.google.cloud.vmwareengine.v1.IListClustersResponse, + ]) => { + this._log.info('listClusters values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listClusters`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to query for clusters. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of clusters to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListClusters` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListClusters` - * must match the call that provided the page token. - * @param {string} request.filter - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-cluster") - * (nodeCount = "3") - * ``` - * - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "example-cluster-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-cluster-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.Cluster|Cluster} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listClustersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listClusters`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to query for clusters. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of clusters to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListClusters` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListClusters` + * must match the call that provided the page token. + * @param {string} request.filter + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-cluster") + * (nodeCount = "3") + * ``` + * + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "example-cluster-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-cluster-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.Cluster|Cluster} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listClustersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listClustersStream( - request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listClusters']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listClusters stream %j', request); return this.descriptors.page.listClusters.createStream( this.innerApiCalls.listClusters as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listClusters`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to query for clusters. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of clusters to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListClusters` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListClusters` - * must match the call that provided the page token. - * @param {string} request.filter - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-cluster") - * (nodeCount = "3") - * ``` - * - * By default, each expression is an `AND` expression. However, you can - * include `AND` and `OR` expressions explicitly. For example: - * ``` - * (name = "example-cluster-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-cluster-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results are - * ordered by `name` in ascending order. You can also sort results in - * descending order based on the `name` value using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.Cluster|Cluster}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_clusters.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListClusters_async - */ + /** + * Equivalent to `listClusters`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to query for clusters. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of clusters to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListClusters` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListClusters` + * must match the call that provided the page token. + * @param {string} request.filter + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-cluster") + * (nodeCount = "3") + * ``` + * + * By default, each expression is an `AND` expression. However, you can + * include `AND` and `OR` expressions explicitly. For example: + * ``` + * (name = "example-cluster-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-cluster-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results are + * ordered by `name` in ascending order. You can also sort results in + * descending order based on the `name` value using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.Cluster|Cluster}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_clusters.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListClusters_async + */ listClustersAsync( - request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListClustersRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listClusters']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listClusters iterate %j', request); return this.descriptors.page.listClusters.asyncIterate( this.innerApiCalls['listClusters'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists nodes in a given cluster. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the cluster to be queried for nodes. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` - * @param {number} request.pageSize - * The maximum number of nodes to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNodes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNodes` must match the call that provided the page - * token. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.Node|Node}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listNodesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists nodes in a given cluster. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the cluster to be queried for nodes. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * @param {number} request.pageSize + * The maximum number of nodes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNodes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNodes` must match the call that provided the page + * token. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.Node|Node}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listNodesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listNodes( - request?: protos.google.cloud.vmwareengine.v1.IListNodesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.INode[], - protos.google.cloud.vmwareengine.v1.IListNodesRequest|null, - protos.google.cloud.vmwareengine.v1.IListNodesResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListNodesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INode[], + protos.google.cloud.vmwareengine.v1.IListNodesRequest | null, + protos.google.cloud.vmwareengine.v1.IListNodesResponse, + ] + >; listNodes( - request: protos.google.cloud.vmwareengine.v1.IListNodesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNodesRequest, - protos.google.cloud.vmwareengine.v1.IListNodesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INode>): void; + request: protos.google.cloud.vmwareengine.v1.IListNodesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNodesRequest, + protos.google.cloud.vmwareengine.v1.IListNodesResponse | null | undefined, + protos.google.cloud.vmwareengine.v1.INode + >, + ): void; listNodes( - request: protos.google.cloud.vmwareengine.v1.IListNodesRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNodesRequest, - protos.google.cloud.vmwareengine.v1.IListNodesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INode>): void; + request: protos.google.cloud.vmwareengine.v1.IListNodesRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNodesRequest, + protos.google.cloud.vmwareengine.v1.IListNodesResponse | null | undefined, + protos.google.cloud.vmwareengine.v1.INode + >, + ): void; listNodes( - request?: protos.google.cloud.vmwareengine.v1.IListNodesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNodesRequest, - protos.google.cloud.vmwareengine.v1.IListNodesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INode>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListNodesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListNodesRequest, - protos.google.cloud.vmwareengine.v1.IListNodesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INode>): - Promise<[ - protos.google.cloud.vmwareengine.v1.INode[], - protos.google.cloud.vmwareengine.v1.IListNodesRequest|null, - protos.google.cloud.vmwareengine.v1.IListNodesResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListNodesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INode + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNodesRequest, + protos.google.cloud.vmwareengine.v1.IListNodesResponse | null | undefined, + protos.google.cloud.vmwareengine.v1.INode + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INode[], + protos.google.cloud.vmwareengine.v1.IListNodesRequest | null, + protos.google.cloud.vmwareengine.v1.IListNodesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNodesRequest, - protos.google.cloud.vmwareengine.v1.IListNodesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INode>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNodesRequest, + | protos.google.cloud.vmwareengine.v1.IListNodesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INode + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listNodes values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -8425,258 +12177,287 @@ export class VmwareEngineClient { this._log.info('listNodes request %j', request); return this.innerApiCalls .listNodes(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.INode[], - protos.google.cloud.vmwareengine.v1.IListNodesRequest|null, - protos.google.cloud.vmwareengine.v1.IListNodesResponse - ]) => { - this._log.info('listNodes values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.INode[], + protos.google.cloud.vmwareengine.v1.IListNodesRequest | null, + protos.google.cloud.vmwareengine.v1.IListNodesResponse, + ]) => { + this._log.info('listNodes values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listNodes`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the cluster to be queried for nodes. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` - * @param {number} request.pageSize - * The maximum number of nodes to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNodes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNodes` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.Node|Node} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listNodesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listNodes`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the cluster to be queried for nodes. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * @param {number} request.pageSize + * The maximum number of nodes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNodes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNodes` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.Node|Node} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listNodesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listNodesStream( - request?: protos.google.cloud.vmwareengine.v1.IListNodesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListNodesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listNodes']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listNodes stream %j', request); return this.descriptors.page.listNodes.createStream( this.innerApiCalls.listNodes as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listNodes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the cluster to be queried for nodes. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` - * @param {number} request.pageSize - * The maximum number of nodes to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNodes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNodes` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.Node|Node}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_nodes.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListNodes_async - */ + /** + * Equivalent to `listNodes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the cluster to be queried for nodes. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster` + * @param {number} request.pageSize + * The maximum number of nodes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNodes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNodes` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.Node|Node}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_nodes.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListNodes_async + */ listNodesAsync( - request?: protos.google.cloud.vmwareengine.v1.IListNodesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListNodesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listNodes']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listNodes iterate %j', request); return this.descriptors.page.listNodes.asyncIterate( this.innerApiCalls['listNodes'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists external IP addresses assigned to VMware workload VMs in a given - * private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * external IP addresses. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of external IP addresses to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListExternalAddresses` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListExternalAddresses` must match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of IP addresses, you can - * exclude the ones named `example-ip` by specifying - * `name != "example-ip"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-ip") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-ip-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-ip-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.ExternalAddress|ExternalAddress}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listExternalAddressesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists external IP addresses assigned to VMware workload VMs in a given + * private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * external IP addresses. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of external IP addresses to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListExternalAddresses` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListExternalAddresses` must match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of IP addresses, you can + * exclude the ones named `example-ip` by specifying + * `name != "example-ip"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-ip") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-ip-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-ip-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.ExternalAddress|ExternalAddress}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listExternalAddressesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExternalAddresses( - request?: protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IExternalAddress[], - protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest|null, - protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IExternalAddress[], + protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest | null, + protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse, + ] + >; listExternalAddresses( - request: protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, - protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAddress>): void; + request: protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, + | protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAddress + >, + ): void; listExternalAddresses( - request: protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, - protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAddress>): void; + request: protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, + | protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAddress + >, + ): void; listExternalAddresses( - request?: protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, - protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAddress>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, - protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAddress>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IExternalAddress[], - protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest|null, - protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAddress + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, + | protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAddress + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IExternalAddress[], + protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest | null, + protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, - protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAddress>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, + | protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAddress + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listExternalAddresses values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -8685,520 +12466,586 @@ export class VmwareEngineClient { this._log.info('listExternalAddresses request %j', request); return this.innerApiCalls .listExternalAddresses(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.IExternalAddress[], - protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest|null, - protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse - ]) => { - this._log.info('listExternalAddresses values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.IExternalAddress[], + protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest | null, + protos.google.cloud.vmwareengine.v1.IListExternalAddressesResponse, + ]) => { + this._log.info('listExternalAddresses values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listExternalAddresses`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * external IP addresses. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of external IP addresses to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListExternalAddresses` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListExternalAddresses` must match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of IP addresses, you can - * exclude the ones named `example-ip` by specifying - * `name != "example-ip"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-ip") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-ip-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-ip-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.ExternalAddress|ExternalAddress} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listExternalAddressesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listExternalAddresses`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * external IP addresses. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of external IP addresses to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListExternalAddresses` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListExternalAddresses` must match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of IP addresses, you can + * exclude the ones named `example-ip` by specifying + * `name != "example-ip"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-ip") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-ip-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-ip-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.ExternalAddress|ExternalAddress} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listExternalAddressesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExternalAddressesStream( - request?: protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExternalAddresses']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listExternalAddresses stream %j', request); return this.descriptors.page.listExternalAddresses.createStream( this.innerApiCalls.listExternalAddresses as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listExternalAddresses`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * external IP addresses. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of external IP addresses to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListExternalAddresses` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListExternalAddresses` must match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of IP addresses, you can - * exclude the ones named `example-ip` by specifying - * `name != "example-ip"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-ip") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-ip-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-ip-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.ExternalAddress|ExternalAddress}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_external_addresses.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListExternalAddresses_async - */ + /** + * Equivalent to `listExternalAddresses`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * external IP addresses. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of external IP addresses to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListExternalAddresses` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListExternalAddresses` must match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of IP addresses, you can + * exclude the ones named `example-ip` by specifying + * `name != "example-ip"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-ip") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-ip-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-ip-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.ExternalAddress|ExternalAddress}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_external_addresses.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListExternalAddresses_async + */ listExternalAddressesAsync( - request?: protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListExternalAddressesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExternalAddresses']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listExternalAddresses iterate %j', request); return this.descriptors.page.listExternalAddresses.asyncIterate( this.innerApiCalls['listExternalAddresses'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists external IP addresses assigned to VMware workload VMs within the - * scope of the given network policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.networkPolicy - * Required. The resource name of the network policy to query for assigned - * external IP addresses. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: - * `projects/my-project/locations/us-central1/networkPolicies/my-policy` - * @param {number} request.pageSize - * The maximum number of external IP addresses to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous - * `FetchNetworkPolicyExternalAddresses` call. Provide this to retrieve the - * subsequent page. - * - * When paginating, all parameters provided to - * `FetchNetworkPolicyExternalAddresses`, except for `page_size` and - * `page_token`, must match the call that provided the page token. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.ExternalAddress|ExternalAddress}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `fetchNetworkPolicyExternalAddressesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists external IP addresses assigned to VMware workload VMs within the + * scope of the given network policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.networkPolicy + * Required. The resource name of the network policy to query for assigned + * external IP addresses. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * @param {number} request.pageSize + * The maximum number of external IP addresses to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous + * `FetchNetworkPolicyExternalAddresses` call. Provide this to retrieve the + * subsequent page. + * + * When paginating, all parameters provided to + * `FetchNetworkPolicyExternalAddresses`, except for `page_size` and + * `page_token`, must match the call that provided the page token. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.ExternalAddress|ExternalAddress}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `fetchNetworkPolicyExternalAddressesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ fetchNetworkPolicyExternalAddresses( - request?: protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IExternalAddress[], - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest|null, - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IExternalAddress[], + protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest | null, + protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse, + ] + >; fetchNetworkPolicyExternalAddresses( - request: protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAddress>): void; + request: protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, + | protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAddress + >, + ): void; fetchNetworkPolicyExternalAddresses( - request: protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAddress>): void; + request: protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, + | protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAddress + >, + ): void; fetchNetworkPolicyExternalAddresses( - request?: protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAddress>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAddress>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IExternalAddress[], - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest|null, - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAddress + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, + | protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAddress + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IExternalAddress[], + protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest | null, + protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'network_policy': request.networkPolicy ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + network_policy: request.networkPolicy ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAddress>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, + | protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAddress + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('fetchNetworkPolicyExternalAddresses values %j', values); + this._log.info( + 'fetchNetworkPolicyExternalAddresses values %j', + values, + ); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. } : undefined; this._log.info('fetchNetworkPolicyExternalAddresses request %j', request); return this.innerApiCalls .fetchNetworkPolicyExternalAddresses(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.IExternalAddress[], - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest|null, - protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse - ]) => { - this._log.info('fetchNetworkPolicyExternalAddresses values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.IExternalAddress[], + protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest | null, + protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesResponse, + ]) => { + this._log.info( + 'fetchNetworkPolicyExternalAddresses values %j', + response, + ); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `fetchNetworkPolicyExternalAddresses`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.networkPolicy - * Required. The resource name of the network policy to query for assigned - * external IP addresses. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: - * `projects/my-project/locations/us-central1/networkPolicies/my-policy` - * @param {number} request.pageSize - * The maximum number of external IP addresses to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous - * `FetchNetworkPolicyExternalAddresses` call. Provide this to retrieve the - * subsequent page. - * - * When paginating, all parameters provided to - * `FetchNetworkPolicyExternalAddresses`, except for `page_size` and - * `page_token`, must match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.ExternalAddress|ExternalAddress} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `fetchNetworkPolicyExternalAddressesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `fetchNetworkPolicyExternalAddresses`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.networkPolicy + * Required. The resource name of the network policy to query for assigned + * external IP addresses. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * @param {number} request.pageSize + * The maximum number of external IP addresses to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous + * `FetchNetworkPolicyExternalAddresses` call. Provide this to retrieve the + * subsequent page. + * + * When paginating, all parameters provided to + * `FetchNetworkPolicyExternalAddresses`, except for `page_size` and + * `page_token`, must match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.ExternalAddress|ExternalAddress} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `fetchNetworkPolicyExternalAddressesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ fetchNetworkPolicyExternalAddressesStream( - request?: protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'network_policy': request.networkPolicy ?? '', - }); - const defaultCallSettings = this._defaults['fetchNetworkPolicyExternalAddresses']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + network_policy: request.networkPolicy ?? '', + }); + const defaultCallSettings = + this._defaults['fetchNetworkPolicyExternalAddresses']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('fetchNetworkPolicyExternalAddresses stream %j', request); return this.descriptors.page.fetchNetworkPolicyExternalAddresses.createStream( this.innerApiCalls.fetchNetworkPolicyExternalAddresses as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `fetchNetworkPolicyExternalAddresses`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.networkPolicy - * Required. The resource name of the network policy to query for assigned - * external IP addresses. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: - * `projects/my-project/locations/us-central1/networkPolicies/my-policy` - * @param {number} request.pageSize - * The maximum number of external IP addresses to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous - * `FetchNetworkPolicyExternalAddresses` call. Provide this to retrieve the - * subsequent page. - * - * When paginating, all parameters provided to - * `FetchNetworkPolicyExternalAddresses`, except for `page_size` and - * `page_token`, must match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.ExternalAddress|ExternalAddress}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.fetch_network_policy_external_addresses.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_FetchNetworkPolicyExternalAddresses_async - */ + /** + * Equivalent to `fetchNetworkPolicyExternalAddresses`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.networkPolicy + * Required. The resource name of the network policy to query for assigned + * external IP addresses. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * @param {number} request.pageSize + * The maximum number of external IP addresses to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous + * `FetchNetworkPolicyExternalAddresses` call. Provide this to retrieve the + * subsequent page. + * + * When paginating, all parameters provided to + * `FetchNetworkPolicyExternalAddresses`, except for `page_size` and + * `page_token`, must match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.ExternalAddress|ExternalAddress}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.fetch_network_policy_external_addresses.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_FetchNetworkPolicyExternalAddresses_async + */ fetchNetworkPolicyExternalAddressesAsync( - request?: protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IFetchNetworkPolicyExternalAddressesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'network_policy': request.networkPolicy ?? '', - }); - const defaultCallSettings = this._defaults['fetchNetworkPolicyExternalAddresses']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + network_policy: request.networkPolicy ?? '', + }); + const defaultCallSettings = + this._defaults['fetchNetworkPolicyExternalAddresses']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('fetchNetworkPolicyExternalAddresses iterate %j', request); return this.descriptors.page.fetchNetworkPolicyExternalAddresses.asyncIterate( this.innerApiCalls['fetchNetworkPolicyExternalAddresses'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists subnets in a given private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * subnets. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of subnets to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListSubnetsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListSubnetsRequest` must match the call that provided the page token. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.Subnet|Subnet}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSubnetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists subnets in a given private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * subnets. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of subnets to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListSubnetsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListSubnetsRequest` must match the call that provided the page token. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.Subnet|Subnet}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSubnetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listSubnets( - request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.ISubnet[], - protos.google.cloud.vmwareengine.v1.IListSubnetsRequest|null, - protos.google.cloud.vmwareengine.v1.IListSubnetsResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ISubnet[], + protos.google.cloud.vmwareengine.v1.IListSubnetsRequest | null, + protos.google.cloud.vmwareengine.v1.IListSubnetsResponse, + ] + >; listSubnets( - request: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - protos.google.cloud.vmwareengine.v1.IListSubnetsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ISubnet>): void; + request: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + | protos.google.cloud.vmwareengine.v1.IListSubnetsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ISubnet + >, + ): void; listSubnets( - request: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - protos.google.cloud.vmwareengine.v1.IListSubnetsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ISubnet>): void; + request: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + | protos.google.cloud.vmwareengine.v1.IListSubnetsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ISubnet + >, + ): void; listSubnets( - request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - protos.google.cloud.vmwareengine.v1.IListSubnetsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ISubnet>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - protos.google.cloud.vmwareengine.v1.IListSubnetsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ISubnet>): - Promise<[ - protos.google.cloud.vmwareengine.v1.ISubnet[], - protos.google.cloud.vmwareengine.v1.IListSubnetsRequest|null, - protos.google.cloud.vmwareengine.v1.IListSubnetsResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListSubnetsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ISubnet + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + | protos.google.cloud.vmwareengine.v1.IListSubnetsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ISubnet + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ISubnet[], + protos.google.cloud.vmwareengine.v1.IListSubnetsRequest | null, + protos.google.cloud.vmwareengine.v1.IListSubnetsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - protos.google.cloud.vmwareengine.v1.IListSubnetsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ISubnet>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + | protos.google.cloud.vmwareengine.v1.IListSubnetsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ISubnet + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listSubnets values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -9207,257 +13054,286 @@ export class VmwareEngineClient { this._log.info('listSubnets request %j', request); return this.innerApiCalls .listSubnets(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.ISubnet[], - protos.google.cloud.vmwareengine.v1.IListSubnetsRequest|null, - protos.google.cloud.vmwareengine.v1.IListSubnetsResponse - ]) => { - this._log.info('listSubnets values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.ISubnet[], + protos.google.cloud.vmwareengine.v1.IListSubnetsRequest | null, + protos.google.cloud.vmwareengine.v1.IListSubnetsResponse, + ]) => { + this._log.info('listSubnets values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listSubnets`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * subnets. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of subnets to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListSubnetsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListSubnetsRequest` must match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.Subnet|Subnet} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listSubnetsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listSubnets`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * subnets. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of subnets to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListSubnetsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListSubnetsRequest` must match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.Subnet|Subnet} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSubnetsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listSubnetsStream( - request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSubnets']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSubnets stream %j', request); return this.descriptors.page.listSubnets.createStream( this.innerApiCalls.listSubnets as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listSubnets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * subnets. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of subnets to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListSubnetsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListSubnetsRequest` must match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.Subnet|Subnet}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_subnets.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListSubnets_async - */ + /** + * Equivalent to `listSubnets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * subnets. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of subnets to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListSubnetsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListSubnetsRequest` must match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.Subnet|Subnet}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_subnets.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListSubnets_async + */ listSubnetsAsync( - request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListSubnetsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listSubnets']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listSubnets iterate %j', request); return this.descriptors.page.listSubnets.asyncIterate( this.innerApiCalls['listSubnets'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists `ExternalAccessRule` resources in the specified network policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the network policy to query for external - * access firewall rules. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: - * `projects/my-project/locations/us-central1/networkPolicies/my-policy` - * @param {number} request.pageSize - * The maximum number of external access rules to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListExternalAccessRulesRequest` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListExternalAccessRulesRequest` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of external access rules, you can - * exclude the ones named `example-rule` by specifying - * `name != "example-rule"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-rule") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-rule-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-rule-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.ExternalAccessRule|ExternalAccessRule}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listExternalAccessRulesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists `ExternalAccessRule` resources in the specified network policy. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the network policy to query for external + * access firewall rules. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * @param {number} request.pageSize + * The maximum number of external access rules to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListExternalAccessRulesRequest` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListExternalAccessRulesRequest` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of external access rules, you can + * exclude the ones named `example-rule` by specifying + * `name != "example-rule"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-rule") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-rule-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-rule-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.ExternalAccessRule|ExternalAccessRule}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listExternalAccessRulesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExternalAccessRules( - request?: protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IExternalAccessRule[], - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest|null, - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IExternalAccessRule[], + protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest | null, + protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse, + ] + >; listExternalAccessRules( - request: protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAccessRule>): void; + request: protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, + | protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAccessRule + >, + ): void; listExternalAccessRules( - request: protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAccessRule>): void; + request: protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, + | protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAccessRule + >, + ): void; listExternalAccessRules( - request?: protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAccessRule>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAccessRule>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IExternalAccessRule[], - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest|null, - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAccessRule + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, + | protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAccessRule + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IExternalAccessRule[], + protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest | null, + protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IExternalAccessRule>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, + | protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IExternalAccessRule + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listExternalAccessRules values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -9466,323 +13342,352 @@ export class VmwareEngineClient { this._log.info('listExternalAccessRules request %j', request); return this.innerApiCalls .listExternalAccessRules(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.IExternalAccessRule[], - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest|null, - protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse - ]) => { - this._log.info('listExternalAccessRules values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.IExternalAccessRule[], + protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest | null, + protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesResponse, + ]) => { + this._log.info('listExternalAccessRules values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listExternalAccessRules`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the network policy to query for external - * access firewall rules. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: - * `projects/my-project/locations/us-central1/networkPolicies/my-policy` - * @param {number} request.pageSize - * The maximum number of external access rules to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListExternalAccessRulesRequest` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListExternalAccessRulesRequest` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of external access rules, you can - * exclude the ones named `example-rule` by specifying - * `name != "example-rule"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-rule") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-rule-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-rule-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.ExternalAccessRule|ExternalAccessRule} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listExternalAccessRulesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listExternalAccessRules`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the network policy to query for external + * access firewall rules. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * @param {number} request.pageSize + * The maximum number of external access rules to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListExternalAccessRulesRequest` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListExternalAccessRulesRequest` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of external access rules, you can + * exclude the ones named `example-rule` by specifying + * `name != "example-rule"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-rule") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-rule-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-rule-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.ExternalAccessRule|ExternalAccessRule} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listExternalAccessRulesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExternalAccessRulesStream( - request?: protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExternalAccessRules']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listExternalAccessRules stream %j', request); return this.descriptors.page.listExternalAccessRules.createStream( this.innerApiCalls.listExternalAccessRules as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listExternalAccessRules`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the network policy to query for external - * access firewall rules. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: - * `projects/my-project/locations/us-central1/networkPolicies/my-policy` - * @param {number} request.pageSize - * The maximum number of external access rules to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListExternalAccessRulesRequest` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListExternalAccessRulesRequest` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of external access rules, you can - * exclude the ones named `example-rule` by specifying - * `name != "example-rule"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-rule") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-rule-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-rule-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.ExternalAccessRule|ExternalAccessRule}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_external_access_rules.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListExternalAccessRules_async - */ + /** + * Equivalent to `listExternalAccessRules`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the network policy to query for external + * access firewall rules. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: + * `projects/my-project/locations/us-central1/networkPolicies/my-policy` + * @param {number} request.pageSize + * The maximum number of external access rules to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListExternalAccessRulesRequest` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListExternalAccessRulesRequest` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of external access rules, you can + * exclude the ones named `example-rule` by specifying + * `name != "example-rule"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-rule") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-rule-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-rule-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.ExternalAccessRule|ExternalAccessRule}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_external_access_rules.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListExternalAccessRules_async + */ listExternalAccessRulesAsync( - request?: protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListExternalAccessRulesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExternalAccessRules']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listExternalAccessRules iterate %j', request); return this.descriptors.page.listExternalAccessRules.asyncIterate( this.innerApiCalls['listExternalAccessRules'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists logging servers configured for a given private - * cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * logging servers. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of logging servers to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListLoggingServersRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListLoggingServersRequest` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of logging servers, you can - * exclude the ones named `example-server` by specifying - * `name != "example-server"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-server") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-server-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-server-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.LoggingServer|LoggingServer}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLoggingServersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists logging servers configured for a given private + * cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * logging servers. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of logging servers to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListLoggingServersRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListLoggingServersRequest` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of logging servers, you can + * exclude the ones named `example-server` by specifying + * `name != "example-server"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-server") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-server-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-server-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.LoggingServer|LoggingServer}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listLoggingServersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listLoggingServers( - request?: protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.ILoggingServer[], - protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest|null, - protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ILoggingServer[], + protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest | null, + protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse, + ] + >; listLoggingServers( - request: protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, - protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ILoggingServer>): void; + request: protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, + | protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ILoggingServer + >, + ): void; listLoggingServers( - request: protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, - protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ILoggingServer>): void; + request: protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, + | protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ILoggingServer + >, + ): void; listLoggingServers( - request?: protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, - protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ILoggingServer>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, - protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ILoggingServer>): - Promise<[ - protos.google.cloud.vmwareengine.v1.ILoggingServer[], - protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest|null, - protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ILoggingServer + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, + | protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ILoggingServer + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.ILoggingServer[], + protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest | null, + protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, - protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.ILoggingServer>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, + | protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.ILoggingServer + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listLoggingServers values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -9791,316 +13696,345 @@ export class VmwareEngineClient { this._log.info('listLoggingServers request %j', request); return this.innerApiCalls .listLoggingServers(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.ILoggingServer[], - protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest|null, - protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse - ]) => { - this._log.info('listLoggingServers values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.ILoggingServer[], + protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest | null, + protos.google.cloud.vmwareengine.v1.IListLoggingServersResponse, + ]) => { + this._log.info('listLoggingServers values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listLoggingServers`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * logging servers. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of logging servers to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListLoggingServersRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListLoggingServersRequest` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of logging servers, you can - * exclude the ones named `example-server` by specifying - * `name != "example-server"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-server") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-server-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-server-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.LoggingServer|LoggingServer} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listLoggingServersAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listLoggingServers`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * logging servers. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of logging servers to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListLoggingServersRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListLoggingServersRequest` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of logging servers, you can + * exclude the ones named `example-server` by specifying + * `name != "example-server"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-server") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-server-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-server-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.LoggingServer|LoggingServer} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listLoggingServersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listLoggingServersStream( - request?: protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listLoggingServers']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listLoggingServers stream %j', request); return this.descriptors.page.listLoggingServers.createStream( this.innerApiCalls.listLoggingServers as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listLoggingServers`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * logging servers. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of logging servers to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListLoggingServersRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListLoggingServersRequest` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of logging servers, you can - * exclude the ones named `example-server` by specifying - * `name != "example-server"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-server") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-server-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-server-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.LoggingServer|LoggingServer}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_logging_servers.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListLoggingServers_async - */ + /** + * Equivalent to `listLoggingServers`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * logging servers. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of logging servers to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListLoggingServersRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListLoggingServersRequest` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of logging servers, you can + * exclude the ones named `example-server` by specifying + * `name != "example-server"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-server") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-server-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-server-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.LoggingServer|LoggingServer}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_logging_servers.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListLoggingServers_async + */ listLoggingServersAsync( - request?: protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListLoggingServersRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listLoggingServers']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listLoggingServers iterate %j', request); return this.descriptors.page.listLoggingServers.asyncIterate( this.innerApiCalls['listLoggingServers'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists node types - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to be queried for node types. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param {number} request.pageSize - * The maximum number of node types to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNodeTypes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNodeTypes` must match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of node types, you can - * exclude the ones named `standard-72` by specifying - * `name != "standard-72"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "standard-72") - * (virtual_cpu_count > 2) - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "standard-96") AND - * (virtual_cpu_count > 2) OR - * (name = "standard-72") - * ``` - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.NodeType|NodeType}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listNodeTypesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists node types + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to be queried for node types. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param {number} request.pageSize + * The maximum number of node types to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNodeTypes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNodeTypes` must match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of node types, you can + * exclude the ones named `standard-72` by specifying + * `name != "standard-72"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "standard-72") + * (virtual_cpu_count > 2) + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "standard-96") AND + * (virtual_cpu_count > 2) OR + * (name = "standard-72") + * ``` + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.NodeType|NodeType}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listNodeTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listNodeTypes( - request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.INodeType[], - protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest|null, - protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INodeType[], + protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest | null, + protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse, + ] + >; listNodeTypes( - request: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INodeType>): void; + request: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + | protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INodeType + >, + ): void; listNodeTypes( - request: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INodeType>): void; + request: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + | protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INodeType + >, + ): void; listNodeTypes( - request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INodeType>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INodeType>): - Promise<[ - protos.google.cloud.vmwareengine.v1.INodeType[], - protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest|null, - protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INodeType + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + | protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INodeType + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INodeType[], + protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest | null, + protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INodeType>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + | protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INodeType + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listNodeTypes values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -10109,306 +14043,335 @@ export class VmwareEngineClient { this._log.info('listNodeTypes request %j', request); return this.innerApiCalls .listNodeTypes(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.INodeType[], - protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest|null, - protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse - ]) => { - this._log.info('listNodeTypes values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.INodeType[], + protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest | null, + protos.google.cloud.vmwareengine.v1.IListNodeTypesResponse, + ]) => { + this._log.info('listNodeTypes values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listNodeTypes`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to be queried for node types. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param {number} request.pageSize - * The maximum number of node types to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNodeTypes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNodeTypes` must match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of node types, you can - * exclude the ones named `standard-72` by specifying - * `name != "standard-72"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "standard-72") - * (virtual_cpu_count > 2) - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "standard-96") AND - * (virtual_cpu_count > 2) OR - * (name = "standard-72") - * ``` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.NodeType|NodeType} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listNodeTypesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listNodeTypes`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to be queried for node types. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param {number} request.pageSize + * The maximum number of node types to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNodeTypes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNodeTypes` must match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of node types, you can + * exclude the ones named `standard-72` by specifying + * `name != "standard-72"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "standard-72") + * (virtual_cpu_count > 2) + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "standard-96") AND + * (virtual_cpu_count > 2) OR + * (name = "standard-72") + * ``` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.NodeType|NodeType} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listNodeTypesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listNodeTypesStream( - request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listNodeTypes']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listNodeTypes stream %j', request); return this.descriptors.page.listNodeTypes.createStream( this.innerApiCalls.listNodeTypes as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listNodeTypes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to be queried for node types. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a` - * @param {number} request.pageSize - * The maximum number of node types to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNodeTypes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNodeTypes` must match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of node types, you can - * exclude the ones named `standard-72` by specifying - * `name != "standard-72"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "standard-72") - * (virtual_cpu_count > 2) - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "standard-96") AND - * (virtual_cpu_count > 2) OR - * (name = "standard-72") - * ``` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.NodeType|NodeType}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_node_types.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListNodeTypes_async - */ + /** + * Equivalent to `listNodeTypes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to be queried for node types. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a` + * @param {number} request.pageSize + * The maximum number of node types to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNodeTypes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNodeTypes` must match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of node types, you can + * exclude the ones named `standard-72` by specifying + * `name != "standard-72"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "standard-72") + * (virtual_cpu_count > 2) + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "standard-96") AND + * (virtual_cpu_count > 2) OR + * (name = "standard-72") + * ``` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.NodeType|NodeType}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_node_types.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListNodeTypes_async + */ listNodeTypesAsync( - request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListNodeTypesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listNodeTypes']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listNodeTypes iterate %j', request); return this.descriptors.page.listNodeTypes.asyncIterate( this.innerApiCalls['listNodeTypes'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists `NetworkPeering` resources in a given project. NetworkPeering is a - * global resource and location can only be global. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location (global) to query for - * network peerings. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/global` - * @param {number} request.pageSize - * The maximum number of network peerings to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNetworkPeerings` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNetworkPeerings` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network peerings, you can - * exclude the ones named `example-peering` by specifying - * `name != "example-peering"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-peering") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-peering-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-peering-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.NetworkPeering|NetworkPeering}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listNetworkPeeringsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists `NetworkPeering` resources in a given project. NetworkPeering is a + * global resource and location can only be global. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location (global) to query for + * network peerings. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @param {number} request.pageSize + * The maximum number of network peerings to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNetworkPeerings` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNetworkPeerings` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-peering` by specifying + * `name != "example-peering"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-peering") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-peering-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-peering-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.NetworkPeering|NetworkPeering}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listNetworkPeeringsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listNetworkPeerings( - request?: protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.INetworkPeering[], - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest|null, - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INetworkPeering[], + protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest | null, + protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse, + ] + >; listNetworkPeerings( - request: protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INetworkPeering>): void; + request: protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, + | protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INetworkPeering + >, + ): void; listNetworkPeerings( - request: protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INetworkPeering>): void; + request: protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, + | protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INetworkPeering + >, + ): void; listNetworkPeerings( - request?: protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INetworkPeering>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INetworkPeering>): - Promise<[ - protos.google.cloud.vmwareengine.v1.INetworkPeering[], - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest|null, - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INetworkPeering + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, + | protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INetworkPeering + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INetworkPeering[], + protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest | null, + protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INetworkPeering>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, + | protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INetworkPeering + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listNetworkPeerings values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -10417,289 +14380,318 @@ export class VmwareEngineClient { this._log.info('listNetworkPeerings request %j', request); return this.innerApiCalls .listNetworkPeerings(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.INetworkPeering[], - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest|null, - protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse - ]) => { - this._log.info('listNetworkPeerings values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.INetworkPeering[], + protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest | null, + protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsResponse, + ]) => { + this._log.info('listNetworkPeerings values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listNetworkPeerings`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location (global) to query for - * network peerings. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/global` - * @param {number} request.pageSize - * The maximum number of network peerings to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNetworkPeerings` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNetworkPeerings` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network peerings, you can - * exclude the ones named `example-peering` by specifying - * `name != "example-peering"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-peering") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-peering-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-peering-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.NetworkPeering|NetworkPeering} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listNetworkPeeringsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listNetworkPeerings`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location (global) to query for + * network peerings. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @param {number} request.pageSize + * The maximum number of network peerings to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNetworkPeerings` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNetworkPeerings` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-peering` by specifying + * `name != "example-peering"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-peering") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-peering-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-peering-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.NetworkPeering|NetworkPeering} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listNetworkPeeringsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listNetworkPeeringsStream( - request?: protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listNetworkPeerings']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listNetworkPeerings stream %j', request); return this.descriptors.page.listNetworkPeerings.createStream( this.innerApiCalls.listNetworkPeerings as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listNetworkPeerings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location (global) to query for - * network peerings. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/global` - * @param {number} request.pageSize - * The maximum number of network peerings to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNetworkPeerings` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNetworkPeerings` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network peerings, you can - * exclude the ones named `example-peering` by specifying - * `name != "example-peering"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-peering") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-peering-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-peering-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.NetworkPeering|NetworkPeering}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_network_peerings.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListNetworkPeerings_async - */ + /** + * Equivalent to `listNetworkPeerings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location (global) to query for + * network peerings. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @param {number} request.pageSize + * The maximum number of network peerings to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNetworkPeerings` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNetworkPeerings` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-peering` by specifying + * `name != "example-peering"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-peering") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-peering-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-peering-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.NetworkPeering|NetworkPeering}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_network_peerings.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListNetworkPeerings_async + */ listNetworkPeeringsAsync( - request?: protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListNetworkPeeringsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listNetworkPeerings']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listNetworkPeerings iterate %j', request); return this.descriptors.page.listNetworkPeerings.asyncIterate( this.innerApiCalls['listNetworkPeerings'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists the network peering routes exchanged over a peering connection. - * NetworkPeering is a global resource and location can only be global. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the network peering to retrieve peering - * routes from. Resource names are schemeless URIs that follow the conventions - * in https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/global/networkPeerings/my-peering` - * @param {number} request.pageSize - * The maximum number of peering routes to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPeeringRoutes` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListPeeringRoutes` must - * match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * Currently, only filtering on the `direction` field is supported. To return - * routes imported from the peer network, provide "direction=INCOMING". To - * return routes exported from the VMware Engine network, provide - * "direction=OUTGOING". Other filter expressions return an error. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.PeeringRoute|PeeringRoute}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listPeeringRoutesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists the network peering routes exchanged over a peering connection. + * NetworkPeering is a global resource and location can only be global. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the network peering to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * @param {number} request.pageSize + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPeeringRoutes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListPeeringRoutes` must + * match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * Currently, only filtering on the `direction` field is supported. To return + * routes imported from the peer network, provide "direction=INCOMING". To + * return routes exported from the VMware Engine network, provide + * "direction=OUTGOING". Other filter expressions return an error. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.PeeringRoute|PeeringRoute}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listPeeringRoutesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listPeeringRoutes( - request?: protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPeeringRoute[], - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest|null, - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IPeeringRoute[], + protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest | null, + protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse, + ] + >; listPeeringRoutes( - request: protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPeeringRoute>): void; + request: protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, + | protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPeeringRoute + >, + ): void; listPeeringRoutes( - request: protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPeeringRoute>): void; + request: protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, + | protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPeeringRoute + >, + ): void; listPeeringRoutes( - request?: protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPeeringRoute>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPeeringRoute>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPeeringRoute[], - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest|null, - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPeeringRoute + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, + | protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPeeringRoute + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IPeeringRoute[], + protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest | null, + protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPeeringRoute>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, + | protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPeeringRoute + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listPeeringRoutes values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -10708,232 +14700,261 @@ export class VmwareEngineClient { this._log.info('listPeeringRoutes request %j', request); return this.innerApiCalls .listPeeringRoutes(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.IPeeringRoute[], - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest|null, - protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse - ]) => { - this._log.info('listPeeringRoutes values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.IPeeringRoute[], + protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest | null, + protos.google.cloud.vmwareengine.v1.IListPeeringRoutesResponse, + ]) => { + this._log.info('listPeeringRoutes values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listPeeringRoutes`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the network peering to retrieve peering - * routes from. Resource names are schemeless URIs that follow the conventions - * in https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/global/networkPeerings/my-peering` - * @param {number} request.pageSize - * The maximum number of peering routes to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPeeringRoutes` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListPeeringRoutes` must - * match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * Currently, only filtering on the `direction` field is supported. To return - * routes imported from the peer network, provide "direction=INCOMING". To - * return routes exported from the VMware Engine network, provide - * "direction=OUTGOING". Other filter expressions return an error. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.PeeringRoute|PeeringRoute} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listPeeringRoutesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listPeeringRoutes`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the network peering to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * @param {number} request.pageSize + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPeeringRoutes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListPeeringRoutes` must + * match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * Currently, only filtering on the `direction` field is supported. To return + * routes imported from the peer network, provide "direction=INCOMING". To + * return routes exported from the VMware Engine network, provide + * "direction=OUTGOING". Other filter expressions return an error. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.PeeringRoute|PeeringRoute} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listPeeringRoutesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listPeeringRoutesStream( - request?: protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listPeeringRoutes']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listPeeringRoutes stream %j', request); return this.descriptors.page.listPeeringRoutes.createStream( this.innerApiCalls.listPeeringRoutes as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listPeeringRoutes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the network peering to retrieve peering - * routes from. Resource names are schemeless URIs that follow the conventions - * in https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/global/networkPeerings/my-peering` - * @param {number} request.pageSize - * The maximum number of peering routes to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPeeringRoutes` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListPeeringRoutes` must - * match the call that provided the page token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * Currently, only filtering on the `direction` field is supported. To return - * routes imported from the peer network, provide "direction=INCOMING". To - * return routes exported from the VMware Engine network, provide - * "direction=OUTGOING". Other filter expressions return an error. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.PeeringRoute|PeeringRoute}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_peering_routes.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListPeeringRoutes_async - */ + /** + * Equivalent to `listPeeringRoutes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the network peering to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/global/networkPeerings/my-peering` + * @param {number} request.pageSize + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPeeringRoutes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListPeeringRoutes` must + * match the call that provided the page token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * Currently, only filtering on the `direction` field is supported. To return + * routes imported from the peer network, provide "direction=INCOMING". To + * return routes exported from the VMware Engine network, provide + * "direction=OUTGOING". Other filter expressions return an error. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.PeeringRoute|PeeringRoute}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_peering_routes.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListPeeringRoutes_async + */ listPeeringRoutesAsync( - request?: protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListPeeringRoutesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listPeeringRoutes']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listPeeringRoutes iterate %j', request); return this.descriptors.page.listPeeringRoutes.asyncIterate( this.innerApiCalls['listPeeringRoutes'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists `HcxActivationKey` resources in a given private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud - * to be queried for HCX activation keys. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of HCX activation keys to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListHcxActivationKeys` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListHcxActivationKeys` must match the call that provided the page - * token. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.HcxActivationKey|HcxActivationKey}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listHcxActivationKeysAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists `HcxActivationKey` resources in a given private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud + * to be queried for HCX activation keys. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of HCX activation keys to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListHcxActivationKeys` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListHcxActivationKeys` must match the call that provided the page + * token. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.HcxActivationKey|HcxActivationKey}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listHcxActivationKeysAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listHcxActivationKeys( - request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IHcxActivationKey[], - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest|null, - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IHcxActivationKey[], + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest | null, + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse, + ] + >; listHcxActivationKeys( - request: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IHcxActivationKey>): void; + request: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + | protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IHcxActivationKey + >, + ): void; listHcxActivationKeys( - request: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IHcxActivationKey>): void; + request: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + | protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IHcxActivationKey + >, + ): void; listHcxActivationKeys( - request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IHcxActivationKey>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IHcxActivationKey>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IHcxActivationKey[], - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest|null, - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IHcxActivationKey + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + | protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IHcxActivationKey + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IHcxActivationKey[], + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest | null, + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IHcxActivationKey>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + | protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IHcxActivationKey + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listHcxActivationKeys values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -10942,258 +14963,287 @@ export class VmwareEngineClient { this._log.info('listHcxActivationKeys request %j', request); return this.innerApiCalls .listHcxActivationKeys(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.IHcxActivationKey[], - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest|null, - protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse - ]) => { - this._log.info('listHcxActivationKeys values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.IHcxActivationKey[], + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest | null, + protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysResponse, + ]) => { + this._log.info('listHcxActivationKeys values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listHcxActivationKeys`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud - * to be queried for HCX activation keys. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of HCX activation keys to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListHcxActivationKeys` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListHcxActivationKeys` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.HcxActivationKey|HcxActivationKey} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listHcxActivationKeysAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listHcxActivationKeys`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud + * to be queried for HCX activation keys. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of HCX activation keys to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListHcxActivationKeys` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListHcxActivationKeys` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.HcxActivationKey|HcxActivationKey} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listHcxActivationKeysAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listHcxActivationKeysStream( - request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listHcxActivationKeys']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listHcxActivationKeys stream %j', request); return this.descriptors.page.listHcxActivationKeys.createStream( this.innerApiCalls.listHcxActivationKeys as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listHcxActivationKeys`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud - * to be queried for HCX activation keys. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of HCX activation keys to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListHcxActivationKeys` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListHcxActivationKeys` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.HcxActivationKey|HcxActivationKey}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_hcx_activation_keys.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListHcxActivationKeys_async - */ + /** + * Equivalent to `listHcxActivationKeys`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud + * to be queried for HCX activation keys. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of HCX activation keys to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListHcxActivationKeys` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListHcxActivationKeys` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.HcxActivationKey|HcxActivationKey}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_hcx_activation_keys.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListHcxActivationKeys_async + */ listHcxActivationKeysAsync( - request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListHcxActivationKeysRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listHcxActivationKeys']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listHcxActivationKeys iterate %j', request); return this.descriptors.page.listHcxActivationKeys.asyncIterate( this.innerApiCalls['listHcxActivationKeys'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists `NetworkPolicy` resources in a specified project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location (region) to query for - * network policies. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - * @param {number} request.pageSize - * The maximum number of network policies to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNetworkPolicies` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNetworkPolicies` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network policies, you can - * exclude the ones named `example-policy` by specifying - * `name != "example-policy"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-policy") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-policy-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-policy-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.NetworkPolicy|NetworkPolicy}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listNetworkPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists `NetworkPolicy` resources in a specified project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location (region) to query for + * network policies. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @param {number} request.pageSize + * The maximum number of network policies to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNetworkPolicies` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNetworkPolicies` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network policies, you can + * exclude the ones named `example-policy` by specifying + * `name != "example-policy"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-policy") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-policy-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-policy-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.NetworkPolicy|NetworkPolicy}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listNetworkPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listNetworkPolicies( - request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.INetworkPolicy[], - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest|null, - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INetworkPolicy[], + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest | null, + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse, + ] + >; listNetworkPolicies( - request: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INetworkPolicy>): void; + request: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + | protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INetworkPolicy + >, + ): void; listNetworkPolicies( - request: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INetworkPolicy>): void; + request: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + | protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INetworkPolicy + >, + ): void; listNetworkPolicies( - request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INetworkPolicy>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INetworkPolicy>): - Promise<[ - protos.google.cloud.vmwareengine.v1.INetworkPolicy[], - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest|null, - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INetworkPolicy + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + | protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INetworkPolicy + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.INetworkPolicy[], + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest | null, + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.INetworkPolicy>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + | protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.INetworkPolicy + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listNetworkPolicies values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -11202,320 +15252,349 @@ export class VmwareEngineClient { this._log.info('listNetworkPolicies request %j', request); return this.innerApiCalls .listNetworkPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.INetworkPolicy[], - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest|null, - protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse - ]) => { - this._log.info('listNetworkPolicies values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.INetworkPolicy[], + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest | null, + protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesResponse, + ]) => { + this._log.info('listNetworkPolicies values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listNetworkPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location (region) to query for - * network policies. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - * @param {number} request.pageSize - * The maximum number of network policies to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNetworkPolicies` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNetworkPolicies` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network policies, you can - * exclude the ones named `example-policy` by specifying - * `name != "example-policy"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-policy") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-policy-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-policy-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.NetworkPolicy|NetworkPolicy} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listNetworkPoliciesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listNetworkPolicies`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location (region) to query for + * network policies. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @param {number} request.pageSize + * The maximum number of network policies to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNetworkPolicies` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNetworkPolicies` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network policies, you can + * exclude the ones named `example-policy` by specifying + * `name != "example-policy"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-policy") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-policy-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-policy-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.NetworkPolicy|NetworkPolicy} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listNetworkPoliciesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listNetworkPoliciesStream( - request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listNetworkPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listNetworkPolicies stream %j', request); return this.descriptors.page.listNetworkPolicies.createStream( this.innerApiCalls.listNetworkPolicies as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listNetworkPolicies`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location (region) to query for - * network policies. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - * @param {number} request.pageSize - * The maximum number of network policies to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListNetworkPolicies` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListNetworkPolicies` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network policies, you can - * exclude the ones named `example-policy` by specifying - * `name != "example-policy"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-policy") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-policy-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-policy-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.NetworkPolicy|NetworkPolicy}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_network_policies.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListNetworkPolicies_async - */ + /** + * Equivalent to `listNetworkPolicies`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location (region) to query for + * network policies. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @param {number} request.pageSize + * The maximum number of network policies to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListNetworkPolicies` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListNetworkPolicies` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network policies, you can + * exclude the ones named `example-policy` by specifying + * `name != "example-policy"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-policy") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-policy-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-policy-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.NetworkPolicy|NetworkPolicy}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_network_policies.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListNetworkPolicies_async + */ listNetworkPoliciesAsync( - request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListNetworkPoliciesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listNetworkPolicies']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listNetworkPolicies iterate %j', request); return this.descriptors.page.listNetworkPolicies.asyncIterate( this.innerApiCalls['listNetworkPolicies'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Consumer VPCs bound to Management DNS Zone of a given private cloud. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * management DNS zone bindings. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of management DNS zone bindings to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListManagementDnsZoneBindings` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListManagementDnsZoneBindings` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of Management DNS Zone Bindings, - * you can exclude the ones named `example-management-dns-zone-binding` by - * specifying `name != "example-management-dns-zone-binding"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-management-dns-zone-binding") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-management-dns-zone-binding-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-management-dns-zone-binding-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding|ManagementDnsZoneBinding}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listManagementDnsZoneBindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Consumer VPCs bound to Management DNS Zone of a given private cloud. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * management DNS zone bindings. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of management DNS zone bindings to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListManagementDnsZoneBindings` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListManagementDnsZoneBindings` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of Management DNS Zone Bindings, + * you can exclude the ones named `example-management-dns-zone-binding` by + * specifying `name != "example-management-dns-zone-binding"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-management-dns-zone-binding") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-management-dns-zone-binding-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-management-dns-zone-binding-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding|ManagementDnsZoneBinding}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listManagementDnsZoneBindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listManagementDnsZoneBindings( - request?: protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding[], - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest|null, - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding[], + protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest | null, + protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse, + ] + >; listManagementDnsZoneBindings( - request: protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding>): void; + request: protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, + | protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding + >, + ): void; listManagementDnsZoneBindings( - request: protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding>): void; + request: protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, + | protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding + >, + ): void; listManagementDnsZoneBindings( - request?: protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding[], - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest|null, - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, + | protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding[], + protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest | null, + protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, + | protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listManagementDnsZoneBindings values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -11524,321 +15603,350 @@ export class VmwareEngineClient { this._log.info('listManagementDnsZoneBindings request %j', request); return this.innerApiCalls .listManagementDnsZoneBindings(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding[], - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest|null, - protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse - ]) => { - this._log.info('listManagementDnsZoneBindings values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding[], + protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest | null, + protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsResponse, + ]) => { + this._log.info('listManagementDnsZoneBindings values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listManagementDnsZoneBindings`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * management DNS zone bindings. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of management DNS zone bindings to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListManagementDnsZoneBindings` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListManagementDnsZoneBindings` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of Management DNS Zone Bindings, - * you can exclude the ones named `example-management-dns-zone-binding` by - * specifying `name != "example-management-dns-zone-binding"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-management-dns-zone-binding") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-management-dns-zone-binding-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-management-dns-zone-binding-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding|ManagementDnsZoneBinding} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listManagementDnsZoneBindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listManagementDnsZoneBindings`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * management DNS zone bindings. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of management DNS zone bindings to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListManagementDnsZoneBindings` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListManagementDnsZoneBindings` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of Management DNS Zone Bindings, + * you can exclude the ones named `example-management-dns-zone-binding` by + * specifying `name != "example-management-dns-zone-binding"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-management-dns-zone-binding") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-management-dns-zone-binding-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-management-dns-zone-binding-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding|ManagementDnsZoneBinding} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listManagementDnsZoneBindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listManagementDnsZoneBindingsStream( - request?: protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listManagementDnsZoneBindings']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listManagementDnsZoneBindings stream %j', request); return this.descriptors.page.listManagementDnsZoneBindings.createStream( this.innerApiCalls.listManagementDnsZoneBindings as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listManagementDnsZoneBindings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private cloud to be queried for - * management DNS zone bindings. - * Resource names are schemeless URIs that follow the conventions in - * https://cloud.google.com/apis/design/resource_names. - * For example: - * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` - * @param {number} request.pageSize - * The maximum number of management DNS zone bindings to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListManagementDnsZoneBindings` - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListManagementDnsZoneBindings` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of Management DNS Zone Bindings, - * you can exclude the ones named `example-management-dns-zone-binding` by - * specifying `name != "example-management-dns-zone-binding"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-management-dns-zone-binding") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-management-dns-zone-binding-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-management-dns-zone-binding-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding|ManagementDnsZoneBinding}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_management_dns_zone_bindings.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListManagementDnsZoneBindings_async - */ + /** + * Equivalent to `listManagementDnsZoneBindings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private cloud to be queried for + * management DNS zone bindings. + * Resource names are schemeless URIs that follow the conventions in + * https://cloud.google.com/apis/design/resource_names. + * For example: + * `projects/my-project/locations/us-central1-a/privateClouds/my-cloud` + * @param {number} request.pageSize + * The maximum number of management DNS zone bindings to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListManagementDnsZoneBindings` + * call. Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListManagementDnsZoneBindings` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of Management DNS Zone Bindings, + * you can exclude the ones named `example-management-dns-zone-binding` by + * specifying `name != "example-management-dns-zone-binding"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-management-dns-zone-binding") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-management-dns-zone-binding-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-management-dns-zone-binding-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding|ManagementDnsZoneBinding}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_management_dns_zone_bindings.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListManagementDnsZoneBindings_async + */ listManagementDnsZoneBindingsAsync( - request?: protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListManagementDnsZoneBindingsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listManagementDnsZoneBindings']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listManagementDnsZoneBindings iterate %j', request); return this.descriptors.page.listManagementDnsZoneBindings.asyncIterate( this.innerApiCalls['listManagementDnsZoneBindings'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists `VmwareEngineNetwork` resources in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to query for - * VMware Engine networks. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/global` - * @param {number} request.pageSize - * The maximum number of results to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListVmwareEngineNetworks` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListVmwareEngineNetworks` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network peerings, you can - * exclude the ones named `example-network` by specifying - * `name != "example-network"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-network") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-network-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-network-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listVmwareEngineNetworksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists `VmwareEngineNetwork` resources in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to query for + * VMware Engine networks. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @param {number} request.pageSize + * The maximum number of results to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListVmwareEngineNetworks` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListVmwareEngineNetworks` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-network` by specifying + * `name != "example-network"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-network") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-network-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-network-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listVmwareEngineNetworksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listVmwareEngineNetworks( - request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[], - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest|null, - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[], + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest | null, + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse, + ] + >; listVmwareEngineNetworks( - request: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork>): void; + request: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + | protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork + >, + ): void; listVmwareEngineNetworks( - request: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork>): void; + request: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + | protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork + >, + ): void; listVmwareEngineNetworks( - request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[], - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest|null, - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + | protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[], + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest | null, + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + | protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listVmwareEngineNetworks values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -11847,315 +15955,344 @@ export class VmwareEngineClient { this._log.info('listVmwareEngineNetworks request %j', request); return this.innerApiCalls .listVmwareEngineNetworks(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[], - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest|null, - protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse - ]) => { - this._log.info('listVmwareEngineNetworks values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[], + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest | null, + protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksResponse, + ]) => { + this._log.info('listVmwareEngineNetworks values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listVmwareEngineNetworks`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to query for - * VMware Engine networks. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/global` - * @param {number} request.pageSize - * The maximum number of results to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListVmwareEngineNetworks` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListVmwareEngineNetworks` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network peerings, you can - * exclude the ones named `example-network` by specifying - * `name != "example-network"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-network") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-network-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-network-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listVmwareEngineNetworksAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listVmwareEngineNetworks`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to query for + * VMware Engine networks. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @param {number} request.pageSize + * The maximum number of results to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListVmwareEngineNetworks` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListVmwareEngineNetworks` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-network` by specifying + * `name != "example-network"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-network") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-network-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-network-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listVmwareEngineNetworksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listVmwareEngineNetworksStream( - request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listVmwareEngineNetworks']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listVmwareEngineNetworks stream %j', request); return this.descriptors.page.listVmwareEngineNetworks.createStream( this.innerApiCalls.listVmwareEngineNetworks as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listVmwareEngineNetworks`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to query for - * VMware Engine networks. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/global` - * @param {number} request.pageSize - * The maximum number of results to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListVmwareEngineNetworks` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListVmwareEngineNetworks` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of network peerings, you can - * exclude the ones named `example-network` by specifying - * `name != "example-network"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-network") - * (createTime > "2021-04-12T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-network-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-network-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_vmware_engine_networks.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListVmwareEngineNetworks_async - */ + /** + * Equivalent to `listVmwareEngineNetworks`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to query for + * VMware Engine networks. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/global` + * @param {number} request.pageSize + * The maximum number of results to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListVmwareEngineNetworks` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListVmwareEngineNetworks` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of network peerings, you can + * exclude the ones named `example-network` by specifying + * `name != "example-network"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-network") + * (createTime > "2021-04-12T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-network-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-network-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork|VmwareEngineNetwork}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_vmware_engine_networks.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListVmwareEngineNetworks_async + */ listVmwareEngineNetworksAsync( - request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListVmwareEngineNetworksRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listVmwareEngineNetworks']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listVmwareEngineNetworks iterate %j', request); return this.descriptors.page.listVmwareEngineNetworks.asyncIterate( this.innerApiCalls['listVmwareEngineNetworks'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists `PrivateConnection` resources in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to query for - * private connections. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - * @param {number} request.pageSize - * The maximum number of private connections to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of private connections, you can - * exclude the ones named `example-connection` by specifying - * `name != "example-connection"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-connection") - * (createTime > "2022-09-22T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-connection-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-connection-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.PrivateConnection|PrivateConnection}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listPrivateConnectionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists `PrivateConnection` resources in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to query for + * private connections. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @param {number} request.pageSize + * The maximum number of private connections to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of private connections, you can + * exclude the ones named `example-connection` by specifying + * `name != "example-connection"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-connection") + * (createTime > "2022-09-22T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-connection-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-connection-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.PrivateConnection|PrivateConnection}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listPrivateConnectionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listPrivateConnections( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateConnection[], - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IPrivateConnection[], + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest | null, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse, + ] + >; listPrivateConnections( - request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateConnection>): void; + request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + | protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPrivateConnection + >, + ): void; listPrivateConnections( - request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateConnection>): void; + request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + | protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPrivateConnection + >, + ): void; listPrivateConnections( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateConnection>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateConnection>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPrivateConnection[], - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPrivateConnection + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + | protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPrivateConnection + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IPrivateConnection[], + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest | null, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPrivateConnection>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + | protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPrivateConnection + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listPrivateConnections values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -12164,435 +16301,476 @@ export class VmwareEngineClient { this._log.info('listPrivateConnections request %j', request); return this.innerApiCalls .listPrivateConnections(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.IPrivateConnection[], - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse - ]) => { - this._log.info('listPrivateConnections values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.IPrivateConnection[], + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest | null, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsResponse, + ]) => { + this._log.info('listPrivateConnections values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listPrivateConnections`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to query for - * private connections. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - * @param {number} request.pageSize - * The maximum number of private connections to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of private connections, you can - * exclude the ones named `example-connection` by specifying - * `name != "example-connection"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-connection") - * (createTime > "2022-09-22T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-connection-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-connection-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.PrivateConnection|PrivateConnection} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listPrivateConnectionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listPrivateConnections`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to query for + * private connections. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @param {number} request.pageSize + * The maximum number of private connections to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of private connections, you can + * exclude the ones named `example-connection` by specifying + * `name != "example-connection"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-connection") + * (createTime > "2022-09-22T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-connection-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-connection-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.PrivateConnection|PrivateConnection} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listPrivateConnectionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listPrivateConnectionsStream( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listPrivateConnections']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listPrivateConnections stream %j', request); return this.descriptors.page.listPrivateConnections.createStream( this.innerApiCalls.listPrivateConnections as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listPrivateConnections`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location to query for - * private connections. Resource names are schemeless URIs that follow the - * conventions in https://cloud.google.com/apis/design/resource_names. For - * example: `projects/my-project/locations/us-central1` - * @param {number} request.pageSize - * The maximum number of private connections to return in one page. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - * @param {string} request.filter - * A filter expression that matches resources returned in the response. - * The expression must specify the field name, a comparison - * operator, and the value that you want to use for filtering. The value - * must be a string, a number, or a boolean. The comparison operator - * must be `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering a list of private connections, you can - * exclude the ones named `example-connection` by specifying - * `name != "example-connection"`. - * - * To filter on multiple expressions, provide each separate expression within - * parentheses. For example: - * ``` - * (name = "example-connection") - * (createTime > "2022-09-22T08:15:10.40Z") - * ``` - * - * By default, each expression is an `AND` expression. However, you - * can include `AND` and `OR` expressions explicitly. - * For example: - * ``` - * (name = "example-connection-1") AND - * (createTime > "2021-04-12T08:15:10.40Z") OR - * (name = "example-connection-2") - * ``` - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, returned results - * are ordered by `name` in ascending order. - * You can also sort results in descending order based on the `name` value - * using `orderBy="name desc"`. - * Currently, only ordering by `name` is supported. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.PrivateConnection|PrivateConnection}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_private_connections.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListPrivateConnections_async - */ + /** + * Equivalent to `listPrivateConnections`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the location to query for + * private connections. Resource names are schemeless URIs that follow the + * conventions in https://cloud.google.com/apis/design/resource_names. For + * example: `projects/my-project/locations/us-central1` + * @param {number} request.pageSize + * The maximum number of private connections to return in one page. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * @param {string} request.filter + * A filter expression that matches resources returned in the response. + * The expression must specify the field name, a comparison + * operator, and the value that you want to use for filtering. The value + * must be a string, a number, or a boolean. The comparison operator + * must be `=`, `!=`, `>`, or `<`. + * + * For example, if you are filtering a list of private connections, you can + * exclude the ones named `example-connection` by specifying + * `name != "example-connection"`. + * + * To filter on multiple expressions, provide each separate expression within + * parentheses. For example: + * ``` + * (name = "example-connection") + * (createTime > "2022-09-22T08:15:10.40Z") + * ``` + * + * By default, each expression is an `AND` expression. However, you + * can include `AND` and `OR` expressions explicitly. + * For example: + * ``` + * (name = "example-connection-1") AND + * (createTime > "2021-04-12T08:15:10.40Z") OR + * (name = "example-connection-2") + * ``` + * @param {string} request.orderBy + * Sorts list results by a certain order. By default, returned results + * are ordered by `name` in ascending order. + * You can also sort results in descending order based on the `name` value + * using `orderBy="name desc"`. + * Currently, only ordering by `name` is supported. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.PrivateConnection|PrivateConnection}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_private_connections.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListPrivateConnections_async + */ listPrivateConnectionsAsync( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listPrivateConnections']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listPrivateConnections iterate %j', request); return this.descriptors.page.listPrivateConnections.asyncIterate( this.innerApiCalls['listPrivateConnections'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists the private connection routes exchanged over a peering connection. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private connection to retrieve peering - * routes from. Resource names are schemeless URIs that follow the conventions - * in https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/us-west1/privateConnections/my-connection` - * @param {number} request.pageSize - * The maximum number of peering routes to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListPrivateConnectionPeeringRoutes` must - * match the call that provided the page token. - * @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 Array of {@link protos.google.cloud.vmwareengine.v1.PeeringRoute|PeeringRoute}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listPrivateConnectionPeeringRoutesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists the private connection routes exchanged over a peering connection. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private connection to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-west1/privateConnections/my-connection` + * @param {number} request.pageSize + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListPrivateConnectionPeeringRoutes` must + * match the call that provided the page token. + * @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 Array of {@link protos.google.cloud.vmwareengine.v1.PeeringRoute|PeeringRoute}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listPrivateConnectionPeeringRoutesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listPrivateConnectionPeeringRoutes( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPeeringRoute[], - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse - ]>; + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IPeeringRoute[], + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest | null, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse, + ] + >; listPrivateConnectionPeeringRoutes( - request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPeeringRoute>): void; + request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + | protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPeeringRoute + >, + ): void; listPrivateConnectionPeeringRoutes( - request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - callback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPeeringRoute>): void; + request: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + callback: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + | protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPeeringRoute + >, + ): void; listPrivateConnectionPeeringRoutes( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPeeringRoute>, - callback?: PaginationCallback< + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPeeringRoute>): - Promise<[ - protos.google.cloud.vmwareengine.v1.IPeeringRoute[], - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse - ]>|void { + | protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPeeringRoute + >, + callback?: PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + | protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPeeringRoute + >, + ): Promise< + [ + protos.google.cloud.vmwareengine.v1.IPeeringRoute[], + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest | null, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse|null|undefined, - protos.google.cloud.vmwareengine.v1.IPeeringRoute>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + | protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse + | null + | undefined, + protos.google.cloud.vmwareengine.v1.IPeeringRoute + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listPrivateConnectionPeeringRoutes values %j', values); + this._log.info( + 'listPrivateConnectionPeeringRoutes values %j', + values, + ); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. } : undefined; this._log.info('listPrivateConnectionPeeringRoutes request %j', request); return this.innerApiCalls .listPrivateConnectionPeeringRoutes(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vmwareengine.v1.IPeeringRoute[], - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest|null, - protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse - ]) => { - this._log.info('listPrivateConnectionPeeringRoutes values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vmwareengine.v1.IPeeringRoute[], + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest | null, + protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesResponse, + ]) => { + this._log.info( + 'listPrivateConnectionPeeringRoutes values %j', + response, + ); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listPrivateConnectionPeeringRoutes`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private connection to retrieve peering - * routes from. Resource names are schemeless URIs that follow the conventions - * in https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/us-west1/privateConnections/my-connection` - * @param {number} request.pageSize - * The maximum number of peering routes to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListPrivateConnectionPeeringRoutes` must - * match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.PeeringRoute|PeeringRoute} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listPrivateConnectionPeeringRoutesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listPrivateConnectionPeeringRoutes`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private connection to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-west1/privateConnections/my-connection` + * @param {number} request.pageSize + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListPrivateConnectionPeeringRoutes` must + * match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vmwareengine.v1.PeeringRoute|PeeringRoute} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listPrivateConnectionPeeringRoutesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listPrivateConnectionPeeringRoutesStream( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listPrivateConnectionPeeringRoutes']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listPrivateConnectionPeeringRoutes']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listPrivateConnectionPeeringRoutes stream %j', request); return this.descriptors.page.listPrivateConnectionPeeringRoutes.createStream( this.innerApiCalls.listPrivateConnectionPeeringRoutes as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listPrivateConnectionPeeringRoutes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the private connection to retrieve peering - * routes from. Resource names are schemeless URIs that follow the conventions - * in https://cloud.google.com/apis/design/resource_names. For example: - * `projects/my-project/locations/us-west1/privateConnections/my-connection` - * @param {number} request.pageSize - * The maximum number of peering routes to return in one page. - * The service may return fewer than this value. - * The maximum value is coerced to 1000. - * The default value of this field is 500. - * @param {string} request.pageToken - * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` - * call. Provide this to retrieve the subsequent page. When paginating, all - * other parameters provided to `ListPrivateConnectionPeeringRoutes` must - * match the call that provided the page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vmwareengine.v1.PeeringRoute|PeeringRoute}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vmware_engine.list_private_connection_peering_routes.js - * region_tag:vmwareengine_v1_generated_VmwareEngine_ListPrivateConnectionPeeringRoutes_async - */ + /** + * Equivalent to `listPrivateConnectionPeeringRoutes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the private connection to retrieve peering + * routes from. Resource names are schemeless URIs that follow the conventions + * in https://cloud.google.com/apis/design/resource_names. For example: + * `projects/my-project/locations/us-west1/privateConnections/my-connection` + * @param {number} request.pageSize + * The maximum number of peering routes to return in one page. + * The service may return fewer than this value. + * The maximum value is coerced to 1000. + * The default value of this field is 500. + * @param {string} request.pageToken + * A page token, received from a previous `ListPrivateConnectionPeeringRoutes` + * call. Provide this to retrieve the subsequent page. When paginating, all + * other parameters provided to `ListPrivateConnectionPeeringRoutes` must + * match the call that provided the page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vmwareengine.v1.PeeringRoute|PeeringRoute}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vmware_engine.list_private_connection_peering_routes.js + * region_tag:vmwareengine_v1_generated_VmwareEngine_ListPrivateConnectionPeeringRoutes_async + */ listPrivateConnectionPeeringRoutesAsync( - request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vmwareengine.v1.IListPrivateConnectionPeeringRoutesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listPrivateConnectionPeeringRoutes']; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = + this._defaults['listPrivateConnectionPeeringRoutes']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listPrivateConnectionPeeringRoutes iterate %j', request); return this.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate( this.innerApiCalls['listPrivateConnectionPeeringRoutes'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + /** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ getIamPolicy( request: IamProtos.google.iam.v1.GetIamPolicyRequest, options?: @@ -12606,40 +16784,40 @@ export class VmwareEngineClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.getIamPolicy(request, options, callback); } -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ setIamPolicy( request: IamProtos.google.iam.v1.SetIamPolicyRequest, options?: @@ -12653,41 +16831,41 @@ export class VmwareEngineClient { IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { + >, + ): Promise<[IamProtos.google.iam.v1.Policy]> { return this.iamClient.setIamPolicy(request, options, callback); } -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ + /** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ testIamPermissions( request: IamProtos.google.iam.v1.TestIamPermissionsRequest, options?: @@ -12701,12 +16879,12 @@ export class VmwareEngineClient { IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { + >, + ): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { return this.iamClient.testIamPermissions(request, options, callback); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -12741,12 +16919,11 @@ export class VmwareEngineClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -12779,12 +16956,12 @@ export class VmwareEngineClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } -/** + /** * Gets the latest state of a long-running operation. Clients can use this * method to poll the operation result at intervals as recommended by the API * service. @@ -12827,22 +17004,22 @@ export class VmwareEngineClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -12877,15 +17054,15 @@ export class VmwareEngineClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -12919,7 +17096,7 @@ export class VmwareEngineClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -12932,25 +17109,24 @@ export class VmwareEngineClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.cancelOperation(request, options, callback); } - /** * Deletes a long-running operation. This method indicates that the client is * no longer interested in the operation result. It does not cancel the @@ -12989,22 +17165,22 @@ export class VmwareEngineClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -13021,7 +17197,12 @@ export class VmwareEngineClient { * @param {string} cluster * @returns {string} Resource name string. */ - clusterPath(project:string,location:string,privateCloud:string,cluster:string) { + clusterPath( + project: string, + location: string, + privateCloud: string, + cluster: string, + ) { return this.pathTemplates.clusterPathTemplate.render({ project: project, location: location, @@ -13060,7 +17241,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the private_cloud. */ matchPrivateCloudFromClusterName(clusterName: string) { - return this.pathTemplates.clusterPathTemplate.match(clusterName).private_cloud; + return this.pathTemplates.clusterPathTemplate.match(clusterName) + .private_cloud; } /** @@ -13081,7 +17263,7 @@ export class VmwareEngineClient { * @param {string} location * @returns {string} Resource name string. */ - dnsBindPermissionPath(project:string,location:string) { + dnsBindPermissionPath(project: string, location: string) { return this.pathTemplates.dnsBindPermissionPathTemplate.render({ project: project, location: location, @@ -13096,7 +17278,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the project. */ matchProjectFromDnsBindPermissionName(dnsBindPermissionName: string) { - return this.pathTemplates.dnsBindPermissionPathTemplate.match(dnsBindPermissionName).project; + return this.pathTemplates.dnsBindPermissionPathTemplate.match( + dnsBindPermissionName, + ).project; } /** @@ -13107,7 +17291,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the location. */ matchLocationFromDnsBindPermissionName(dnsBindPermissionName: string) { - return this.pathTemplates.dnsBindPermissionPathTemplate.match(dnsBindPermissionName).location; + return this.pathTemplates.dnsBindPermissionPathTemplate.match( + dnsBindPermissionName, + ).location; } /** @@ -13118,7 +17304,7 @@ export class VmwareEngineClient { * @param {string} private_cloud * @returns {string} Resource name string. */ - dnsForwardingPath(project:string,location:string,privateCloud:string) { + dnsForwardingPath(project: string, location: string, privateCloud: string) { return this.pathTemplates.dnsForwardingPathTemplate.render({ project: project, location: location, @@ -13134,7 +17320,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the project. */ matchProjectFromDnsForwardingName(dnsForwardingName: string) { - return this.pathTemplates.dnsForwardingPathTemplate.match(dnsForwardingName).project; + return this.pathTemplates.dnsForwardingPathTemplate.match(dnsForwardingName) + .project; } /** @@ -13145,7 +17332,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the location. */ matchLocationFromDnsForwardingName(dnsForwardingName: string) { - return this.pathTemplates.dnsForwardingPathTemplate.match(dnsForwardingName).location; + return this.pathTemplates.dnsForwardingPathTemplate.match(dnsForwardingName) + .location; } /** @@ -13156,7 +17344,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the private_cloud. */ matchPrivateCloudFromDnsForwardingName(dnsForwardingName: string) { - return this.pathTemplates.dnsForwardingPathTemplate.match(dnsForwardingName).private_cloud; + return this.pathTemplates.dnsForwardingPathTemplate.match(dnsForwardingName) + .private_cloud; } /** @@ -13168,7 +17357,12 @@ export class VmwareEngineClient { * @param {string} external_access_rule * @returns {string} Resource name string. */ - externalAccessRulePath(project:string,location:string,networkPolicy:string,externalAccessRule:string) { + externalAccessRulePath( + project: string, + location: string, + networkPolicy: string, + externalAccessRule: string, + ) { return this.pathTemplates.externalAccessRulePathTemplate.render({ project: project, location: location, @@ -13185,7 +17379,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the project. */ matchProjectFromExternalAccessRuleName(externalAccessRuleName: string) { - return this.pathTemplates.externalAccessRulePathTemplate.match(externalAccessRuleName).project; + return this.pathTemplates.externalAccessRulePathTemplate.match( + externalAccessRuleName, + ).project; } /** @@ -13196,7 +17392,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the location. */ matchLocationFromExternalAccessRuleName(externalAccessRuleName: string) { - return this.pathTemplates.externalAccessRulePathTemplate.match(externalAccessRuleName).location; + return this.pathTemplates.externalAccessRulePathTemplate.match( + externalAccessRuleName, + ).location; } /** @@ -13207,7 +17405,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the network_policy. */ matchNetworkPolicyFromExternalAccessRuleName(externalAccessRuleName: string) { - return this.pathTemplates.externalAccessRulePathTemplate.match(externalAccessRuleName).network_policy; + return this.pathTemplates.externalAccessRulePathTemplate.match( + externalAccessRuleName, + ).network_policy; } /** @@ -13217,8 +17417,12 @@ export class VmwareEngineClient { * A fully-qualified path representing ExternalAccessRule resource. * @returns {string} A string representing the external_access_rule. */ - matchExternalAccessRuleFromExternalAccessRuleName(externalAccessRuleName: string) { - return this.pathTemplates.externalAccessRulePathTemplate.match(externalAccessRuleName).external_access_rule; + matchExternalAccessRuleFromExternalAccessRuleName( + externalAccessRuleName: string, + ) { + return this.pathTemplates.externalAccessRulePathTemplate.match( + externalAccessRuleName, + ).external_access_rule; } /** @@ -13230,7 +17434,12 @@ export class VmwareEngineClient { * @param {string} external_address * @returns {string} Resource name string. */ - externalAddressPath(project:string,location:string,privateCloud:string,externalAddress:string) { + externalAddressPath( + project: string, + location: string, + privateCloud: string, + externalAddress: string, + ) { return this.pathTemplates.externalAddressPathTemplate.render({ project: project, location: location, @@ -13247,7 +17456,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the project. */ matchProjectFromExternalAddressName(externalAddressName: string) { - return this.pathTemplates.externalAddressPathTemplate.match(externalAddressName).project; + return this.pathTemplates.externalAddressPathTemplate.match( + externalAddressName, + ).project; } /** @@ -13258,7 +17469,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the location. */ matchLocationFromExternalAddressName(externalAddressName: string) { - return this.pathTemplates.externalAddressPathTemplate.match(externalAddressName).location; + return this.pathTemplates.externalAddressPathTemplate.match( + externalAddressName, + ).location; } /** @@ -13269,7 +17482,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the private_cloud. */ matchPrivateCloudFromExternalAddressName(externalAddressName: string) { - return this.pathTemplates.externalAddressPathTemplate.match(externalAddressName).private_cloud; + return this.pathTemplates.externalAddressPathTemplate.match( + externalAddressName, + ).private_cloud; } /** @@ -13280,7 +17495,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the external_address. */ matchExternalAddressFromExternalAddressName(externalAddressName: string) { - return this.pathTemplates.externalAddressPathTemplate.match(externalAddressName).external_address; + return this.pathTemplates.externalAddressPathTemplate.match( + externalAddressName, + ).external_address; } /** @@ -13292,7 +17509,12 @@ export class VmwareEngineClient { * @param {string} hcx_activation_key * @returns {string} Resource name string. */ - hcxActivationKeyPath(project:string,location:string,privateCloud:string,hcxActivationKey:string) { + hcxActivationKeyPath( + project: string, + location: string, + privateCloud: string, + hcxActivationKey: string, + ) { return this.pathTemplates.hcxActivationKeyPathTemplate.render({ project: project, location: location, @@ -13309,7 +17531,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the project. */ matchProjectFromHcxActivationKeyName(hcxActivationKeyName: string) { - return this.pathTemplates.hcxActivationKeyPathTemplate.match(hcxActivationKeyName).project; + return this.pathTemplates.hcxActivationKeyPathTemplate.match( + hcxActivationKeyName, + ).project; } /** @@ -13320,7 +17544,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the location. */ matchLocationFromHcxActivationKeyName(hcxActivationKeyName: string) { - return this.pathTemplates.hcxActivationKeyPathTemplate.match(hcxActivationKeyName).location; + return this.pathTemplates.hcxActivationKeyPathTemplate.match( + hcxActivationKeyName, + ).location; } /** @@ -13331,7 +17557,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the private_cloud. */ matchPrivateCloudFromHcxActivationKeyName(hcxActivationKeyName: string) { - return this.pathTemplates.hcxActivationKeyPathTemplate.match(hcxActivationKeyName).private_cloud; + return this.pathTemplates.hcxActivationKeyPathTemplate.match( + hcxActivationKeyName, + ).private_cloud; } /** @@ -13342,7 +17570,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the hcx_activation_key. */ matchHcxActivationKeyFromHcxActivationKeyName(hcxActivationKeyName: string) { - return this.pathTemplates.hcxActivationKeyPathTemplate.match(hcxActivationKeyName).hcx_activation_key; + return this.pathTemplates.hcxActivationKeyPathTemplate.match( + hcxActivationKeyName, + ).hcx_activation_key; } /** @@ -13352,7 +17582,7 @@ export class VmwareEngineClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -13390,7 +17620,12 @@ export class VmwareEngineClient { * @param {string} logging_server * @returns {string} Resource name string. */ - loggingServerPath(project:string,location:string,privateCloud:string,loggingServer:string) { + loggingServerPath( + project: string, + location: string, + privateCloud: string, + loggingServer: string, + ) { return this.pathTemplates.loggingServerPathTemplate.render({ project: project, location: location, @@ -13407,7 +17642,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the project. */ matchProjectFromLoggingServerName(loggingServerName: string) { - return this.pathTemplates.loggingServerPathTemplate.match(loggingServerName).project; + return this.pathTemplates.loggingServerPathTemplate.match(loggingServerName) + .project; } /** @@ -13418,7 +17654,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the location. */ matchLocationFromLoggingServerName(loggingServerName: string) { - return this.pathTemplates.loggingServerPathTemplate.match(loggingServerName).location; + return this.pathTemplates.loggingServerPathTemplate.match(loggingServerName) + .location; } /** @@ -13429,7 +17666,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the private_cloud. */ matchPrivateCloudFromLoggingServerName(loggingServerName: string) { - return this.pathTemplates.loggingServerPathTemplate.match(loggingServerName).private_cloud; + return this.pathTemplates.loggingServerPathTemplate.match(loggingServerName) + .private_cloud; } /** @@ -13440,7 +17678,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the logging_server. */ matchLoggingServerFromLoggingServerName(loggingServerName: string) { - return this.pathTemplates.loggingServerPathTemplate.match(loggingServerName).logging_server; + return this.pathTemplates.loggingServerPathTemplate.match(loggingServerName) + .logging_server; } /** @@ -13452,7 +17691,12 @@ export class VmwareEngineClient { * @param {string} management_dns_zone_binding * @returns {string} Resource name string. */ - managementDnsZoneBindingPath(project:string,location:string,privateCloud:string,managementDnsZoneBinding:string) { + managementDnsZoneBindingPath( + project: string, + location: string, + privateCloud: string, + managementDnsZoneBinding: string, + ) { return this.pathTemplates.managementDnsZoneBindingPathTemplate.render({ project: project, location: location, @@ -13468,8 +17712,12 @@ export class VmwareEngineClient { * A fully-qualified path representing ManagementDnsZoneBinding resource. * @returns {string} A string representing the project. */ - matchProjectFromManagementDnsZoneBindingName(managementDnsZoneBindingName: string) { - return this.pathTemplates.managementDnsZoneBindingPathTemplate.match(managementDnsZoneBindingName).project; + matchProjectFromManagementDnsZoneBindingName( + managementDnsZoneBindingName: string, + ) { + return this.pathTemplates.managementDnsZoneBindingPathTemplate.match( + managementDnsZoneBindingName, + ).project; } /** @@ -13479,8 +17727,12 @@ export class VmwareEngineClient { * A fully-qualified path representing ManagementDnsZoneBinding resource. * @returns {string} A string representing the location. */ - matchLocationFromManagementDnsZoneBindingName(managementDnsZoneBindingName: string) { - return this.pathTemplates.managementDnsZoneBindingPathTemplate.match(managementDnsZoneBindingName).location; + matchLocationFromManagementDnsZoneBindingName( + managementDnsZoneBindingName: string, + ) { + return this.pathTemplates.managementDnsZoneBindingPathTemplate.match( + managementDnsZoneBindingName, + ).location; } /** @@ -13490,8 +17742,12 @@ export class VmwareEngineClient { * A fully-qualified path representing ManagementDnsZoneBinding resource. * @returns {string} A string representing the private_cloud. */ - matchPrivateCloudFromManagementDnsZoneBindingName(managementDnsZoneBindingName: string) { - return this.pathTemplates.managementDnsZoneBindingPathTemplate.match(managementDnsZoneBindingName).private_cloud; + matchPrivateCloudFromManagementDnsZoneBindingName( + managementDnsZoneBindingName: string, + ) { + return this.pathTemplates.managementDnsZoneBindingPathTemplate.match( + managementDnsZoneBindingName, + ).private_cloud; } /** @@ -13501,8 +17757,12 @@ export class VmwareEngineClient { * A fully-qualified path representing ManagementDnsZoneBinding resource. * @returns {string} A string representing the management_dns_zone_binding. */ - matchManagementDnsZoneBindingFromManagementDnsZoneBindingName(managementDnsZoneBindingName: string) { - return this.pathTemplates.managementDnsZoneBindingPathTemplate.match(managementDnsZoneBindingName).management_dns_zone_binding; + matchManagementDnsZoneBindingFromManagementDnsZoneBindingName( + managementDnsZoneBindingName: string, + ) { + return this.pathTemplates.managementDnsZoneBindingPathTemplate.match( + managementDnsZoneBindingName, + ).management_dns_zone_binding; } /** @@ -13513,7 +17773,11 @@ export class VmwareEngineClient { * @param {string} network_peering * @returns {string} Resource name string. */ - networkPeeringPath(project:string,location:string,networkPeering:string) { + networkPeeringPath( + project: string, + location: string, + networkPeering: string, + ) { return this.pathTemplates.networkPeeringPathTemplate.render({ project: project, location: location, @@ -13529,7 +17793,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the project. */ matchProjectFromNetworkPeeringName(networkPeeringName: string) { - return this.pathTemplates.networkPeeringPathTemplate.match(networkPeeringName).project; + return this.pathTemplates.networkPeeringPathTemplate.match( + networkPeeringName, + ).project; } /** @@ -13540,7 +17806,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the location. */ matchLocationFromNetworkPeeringName(networkPeeringName: string) { - return this.pathTemplates.networkPeeringPathTemplate.match(networkPeeringName).location; + return this.pathTemplates.networkPeeringPathTemplate.match( + networkPeeringName, + ).location; } /** @@ -13551,7 +17819,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the network_peering. */ matchNetworkPeeringFromNetworkPeeringName(networkPeeringName: string) { - return this.pathTemplates.networkPeeringPathTemplate.match(networkPeeringName).network_peering; + return this.pathTemplates.networkPeeringPathTemplate.match( + networkPeeringName, + ).network_peering; } /** @@ -13562,7 +17832,7 @@ export class VmwareEngineClient { * @param {string} network_policy * @returns {string} Resource name string. */ - networkPolicyPath(project:string,location:string,networkPolicy:string) { + networkPolicyPath(project: string, location: string, networkPolicy: string) { return this.pathTemplates.networkPolicyPathTemplate.render({ project: project, location: location, @@ -13578,7 +17848,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the project. */ matchProjectFromNetworkPolicyName(networkPolicyName: string) { - return this.pathTemplates.networkPolicyPathTemplate.match(networkPolicyName).project; + return this.pathTemplates.networkPolicyPathTemplate.match(networkPolicyName) + .project; } /** @@ -13589,7 +17860,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the location. */ matchLocationFromNetworkPolicyName(networkPolicyName: string) { - return this.pathTemplates.networkPolicyPathTemplate.match(networkPolicyName).location; + return this.pathTemplates.networkPolicyPathTemplate.match(networkPolicyName) + .location; } /** @@ -13600,7 +17872,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the network_policy. */ matchNetworkPolicyFromNetworkPolicyName(networkPolicyName: string) { - return this.pathTemplates.networkPolicyPathTemplate.match(networkPolicyName).network_policy; + return this.pathTemplates.networkPolicyPathTemplate.match(networkPolicyName) + .network_policy; } /** @@ -13613,7 +17886,13 @@ export class VmwareEngineClient { * @param {string} node * @returns {string} Resource name string. */ - nodePath(project:string,location:string,privateCloud:string,cluster:string,node:string) { + nodePath( + project: string, + location: string, + privateCloud: string, + cluster: string, + node: string, + ) { return this.pathTemplates.nodePathTemplate.render({ project: project, location: location, @@ -13686,7 +17965,7 @@ export class VmwareEngineClient { * @param {string} node_type * @returns {string} Resource name string. */ - nodeTypePath(project:string,location:string,nodeType:string) { + nodeTypePath(project: string, location: string, nodeType: string) { return this.pathTemplates.nodeTypePathTemplate.render({ project: project, location: location, @@ -13724,7 +18003,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the node_type. */ matchNodeTypeFromNodeTypeName(nodeTypeName: string) { - return this.pathTemplates.nodeTypePathTemplate.match(nodeTypeName).node_type; + return this.pathTemplates.nodeTypePathTemplate.match(nodeTypeName) + .node_type; } /** @@ -13735,7 +18015,7 @@ export class VmwareEngineClient { * @param {string} private_cloud * @returns {string} Resource name string. */ - privateCloudPath(project:string,location:string,privateCloud:string) { + privateCloudPath(project: string, location: string, privateCloud: string) { return this.pathTemplates.privateCloudPathTemplate.render({ project: project, location: location, @@ -13751,7 +18031,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the project. */ matchProjectFromPrivateCloudName(privateCloudName: string) { - return this.pathTemplates.privateCloudPathTemplate.match(privateCloudName).project; + return this.pathTemplates.privateCloudPathTemplate.match(privateCloudName) + .project; } /** @@ -13762,7 +18043,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the location. */ matchLocationFromPrivateCloudName(privateCloudName: string) { - return this.pathTemplates.privateCloudPathTemplate.match(privateCloudName).location; + return this.pathTemplates.privateCloudPathTemplate.match(privateCloudName) + .location; } /** @@ -13773,7 +18055,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the private_cloud. */ matchPrivateCloudFromPrivateCloudName(privateCloudName: string) { - return this.pathTemplates.privateCloudPathTemplate.match(privateCloudName).private_cloud; + return this.pathTemplates.privateCloudPathTemplate.match(privateCloudName) + .private_cloud; } /** @@ -13784,7 +18067,11 @@ export class VmwareEngineClient { * @param {string} private_connection * @returns {string} Resource name string. */ - privateConnectionPath(project:string,location:string,privateConnection:string) { + privateConnectionPath( + project: string, + location: string, + privateConnection: string, + ) { return this.pathTemplates.privateConnectionPathTemplate.render({ project: project, location: location, @@ -13800,7 +18087,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the project. */ matchProjectFromPrivateConnectionName(privateConnectionName: string) { - return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).project; + return this.pathTemplates.privateConnectionPathTemplate.match( + privateConnectionName, + ).project; } /** @@ -13811,7 +18100,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the location. */ matchLocationFromPrivateConnectionName(privateConnectionName: string) { - return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).location; + return this.pathTemplates.privateConnectionPathTemplate.match( + privateConnectionName, + ).location; } /** @@ -13821,8 +18112,12 @@ export class VmwareEngineClient { * A fully-qualified path representing PrivateConnection resource. * @returns {string} A string representing the private_connection. */ - matchPrivateConnectionFromPrivateConnectionName(privateConnectionName: string) { - return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).private_connection; + matchPrivateConnectionFromPrivateConnectionName( + privateConnectionName: string, + ) { + return this.pathTemplates.privateConnectionPathTemplate.match( + privateConnectionName, + ).private_connection; } /** @@ -13831,7 +18126,7 @@ export class VmwareEngineClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -13857,7 +18152,12 @@ export class VmwareEngineClient { * @param {string} subnet * @returns {string} Resource name string. */ - subnetPath(project:string,location:string,privateCloud:string,subnet:string) { + subnetPath( + project: string, + location: string, + privateCloud: string, + subnet: string, + ) { return this.pathTemplates.subnetPathTemplate.render({ project: project, location: location, @@ -13896,7 +18196,8 @@ export class VmwareEngineClient { * @returns {string} A string representing the private_cloud. */ matchPrivateCloudFromSubnetName(subnetName: string) { - return this.pathTemplates.subnetPathTemplate.match(subnetName).private_cloud; + return this.pathTemplates.subnetPathTemplate.match(subnetName) + .private_cloud; } /** @@ -13918,7 +18219,11 @@ export class VmwareEngineClient { * @param {string} vmware_engine_network * @returns {string} Resource name string. */ - vmwareEngineNetworkPath(project:string,location:string,vmwareEngineNetwork:string) { + vmwareEngineNetworkPath( + project: string, + location: string, + vmwareEngineNetwork: string, + ) { return this.pathTemplates.vmwareEngineNetworkPathTemplate.render({ project: project, location: location, @@ -13934,7 +18239,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the project. */ matchProjectFromVmwareEngineNetworkName(vmwareEngineNetworkName: string) { - return this.pathTemplates.vmwareEngineNetworkPathTemplate.match(vmwareEngineNetworkName).project; + return this.pathTemplates.vmwareEngineNetworkPathTemplate.match( + vmwareEngineNetworkName, + ).project; } /** @@ -13945,7 +18252,9 @@ export class VmwareEngineClient { * @returns {string} A string representing the location. */ matchLocationFromVmwareEngineNetworkName(vmwareEngineNetworkName: string) { - return this.pathTemplates.vmwareEngineNetworkPathTemplate.match(vmwareEngineNetworkName).location; + return this.pathTemplates.vmwareEngineNetworkPathTemplate.match( + vmwareEngineNetworkName, + ).location; } /** @@ -13955,8 +18264,12 @@ export class VmwareEngineClient { * A fully-qualified path representing VmwareEngineNetwork resource. * @returns {string} A string representing the vmware_engine_network. */ - matchVmwareEngineNetworkFromVmwareEngineNetworkName(vmwareEngineNetworkName: string) { - return this.pathTemplates.vmwareEngineNetworkPathTemplate.match(vmwareEngineNetworkName).vmware_engine_network; + matchVmwareEngineNetworkFromVmwareEngineNetworkName( + vmwareEngineNetworkName: string, + ) { + return this.pathTemplates.vmwareEngineNetworkPathTemplate.match( + vmwareEngineNetworkName, + ).vmware_engine_network; } /** @@ -13967,15 +18280,19 @@ export class VmwareEngineClient { */ close(): Promise { if (this.vmwareEngineStub && !this._terminated) { - return this.vmwareEngineStub.then(stub => { + return this.vmwareEngineStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); + this.iamClient.close().catch((err) => { + throw err; + }); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-vmwareengine/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-vmwareengine/system-test/fixtures/sample/src/index.ts index a222f6f2cbbc..92703fd8d1db 100644 --- a/packages/google-cloud-vmwareengine/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-vmwareengine/system-test/fixtures/sample/src/index.ts @@ -16,7 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {VmwareEngineClient} from '@google-cloud/vmwareengine'; +import { VmwareEngineClient } from '@google-cloud/vmwareengine'; // check that the client class type name can be used function doStuffWithVmwareEngineClient(client: VmwareEngineClient) { diff --git a/packages/google-cloud-vmwareengine/system-test/install.ts b/packages/google-cloud-vmwareengine/system-test/install.ts index 394f3362d203..ccf167042d2e 100644 --- a/packages/google-cloud-vmwareengine/system-test/install.ts +++ b/packages/google-cloud-vmwareengine/system-test/install.ts @@ -16,34 +16,36 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { + it('TypeScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts', + ).toString(), + }, }; await packNTest(options); }); - it('JavaScript code', async function() { + it('JavaScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } + cjs: readFileSync( + './system-test/fixtures/sample/src/index.js', + ).toString(), + }, }; await packNTest(options); }); - }); diff --git a/packages/google-cloud-vmwareengine/test/gapic_vmware_engine_v1.ts b/packages/google-cloud-vmwareengine/test/gapic_vmware_engine_v1.ts index 6c1316dea715..1b733f164fed 100644 --- a/packages/google-cloud-vmwareengine/test/gapic_vmware_engine_v1.ts +++ b/packages/google-cloud-vmwareengine/test/gapic_vmware_engine_v1.ts @@ -19,13990 +19,18348 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as vmwareengineModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + IamProtos, + LocationProtos, +} from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); } -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.VmwareEngineClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new vmwareengineModule.v1.VmwareEngineClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'vmwareengine.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new vmwareengineModule.v1.VmwareEngineClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = vmwareengineModule.v1.VmwareEngineClient.servicePath; - assert.strictEqual(servicePath, 'vmwareengine.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = vmwareengineModule.v1.VmwareEngineClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'vmwareengine.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'vmwareengine.example.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new vmwareengineModule.v1.VmwareEngineClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'vmwareengine.googleapis.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'vmwareengine.example.com'); - }); + it('has universeDomain', () => { + const client = new vmwareengineModule.v1.VmwareEngineClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new vmwareengineModule.v1.VmwareEngineClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'vmwareengine.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new vmwareengineModule.v1.VmwareEngineClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'vmwareengine.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new vmwareengineModule.v1.VmwareEngineClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + vmwareengineModule.v1.VmwareEngineClient.servicePath; + assert.strictEqual(servicePath, 'vmwareengine.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + vmwareengineModule.v1.VmwareEngineClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'vmwareengine.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'vmwareengine.example.com'); + }); - it('has port', () => { - const port = vmwareengineModule.v1.VmwareEngineClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'vmwareengine.example.com'); + }); - it('should create a client with no option', () => { - const client = new vmwareengineModule.v1.VmwareEngineClient(); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new vmwareengineModule.v1.VmwareEngineClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'vmwareengine.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'vmwareengine.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new vmwareengineModule.v1.VmwareEngineClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with gRPC fallback', () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - fallback: true, - }); - assert(client); - }); + it('has port', () => { + const port = vmwareengineModule.v1.VmwareEngineClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.vmwareEngineStub, undefined); - await client.initialize(); - assert(client.vmwareEngineStub); - }); + it('should create a client with no option', () => { + const client = new vmwareengineModule.v1.VmwareEngineClient(); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.vmwareEngineStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with gRPC fallback', () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.vmwareEngineStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.vmwareEngineStub, undefined); + await client.initialize(); + assert(client.vmwareEngineStub); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the initialized client', (done) => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.vmwareEngineStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has close method for the non-initialized client', (done) => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.vmwareEngineStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getPrivateCloud', () => { - it('invokes getPrivateCloud without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.PrivateCloud() - ); - client.innerApiCalls.getPrivateCloud = stubSimpleCall(expectedResponse); - const [response] = await client.getPrivateCloud(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes getPrivateCloud without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.PrivateCloud() - ); - client.innerApiCalls.getPrivateCloud = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPrivateCloud( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPrivateCloud|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getPrivateCloud', () => { + it('invokes getPrivateCloud without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud(), + ); + client.innerApiCalls.getPrivateCloud = stubSimpleCall(expectedResponse); + const [response] = await client.getPrivateCloud(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getPrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getPrivateCloud with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPrivateCloud = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPrivateCloud(request), expectedError); - const actualRequest = (client.innerApiCalls.getPrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getPrivateCloud without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud(), + ); + client.innerApiCalls.getPrivateCloud = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPrivateCloud( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.IPrivateCloud | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getPrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getPrivateCloud with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getPrivateCloud(request), expectedError); - }); + it('invokes getPrivateCloud with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPrivateCloud = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getPrivateCloud(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getPrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getCluster', () => { - it('invokes getCluster without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Cluster() - ); - client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); - const [response] = await client.getCluster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getPrivateCloud with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetPrivateCloudRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getPrivateCloud(request), expectedError); + }); + }); + + describe('getCluster', () => { + it('invokes getCluster without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster(), + ); + client.innerApiCalls.getCluster = stubSimpleCall(expectedResponse); + const [response] = await client.getCluster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getCluster without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Cluster() - ); - client.innerApiCalls.getCluster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCluster( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ICluster|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getCluster without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster(), + ); + client.innerApiCalls.getCluster = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getCluster( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.ICluster | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getCluster with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCluster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getCluster with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getCluster = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getCluster(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getCluster with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetClusterRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getCluster(request), expectedError); - }); + it('invokes getCluster with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getCluster(request), expectedError); + }); + }); + + describe('getNode', () => { + it('invokes getNode without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNodeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNodeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Node(), + ); + client.innerApiCalls.getNode = stubSimpleCall(expectedResponse); + const [response] = await client.getNode(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNode as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getNode', () => { - it('invokes getNode without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Node() - ); - client.innerApiCalls.getNode = stubSimpleCall(expectedResponse); - const [response] = await client.getNode(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNode without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNodeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNodeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Node(), + ); + client.innerApiCalls.getNode = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNode( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.INode | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getNode as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNode without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Node() - ); - client.innerApiCalls.getNode = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNode( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INode|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNode with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNodeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNodeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNode = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getNode(request), expectedError); + const actualRequest = (client.innerApiCalls.getNode as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNode as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNode with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNode = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNode(request), expectedError); - const actualRequest = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNode with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNodeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNodeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getNode(request), expectedError); + }); + }); + + describe('getExternalAddress', () => { + it('invokes getExternalAddress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetExternalAddressRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetExternalAddressRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ); + client.innerApiCalls.getExternalAddress = + stubSimpleCall(expectedResponse); + const [response] = await client.getExternalAddress(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNode with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getNode(request), expectedError); - }); + it('invokes getExternalAddress without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetExternalAddressRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetExternalAddressRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ); + client.innerApiCalls.getExternalAddress = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExternalAddress( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.IExternalAddress | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getExternalAddress', () => { - it('invokes getExternalAddress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetExternalAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetExternalAddressRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ExternalAddress() - ); - client.innerApiCalls.getExternalAddress = stubSimpleCall(expectedResponse); - const [response] = await client.getExternalAddress(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExternalAddress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetExternalAddressRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetExternalAddressRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExternalAddress = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getExternalAddress(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExternalAddress without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetExternalAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetExternalAddressRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ExternalAddress() - ); - client.innerApiCalls.getExternalAddress = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExternalAddress( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IExternalAddress|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExternalAddress with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetExternalAddressRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetExternalAddressRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getExternalAddress(request), expectedError); + }); + }); + + describe('getSubnet', () => { + it('invokes getSubnet without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetSubnetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetSubnetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Subnet(), + ); + client.innerApiCalls.getSubnet = stubSimpleCall(expectedResponse); + const [response] = await client.getSubnet(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSubnet as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSubnet as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExternalAddress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetExternalAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetExternalAddressRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExternalAddress = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExternalAddress(request), expectedError); - const actualRequest = (client.innerApiCalls.getExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSubnet without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetSubnetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetSubnetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Subnet(), + ); + client.innerApiCalls.getSubnet = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSubnet( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.ISubnet | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSubnet as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSubnet as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExternalAddress with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetExternalAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetExternalAddressRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getExternalAddress(request), expectedError); - }); + it('invokes getSubnet with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetSubnetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetSubnetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSubnet = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSubnet(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSubnet as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSubnet as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getSubnet', () => { - it('invokes getSubnet without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetSubnetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetSubnetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Subnet() - ); - client.innerApiCalls.getSubnet = stubSimpleCall(expectedResponse); - const [response] = await client.getSubnet(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSubnet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSubnet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getSubnet with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetSubnetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetSubnetRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getSubnet(request), expectedError); + }); + }); + + describe('getExternalAccessRule', () => { + it('invokes getExternalAccessRule without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAccessRule(), + ); + client.innerApiCalls.getExternalAccessRule = + stubSimpleCall(expectedResponse); + const [response] = await client.getExternalAccessRule(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSubnet without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetSubnetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetSubnetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Subnet() - ); - client.innerApiCalls.getSubnet = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSubnet( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ISubnet|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSubnet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSubnet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExternalAccessRule without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAccessRule(), + ); + client.innerApiCalls.getExternalAccessRule = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExternalAccessRule( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.IExternalAccessRule | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSubnet with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetSubnetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetSubnetRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSubnet = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSubnet(request), expectedError); - const actualRequest = (client.innerApiCalls.getSubnet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSubnet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExternalAccessRule with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExternalAccessRule = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getExternalAccessRule(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getSubnet with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetSubnetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetSubnetRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSubnet(request), expectedError); - }); + it('invokes getExternalAccessRule with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getExternalAccessRule(request), + expectedError, + ); + }); + }); + + describe('getLoggingServer', () => { + it('invokes getLoggingServer without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetLoggingServerRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetLoggingServerRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.LoggingServer(), + ); + client.innerApiCalls.getLoggingServer = stubSimpleCall(expectedResponse); + const [response] = await client.getLoggingServer(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getExternalAccessRule', () => { - it('invokes getExternalAccessRule without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ExternalAccessRule() - ); - client.innerApiCalls.getExternalAccessRule = stubSimpleCall(expectedResponse); - const [response] = await client.getExternalAccessRule(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getLoggingServer without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetLoggingServerRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetLoggingServerRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.LoggingServer(), + ); + client.innerApiCalls.getLoggingServer = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLoggingServer( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.ILoggingServer | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExternalAccessRule without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ExternalAccessRule() - ); - client.innerApiCalls.getExternalAccessRule = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExternalAccessRule( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IExternalAccessRule|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getLoggingServer with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetLoggingServerRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetLoggingServerRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getLoggingServer = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getLoggingServer(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExternalAccessRule with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExternalAccessRule = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExternalAccessRule(request), expectedError); - const actualRequest = (client.innerApiCalls.getExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getLoggingServer with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetLoggingServerRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetLoggingServerRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getLoggingServer(request), expectedError); + }); + }); + + describe('getNodeType', () => { + it('invokes getNodeType without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNodeTypeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType(), + ); + client.innerApiCalls.getNodeType = stubSimpleCall(expectedResponse); + const [response] = await client.getNodeType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getNodeType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNodeType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExternalAccessRule with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetExternalAccessRuleRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getExternalAccessRule(request), expectedError); - }); + it('invokes getNodeType without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNodeTypeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType(), + ); + client.innerApiCalls.getNodeType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNodeType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.INodeType | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getNodeType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNodeType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getLoggingServer', () => { - it('invokes getLoggingServer without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetLoggingServerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetLoggingServerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.LoggingServer() - ); - client.innerApiCalls.getLoggingServer = stubSimpleCall(expectedResponse); - const [response] = await client.getLoggingServer(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNodeType with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNodeTypeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNodeType = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getNodeType(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getNodeType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNodeType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getLoggingServer without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetLoggingServerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetLoggingServerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.LoggingServer() - ); - client.innerApiCalls.getLoggingServer = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLoggingServer( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ILoggingServer|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNodeType with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNodeTypeRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getNodeType(request), expectedError); + }); + }); + + describe('showNsxCredentials', () => { + it('invokes showNsxCredentials without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Credentials(), + ); + client.innerApiCalls.showNsxCredentials = + stubSimpleCall(expectedResponse); + const [response] = await client.showNsxCredentials(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.showNsxCredentials as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.showNsxCredentials as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getLoggingServer with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetLoggingServerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetLoggingServerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLoggingServer = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLoggingServer(request), expectedError); - const actualRequest = (client.innerApiCalls.getLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes showNsxCredentials without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Credentials(), + ); + client.innerApiCalls.showNsxCredentials = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.showNsxCredentials( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.ICredentials | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.showNsxCredentials as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.showNsxCredentials as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getLoggingServer with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetLoggingServerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetLoggingServerRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getLoggingServer(request), expectedError); - }); + it('invokes showNsxCredentials with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.showNsxCredentials = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.showNsxCredentials(request), expectedError); + const actualRequest = ( + client.innerApiCalls.showNsxCredentials as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.showNsxCredentials as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getNodeType', () => { - it('invokes getNodeType without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.NodeType() - ); - client.innerApiCalls.getNodeType = stubSimpleCall(expectedResponse); - const [response] = await client.getNodeType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNodeType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodeType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes showNsxCredentials with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.showNsxCredentials(request), expectedError); + }); + }); + + describe('showVcenterCredentials', () => { + it('invokes showVcenterCredentials without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Credentials(), + ); + client.innerApiCalls.showVcenterCredentials = + stubSimpleCall(expectedResponse); + const [response] = await client.showVcenterCredentials(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.showVcenterCredentials as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.showVcenterCredentials as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNodeType without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.NodeType() - ); - client.innerApiCalls.getNodeType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNodeType( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INodeType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNodeType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodeType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes showVcenterCredentials without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Credentials(), + ); + client.innerApiCalls.showVcenterCredentials = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.showVcenterCredentials( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.ICredentials | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.showVcenterCredentials as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.showVcenterCredentials as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNodeType with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNodeType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNodeType(request), expectedError); - const actualRequest = (client.innerApiCalls.getNodeType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNodeType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes showVcenterCredentials with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.showVcenterCredentials = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.showVcenterCredentials(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.showVcenterCredentials as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.showVcenterCredentials as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNodeType with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNodeTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNodeTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getNodeType(request), expectedError); - }); + it('invokes showVcenterCredentials with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.showVcenterCredentials(request), + expectedError, + ); + }); + }); + + describe('getDnsForwarding', () => { + it('invokes getDnsForwarding without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetDnsForwardingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetDnsForwardingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DnsForwarding(), + ); + client.innerApiCalls.getDnsForwarding = stubSimpleCall(expectedResponse); + const [response] = await client.getDnsForwarding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDnsForwarding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsForwarding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('showNsxCredentials', () => { - it('invokes showNsxCredentials without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Credentials() - ); - client.innerApiCalls.showNsxCredentials = stubSimpleCall(expectedResponse); - const [response] = await client.showNsxCredentials(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.showNsxCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.showNsxCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDnsForwarding without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetDnsForwardingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetDnsForwardingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DnsForwarding(), + ); + client.innerApiCalls.getDnsForwarding = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDnsForwarding( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.IDnsForwarding | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDnsForwarding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsForwarding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes showNsxCredentials without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Credentials() - ); - client.innerApiCalls.showNsxCredentials = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.showNsxCredentials( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ICredentials|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.showNsxCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.showNsxCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDnsForwarding with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetDnsForwardingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetDnsForwardingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDnsForwarding = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDnsForwarding(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDnsForwarding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsForwarding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes showNsxCredentials with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.showNsxCredentials = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.showNsxCredentials(request), expectedError); - const actualRequest = (client.innerApiCalls.showNsxCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.showNsxCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDnsForwarding with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetDnsForwardingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetDnsForwardingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDnsForwarding(request), expectedError); + }); + }); + + describe('getNetworkPeering', () => { + it('invokes getNetworkPeering without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPeering(), + ); + client.innerApiCalls.getNetworkPeering = stubSimpleCall(expectedResponse); + const [response] = await client.getNetworkPeering(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes showNsxCredentials with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.showNsxCredentials(request), expectedError); - }); + it('invokes getNetworkPeering without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPeering(), + ); + client.innerApiCalls.getNetworkPeering = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNetworkPeering( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.INetworkPeering | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('showVcenterCredentials', () => { - it('invokes showVcenterCredentials without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Credentials() - ); - client.innerApiCalls.showVcenterCredentials = stubSimpleCall(expectedResponse); - const [response] = await client.showVcenterCredentials(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.showVcenterCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.showVcenterCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNetworkPeering with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNetworkPeering = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getNetworkPeering(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes showVcenterCredentials without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.Credentials() - ); - client.innerApiCalls.showVcenterCredentials = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.showVcenterCredentials( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ICredentials|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.showVcenterCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.showVcenterCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNetworkPeering with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getNetworkPeering(request), expectedError); + }); + }); + + describe('getHcxActivationKey', () => { + it('invokes getHcxActivationKey without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey(), + ); + client.innerApiCalls.getHcxActivationKey = + stubSimpleCall(expectedResponse); + const [response] = await client.getHcxActivationKey(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getHcxActivationKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getHcxActivationKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes showVcenterCredentials with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.showVcenterCredentials = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.showVcenterCredentials(request), expectedError); - const actualRequest = (client.innerApiCalls.showVcenterCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.showVcenterCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getHcxActivationKey without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey(), + ); + client.innerApiCalls.getHcxActivationKey = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getHcxActivationKey( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.IHcxActivationKey | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getHcxActivationKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getHcxActivationKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes showVcenterCredentials with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ShowVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.showVcenterCredentials(request), expectedError); - }); + it('invokes getHcxActivationKey with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getHcxActivationKey = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getHcxActivationKey(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getHcxActivationKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getHcxActivationKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getDnsForwarding', () => { - it('invokes getDnsForwarding without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetDnsForwardingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetDnsForwardingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DnsForwarding() - ); - client.innerApiCalls.getDnsForwarding = stubSimpleCall(expectedResponse); - const [response] = await client.getDnsForwarding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDnsForwarding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsForwarding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getHcxActivationKey with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getHcxActivationKey(request), expectedError); + }); + }); + + describe('getNetworkPolicy', () => { + it('invokes getNetworkPolicy without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy(), + ); + client.innerApiCalls.getNetworkPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getNetworkPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDnsForwarding without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetDnsForwardingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetDnsForwardingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DnsForwarding() - ); - client.innerApiCalls.getDnsForwarding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDnsForwarding( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IDnsForwarding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDnsForwarding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsForwarding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNetworkPolicy without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy(), + ); + client.innerApiCalls.getNetworkPolicy = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getNetworkPolicy( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.INetworkPolicy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDnsForwarding with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetDnsForwardingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetDnsForwardingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDnsForwarding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDnsForwarding(request), expectedError); - const actualRequest = (client.innerApiCalls.getDnsForwarding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsForwarding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getNetworkPolicy with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getNetworkPolicy = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getNetworkPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDnsForwarding with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetDnsForwardingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetDnsForwardingRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDnsForwarding(request), expectedError); - }); + it('invokes getNetworkPolicy with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getNetworkPolicy(request), expectedError); + }); + }); + + describe('getManagementDnsZoneBinding', () => { + it('invokes getManagementDnsZoneBinding without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding(), + ); + client.innerApiCalls.getManagementDnsZoneBinding = + stubSimpleCall(expectedResponse); + const [response] = await client.getManagementDnsZoneBinding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getNetworkPeering', () => { - it('invokes getNetworkPeering without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.NetworkPeering() - ); - client.innerApiCalls.getNetworkPeering = stubSimpleCall(expectedResponse); - const [response] = await client.getNetworkPeering(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getManagementDnsZoneBinding without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding(), + ); + client.innerApiCalls.getManagementDnsZoneBinding = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getManagementDnsZoneBinding( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNetworkPeering without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.NetworkPeering() - ); - client.innerApiCalls.getNetworkPeering = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNetworkPeering( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INetworkPeering|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getManagementDnsZoneBinding with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getManagementDnsZoneBinding = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getManagementDnsZoneBinding(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNetworkPeering with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNetworkPeering = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNetworkPeering(request), expectedError); - const actualRequest = (client.innerApiCalls.getNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getManagementDnsZoneBinding with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getManagementDnsZoneBinding(request), + expectedError, + ); + }); + }); + + describe('getVmwareEngineNetwork', () => { + it('invokes getVmwareEngineNetwork without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork(), + ); + client.innerApiCalls.getVmwareEngineNetwork = + stubSimpleCall(expectedResponse); + const [response] = await client.getVmwareEngineNetwork(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNetworkPeering with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPeeringRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getNetworkPeering(request), expectedError); - }); + it('invokes getVmwareEngineNetwork without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork(), + ); + client.innerApiCalls.getVmwareEngineNetwork = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getVmwareEngineNetwork( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getHcxActivationKey', () => { - it('invokes getHcxActivationKey without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.HcxActivationKey() - ); - client.innerApiCalls.getHcxActivationKey = stubSimpleCall(expectedResponse); - const [response] = await client.getHcxActivationKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getHcxActivationKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getHcxActivationKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getVmwareEngineNetwork with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getVmwareEngineNetwork = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getVmwareEngineNetwork(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getHcxActivationKey without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.HcxActivationKey() - ); - client.innerApiCalls.getHcxActivationKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getHcxActivationKey( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IHcxActivationKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getHcxActivationKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getHcxActivationKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getVmwareEngineNetwork with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getVmwareEngineNetwork(request), + expectedError, + ); + }); + }); + + describe('getPrivateConnection', () => { + it('invokes getPrivateConnection without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection(), + ); + client.innerApiCalls.getPrivateConnection = + stubSimpleCall(expectedResponse); + const [response] = await client.getPrivateConnection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getPrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getHcxActivationKey with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getHcxActivationKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getHcxActivationKey(request), expectedError); - const actualRequest = (client.innerApiCalls.getHcxActivationKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getHcxActivationKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getPrivateConnection without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection(), + ); + client.innerApiCalls.getPrivateConnection = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPrivateConnection( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.IPrivateConnection | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getPrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getHcxActivationKey with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetHcxActivationKeyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getHcxActivationKey(request), expectedError); - }); + it('invokes getPrivateConnection with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPrivateConnection = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getPrivateConnection(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getPrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getPrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getNetworkPolicy', () => { - it('invokes getNetworkPolicy without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.NetworkPolicy() - ); - client.innerApiCalls.getNetworkPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getNetworkPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getPrivateConnection with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getPrivateConnection(request), expectedError); + }); + }); + + describe('getDnsBindPermission', () => { + it('invokes getDnsBindPermission without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DnsBindPermission(), + ); + client.innerApiCalls.getDnsBindPermission = + stubSimpleCall(expectedResponse); + const [response] = await client.getDnsBindPermission(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDnsBindPermission as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsBindPermission as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNetworkPolicy without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.NetworkPolicy() - ); - client.innerApiCalls.getNetworkPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNetworkPolicy( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INetworkPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDnsBindPermission without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DnsBindPermission(), + ); + client.innerApiCalls.getDnsBindPermission = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDnsBindPermission( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.IDnsBindPermission | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDnsBindPermission as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsBindPermission as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNetworkPolicy with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNetworkPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNetworkPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDnsBindPermission with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDnsBindPermission = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDnsBindPermission(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDnsBindPermission as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDnsBindPermission as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getNetworkPolicy with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getNetworkPolicy(request), expectedError); - }); + it('invokes getDnsBindPermission with closed client', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDnsBindPermission(request), expectedError); + }); + }); + + describe('createPrivateCloud', () => { + it('invokes createPrivateCloud without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createPrivateCloud = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createPrivateCloud(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createPrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getManagementDnsZoneBinding', () => { - it('invokes getManagementDnsZoneBinding without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding() - ); - client.innerApiCalls.getManagementDnsZoneBinding = stubSimpleCall(expectedResponse); - const [response] = await client.getManagementDnsZoneBinding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createPrivateCloud without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createPrivateCloud = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createPrivateCloud( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createPrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getManagementDnsZoneBinding without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding() - ); - client.innerApiCalls.getManagementDnsZoneBinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getManagementDnsZoneBinding( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createPrivateCloud with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPrivateCloud = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createPrivateCloud(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createPrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getManagementDnsZoneBinding with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getManagementDnsZoneBinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getManagementDnsZoneBinding(request), expectedError); - const actualRequest = (client.innerApiCalls.getManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createPrivateCloud with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPrivateCloud = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createPrivateCloud(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createPrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getManagementDnsZoneBinding with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetManagementDnsZoneBindingRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getManagementDnsZoneBinding(request), expectedError); - }); + it('invokes checkCreatePrivateCloudProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreatePrivateCloudProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('getVmwareEngineNetwork', () => { - it('invokes getVmwareEngineNetwork without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork() - ); - client.innerApiCalls.getVmwareEngineNetwork = stubSimpleCall(expectedResponse); - const [response] = await client.getVmwareEngineNetwork(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreatePrivateCloudProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreatePrivateCloudProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updatePrivateCloud', () => { + it('invokes updatePrivateCloud without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest(), + ); + request.privateCloud ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', + ['privateCloud', 'name'], + ); + request.privateCloud.name = defaultValue1; + const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updatePrivateCloud = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updatePrivateCloud(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updatePrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updatePrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getVmwareEngineNetwork without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork() - ); - client.innerApiCalls.getVmwareEngineNetwork = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getVmwareEngineNetwork( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updatePrivateCloud without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest(), + ); + request.privateCloud ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', + ['privateCloud', 'name'], + ); + request.privateCloud.name = defaultValue1; + const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updatePrivateCloud = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updatePrivateCloud( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updatePrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updatePrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getVmwareEngineNetwork with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getVmwareEngineNetwork = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getVmwareEngineNetwork(request), expectedError); - const actualRequest = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updatePrivateCloud with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest(), + ); + request.privateCloud ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', + ['privateCloud', 'name'], + ); + request.privateCloud.name = defaultValue1; + const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePrivateCloud = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updatePrivateCloud(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updatePrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updatePrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getVmwareEngineNetwork with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getVmwareEngineNetwork(request), expectedError); - }); + it('invokes updatePrivateCloud with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest(), + ); + request.privateCloud ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', + ['privateCloud', 'name'], + ); + request.privateCloud.name = defaultValue1; + const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePrivateCloud = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updatePrivateCloud(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updatePrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updatePrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getPrivateConnection', () => { - it('invokes getPrivateConnection without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.PrivateConnection() - ); - client.innerApiCalls.getPrivateConnection = stubSimpleCall(expectedResponse); - const [response] = await client.getPrivateConnection(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdatePrivateCloudProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdatePrivateCloudProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes getPrivateConnection without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.PrivateConnection() - ); - client.innerApiCalls.getPrivateConnection = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPrivateConnection( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPrivateConnection|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdatePrivateCloudProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdatePrivateCloudProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deletePrivateCloud', () => { + it('invokes deletePrivateCloud without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deletePrivateCloud = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deletePrivateCloud(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deletePrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getPrivateConnection with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPrivateConnection = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPrivateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deletePrivateCloud without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deletePrivateCloud = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePrivateCloud( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deletePrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getPrivateConnection with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getPrivateConnection(request), expectedError); - }); + it('invokes deletePrivateCloud with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePrivateCloud = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deletePrivateCloud(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deletePrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getDnsBindPermission', () => { - it('invokes getDnsBindPermission without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DnsBindPermission() - ); - client.innerApiCalls.getDnsBindPermission = stubSimpleCall(expectedResponse); - const [response] = await client.getDnsBindPermission(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDnsBindPermission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsBindPermission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deletePrivateCloud with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePrivateCloud = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deletePrivateCloud(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deletePrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDnsBindPermission without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DnsBindPermission() - ); - client.innerApiCalls.getDnsBindPermission = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDnsBindPermission( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IDnsBindPermission|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDnsBindPermission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsBindPermission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeletePrivateCloudProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeletePrivateCloudProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes getDnsBindPermission with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDnsBindPermission = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDnsBindPermission(request), expectedError); - const actualRequest = (client.innerApiCalls.getDnsBindPermission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDnsBindPermission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeletePrivateCloudProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeletePrivateCloudProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('undeletePrivateCloud', () => { + it('invokes undeletePrivateCloud without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.undeletePrivateCloud = + stubLongRunningCall(expectedResponse); + const [operation] = await client.undeletePrivateCloud(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.undeletePrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeletePrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDnsBindPermission with closed client', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GetDnsBindPermissionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDnsBindPermission(request), expectedError); - }); + it('invokes undeletePrivateCloud without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.undeletePrivateCloud = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.undeletePrivateCloud( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.undeletePrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeletePrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createPrivateCloud', () => { - it('invokes createPrivateCloud without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPrivateCloud = stubLongRunningCall(expectedResponse); - const [operation] = await client.createPrivateCloud(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes undeletePrivateCloud with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.undeletePrivateCloud = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.undeletePrivateCloud(request), expectedError); + const actualRequest = ( + client.innerApiCalls.undeletePrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeletePrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createPrivateCloud without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPrivateCloud = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createPrivateCloud( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes undeletePrivateCloud with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.undeletePrivateCloud = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.undeletePrivateCloud(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.undeletePrivateCloud as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeletePrivateCloud as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createPrivateCloud with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPrivateCloud = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createPrivateCloud(request), expectedError); - const actualRequest = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUndeletePrivateCloudProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUndeletePrivateCloudProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createPrivateCloud with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateCloudRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPrivateCloud = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createPrivateCloud(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUndeletePrivateCloudProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUndeletePrivateCloudProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createCluster', () => { + it('invokes createCluster without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateClusterRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createCluster = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreatePrivateCloudProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreatePrivateCloudProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createCluster without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateClusterRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createCluster = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createCluster( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreatePrivateCloudProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreatePrivateCloudProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createCluster with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateClusterRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCluster = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createCluster(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updatePrivateCloud', () => { - it('invokes updatePrivateCloud without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest() - ); - request.privateCloud ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', ['privateCloud', 'name']); - request.privateCloud.name = defaultValue1; - const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updatePrivateCloud = stubLongRunningCall(expectedResponse); - const [operation] = await client.updatePrivateCloud(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createCluster with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateClusterRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createCluster = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updatePrivateCloud without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest() - ); - request.privateCloud ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', ['privateCloud', 'name']); - request.privateCloud.name = defaultValue1; - const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updatePrivateCloud = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updatePrivateCloud( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateClusterProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateClusterProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updatePrivateCloud with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest() - ); - request.privateCloud ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', ['privateCloud', 'name']); - request.privateCloud.name = defaultValue1; - const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePrivateCloud = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updatePrivateCloud(request), expectedError); - const actualRequest = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateClusterProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateClusterProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateCluster', () => { + it('invokes updateCluster without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest(), + ); + request.cluster ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateClusterRequest', + ['cluster', 'name'], + ); + request.cluster.name = defaultValue1; + const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateCluster = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updatePrivateCloud with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest() - ); - request.privateCloud ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateCloudRequest', ['privateCloud', 'name']); - request.privateCloud.name = defaultValue1; - const expectedHeaderRequestParams = `private_cloud.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePrivateCloud = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updatePrivateCloud(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateCluster without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest(), + ); + request.cluster ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateClusterRequest', + ['cluster', 'name'], + ); + request.cluster.name = defaultValue1; + const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateCluster = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateCluster( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.ICluster, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdatePrivateCloudProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdatePrivateCloudProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateCluster with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest(), + ); + request.cluster ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateClusterRequest', + ['cluster', 'name'], + ); + request.cluster.name = defaultValue1; + const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCluster = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateCluster(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdatePrivateCloudProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdatePrivateCloudProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateCluster with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest(), + ); + request.cluster ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateClusterRequest', + ['cluster', 'name'], + ); + request.cluster.name = defaultValue1; + const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateCluster = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deletePrivateCloud', () => { - it('invokes deletePrivateCloud without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePrivateCloud = stubLongRunningCall(expectedResponse); - const [operation] = await client.deletePrivateCloud(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateClusterProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateClusterProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deletePrivateCloud without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePrivateCloud = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePrivateCloud( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateClusterProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateClusterProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteCluster', () => { + it('invokes deleteCluster without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteCluster = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteCluster(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deletePrivateCloud with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePrivateCloud = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deletePrivateCloud(request), expectedError); - const actualRequest = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteCluster without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteCluster = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteCluster( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deletePrivateCloud with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePrivateCloud = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deletePrivateCloud(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteCluster with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCluster = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteCluster(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeletePrivateCloudProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeletePrivateCloudProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteCluster with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteClusterRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteCluster = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteCluster(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteCluster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeletePrivateCloudProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeletePrivateCloudProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteClusterProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteClusterProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('undeletePrivateCloud', () => { - it('invokes undeletePrivateCloud without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.undeletePrivateCloud = stubLongRunningCall(expectedResponse); - const [operation] = await client.undeletePrivateCloud(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteClusterProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteClusterProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createExternalAddress', () => { + it('invokes createExternalAddress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateExternalAddressRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateExternalAddressRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createExternalAddress = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createExternalAddress(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes undeletePrivateCloud without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.undeletePrivateCloud = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.undeletePrivateCloud( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExternalAddress without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateExternalAddressRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateExternalAddressRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createExternalAddress = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createExternalAddress( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes undeletePrivateCloud with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeletePrivateCloud = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.undeletePrivateCloud(request), expectedError); - const actualRequest = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExternalAddress with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateExternalAddressRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateExternalAddressRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExternalAddress = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createExternalAddress(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes undeletePrivateCloud with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UndeletePrivateCloudRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeletePrivateCloud = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.undeletePrivateCloud(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeletePrivateCloud as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExternalAddress with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateExternalAddressRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateExternalAddressRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExternalAddress = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createExternalAddress(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUndeletePrivateCloudProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUndeletePrivateCloudProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateExternalAddressProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateExternalAddressProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUndeletePrivateCloudProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUndeletePrivateCloudProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateExternalAddressProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateExternalAddressProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateExternalAddress', () => { + it('invokes updateExternalAddress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest(), + ); + request.externalAddress ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest', + ['externalAddress', 'name'], + ); + request.externalAddress.name = defaultValue1; + const expectedHeaderRequestParams = `external_address.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateExternalAddress = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateExternalAddress(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createCluster', () => { - it('invokes createCluster without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.createCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCluster without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateExternalAddress without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest(), + ); + request.externalAddress ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest', + ['externalAddress', 'name'], + ); + request.externalAddress.name = defaultValue1; + const expectedHeaderRequestParams = `external_address.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateExternalAddress = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateExternalAddress( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAddress, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createCluster with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateExternalAddress with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest(), + ); + request.externalAddress ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest', + ['externalAddress', 'name'], + ); + request.externalAddress.name = defaultValue1; + const expectedHeaderRequestParams = `external_address.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateExternalAddress = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateExternalAddress(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createCluster with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateClusterRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateExternalAddress with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest(), + ); + request.externalAddress ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest', + ['externalAddress', 'name'], + ); + request.externalAddress.name = defaultValue1; + const expectedHeaderRequestParams = `external_address.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateExternalAddress = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateExternalAddress(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateClusterProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateExternalAddressProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateExternalAddressProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateClusterProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateExternalAddressProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateExternalAddressProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteExternalAddress', () => { + it('invokes deleteExternalAddress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteExternalAddress = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteExternalAddress(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateCluster', () => { - it('invokes updateCluster without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest() - ); - request.cluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateClusterRequest', ['cluster', 'name']); - request.cluster.name = defaultValue1; - const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteExternalAddress without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteExternalAddress = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteExternalAddress( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateCluster without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest() - ); - request.cluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateClusterRequest', ['cluster', 'name']); - request.cluster.name = defaultValue1; - const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteExternalAddress with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteExternalAddress = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteExternalAddress(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateCluster with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest() - ); - request.cluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateClusterRequest', ['cluster', 'name']); - request.cluster.name = defaultValue1; - const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteExternalAddress with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteExternalAddress = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteExternalAddress(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteExternalAddress as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteExternalAddress as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateCluster with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateClusterRequest() - ); - request.cluster ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateClusterRequest', ['cluster', 'name']); - request.cluster.name = defaultValue1; - const expectedHeaderRequestParams = `cluster.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteExternalAddressProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteExternalAddressProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateClusterProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteExternalAddressProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteExternalAddressProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateSubnet', () => { + it('invokes updateSubnet without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest(), + ); + request.subnet ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateSubnetRequest', + ['subnet', 'name'], + ); + request.subnet.name = defaultValue1; + const expectedHeaderRequestParams = `subnet.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSubnet = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSubnet(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSubnet as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSubnet as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateClusterProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateSubnet without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest(), + ); + request.subnet ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateSubnetRequest', + ['subnet', 'name'], + ); + request.subnet.name = defaultValue1; + const expectedHeaderRequestParams = `subnet.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSubnet = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSubnet( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.ISubnet, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSubnet as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSubnet as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteCluster', () => { - it('invokes deleteCluster without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteCluster = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteCluster(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSubnet with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest(), + ); + request.subnet ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateSubnetRequest', + ['subnet', 'name'], + ); + request.subnet.name = defaultValue1; + const expectedHeaderRequestParams = `subnet.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSubnet = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateSubnet(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSubnet as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSubnet as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteCluster without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteCluster = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteCluster( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateSubnet with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest(), + ); + request.subnet ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateSubnetRequest', + ['subnet', 'name'], + ); + request.subnet.name = defaultValue1; + const expectedHeaderRequestParams = `subnet.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSubnet = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateSubnet(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSubnet as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSubnet as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteCluster with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCluster = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteCluster(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateSubnetProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateSubnetProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteCluster with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteClusterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteClusterRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteCluster = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteCluster(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteCluster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateSubnetProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkUpdateSubnetProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createExternalAccessRule', () => { + it('invokes createExternalAccessRule without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createExternalAccessRule = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createExternalAccessRule(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteClusterProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteClusterProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createExternalAccessRule without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createExternalAccessRule = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createExternalAccessRule( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteClusterProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteClusterProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createExternalAccessRule with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExternalAccessRule = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createExternalAccessRule(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createExternalAddress', () => { - it('invokes createExternalAddress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateExternalAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateExternalAddressRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createExternalAddress = stubLongRunningCall(expectedResponse); - const [operation] = await client.createExternalAddress(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExternalAccessRule with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExternalAccessRule = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createExternalAccessRule(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createExternalAddress without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateExternalAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateExternalAddressRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createExternalAddress = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExternalAddress( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateExternalAccessRuleProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkCreateExternalAccessRuleProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createExternalAddress with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateExternalAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateExternalAddressRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExternalAddress = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createExternalAddress(request), expectedError); - const actualRequest = (client.innerApiCalls.createExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateExternalAccessRuleProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateExternalAccessRuleProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateExternalAccessRule', () => { + it('invokes updateExternalAccessRule without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest(), + ); + request.externalAccessRule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest', + ['externalAccessRule', 'name'], + ); + request.externalAccessRule.name = defaultValue1; + const expectedHeaderRequestParams = `external_access_rule.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateExternalAccessRule = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateExternalAccessRule(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createExternalAddress with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateExternalAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateExternalAddressRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExternalAddress = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createExternalAddress(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateExternalAccessRule without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest(), + ); + request.externalAccessRule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest', + ['externalAccessRule', 'name'], + ); + request.externalAccessRule.name = defaultValue1; + const expectedHeaderRequestParams = `external_access_rule.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateExternalAccessRule = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateExternalAccessRule( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IExternalAccessRule, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateExternalAddressProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateExternalAddressProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateExternalAccessRule with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest(), + ); + request.externalAccessRule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest', + ['externalAccessRule', 'name'], + ); + request.externalAccessRule.name = defaultValue1; + const expectedHeaderRequestParams = `external_access_rule.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateExternalAccessRule = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateExternalAccessRule(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateExternalAddressProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateExternalAddressProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateExternalAccessRule with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest(), + ); + request.externalAccessRule ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest', + ['externalAccessRule', 'name'], + ); + request.externalAccessRule.name = defaultValue1; + const expectedHeaderRequestParams = `external_access_rule.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateExternalAccessRule = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateExternalAccessRule(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateExternalAddress', () => { - it('invokes updateExternalAddress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest() - ); - request.externalAddress ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest', ['externalAddress', 'name']); - request.externalAddress.name = defaultValue1; - const expectedHeaderRequestParams = `external_address.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateExternalAddress = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateExternalAddress(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateExternalAccessRuleProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkUpdateExternalAccessRuleProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateExternalAddress without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest() - ); - request.externalAddress ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest', ['externalAddress', 'name']); - request.externalAddress.name = defaultValue1; - const expectedHeaderRequestParams = `external_address.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateExternalAddress = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateExternalAddress( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateExternalAccessRuleProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateExternalAccessRuleProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteExternalAccessRule', () => { + it('invokes deleteExternalAccessRule without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteExternalAccessRule = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteExternalAccessRule(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateExternalAddress with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest() - ); - request.externalAddress ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest', ['externalAddress', 'name']); - request.externalAddress.name = defaultValue1; - const expectedHeaderRequestParams = `external_address.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateExternalAddress = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateExternalAddress(request), expectedError); - const actualRequest = (client.innerApiCalls.updateExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteExternalAccessRule without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteExternalAccessRule = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteExternalAccessRule( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateExternalAddress with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest() - ); - request.externalAddress ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateExternalAddressRequest', ['externalAddress', 'name']); - request.externalAddress.name = defaultValue1; - const expectedHeaderRequestParams = `external_address.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateExternalAddress = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateExternalAddress(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteExternalAccessRule with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteExternalAccessRule = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteExternalAccessRule(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateExternalAddressProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateExternalAddressProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteExternalAccessRule with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteExternalAccessRule = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteExternalAccessRule(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteExternalAccessRule as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteExternalAccessRule as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateExternalAddressProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateExternalAddressProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteExternalAccessRuleProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkDeleteExternalAccessRuleProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteExternalAddress', () => { - it('invokes deleteExternalAddress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteExternalAddress = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteExternalAddress(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteExternalAccessRuleProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteExternalAccessRuleProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createLoggingServer', () => { + it('invokes createLoggingServer without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateLoggingServerRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateLoggingServerRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createLoggingServer = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createLoggingServer(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteExternalAddress without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteExternalAddress = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteExternalAddress( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createLoggingServer without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateLoggingServerRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateLoggingServerRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createLoggingServer = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createLoggingServer( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteExternalAddress with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteExternalAddress = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteExternalAddress(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createLoggingServer with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateLoggingServerRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateLoggingServerRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createLoggingServer = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createLoggingServer(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteExternalAddress with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteExternalAddressRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteExternalAddress = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteExternalAddress(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteExternalAddress as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExternalAddress as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createLoggingServer with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateLoggingServerRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateLoggingServerRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createLoggingServer = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createLoggingServer(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteExternalAddressProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteExternalAddressProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateLoggingServerProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateLoggingServerProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteExternalAddressProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteExternalAddressProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateLoggingServerProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateLoggingServerProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateLoggingServer', () => { + it('invokes updateLoggingServer without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest(), + ); + request.loggingServer ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest', + ['loggingServer', 'name'], + ); + request.loggingServer.name = defaultValue1; + const expectedHeaderRequestParams = `logging_server.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateLoggingServer = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateLoggingServer(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateSubnet', () => { - it('invokes updateSubnet without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest() - ); - request.subnet ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateSubnetRequest', ['subnet', 'name']); - request.subnet.name = defaultValue1; - const expectedHeaderRequestParams = `subnet.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSubnet = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateSubnet(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateLoggingServer without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest(), + ); + request.loggingServer ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest', + ['loggingServer', 'name'], + ); + request.loggingServer.name = defaultValue1; + const expectedHeaderRequestParams = `logging_server.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateLoggingServer = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateLoggingServer( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.ILoggingServer, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSubnet without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest() - ); - request.subnet ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateSubnetRequest', ['subnet', 'name']); - request.subnet.name = defaultValue1; - const expectedHeaderRequestParams = `subnet.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateSubnet = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSubnet( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateLoggingServer with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest(), + ); + request.loggingServer ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest', + ['loggingServer', 'name'], + ); + request.loggingServer.name = defaultValue1; + const expectedHeaderRequestParams = `logging_server.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateLoggingServer = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateLoggingServer(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSubnet with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest() - ); - request.subnet ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateSubnetRequest', ['subnet', 'name']); - request.subnet.name = defaultValue1; - const expectedHeaderRequestParams = `subnet.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSubnet = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateSubnet(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateLoggingServer with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest(), + ); + request.loggingServer ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest', + ['loggingServer', 'name'], + ); + request.loggingServer.name = defaultValue1; + const expectedHeaderRequestParams = `logging_server.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateLoggingServer = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateLoggingServer(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateSubnet with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateSubnetRequest() - ); - request.subnet ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateSubnetRequest', ['subnet', 'name']); - request.subnet.name = defaultValue1; - const expectedHeaderRequestParams = `subnet.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSubnet = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateSubnet(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSubnet as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateLoggingServerProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateLoggingServerProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateSubnetProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateSubnetProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateLoggingServerProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateLoggingServerProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteLoggingServer', () => { + it('invokes deleteLoggingServer without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteLoggingServer = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteLoggingServer(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateSubnetProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateSubnetProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteLoggingServer without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteLoggingServer = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteLoggingServer( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createExternalAccessRule', () => { - it('invokes createExternalAccessRule without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createExternalAccessRule = stubLongRunningCall(expectedResponse); - const [operation] = await client.createExternalAccessRule(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteLoggingServer with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteLoggingServer = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteLoggingServer(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createExternalAccessRule without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createExternalAccessRule = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExternalAccessRule( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteLoggingServer with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteLoggingServer = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteLoggingServer(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteLoggingServer as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteLoggingServer as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createExternalAccessRule with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExternalAccessRule = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createExternalAccessRule(request), expectedError); - const actualRequest = (client.innerApiCalls.createExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteLoggingServerProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteLoggingServerProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createExternalAccessRule with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateExternalAccessRuleRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExternalAccessRule = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createExternalAccessRule(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteLoggingServerProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteLoggingServerProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('resetNsxCredentials', () => { + it('invokes resetNsxCredentials without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.resetNsxCredentials = + stubLongRunningCall(expectedResponse); + const [operation] = await client.resetNsxCredentials(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetNsxCredentials as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetNsxCredentials as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateExternalAccessRuleProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateExternalAccessRuleProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes resetNsxCredentials without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.resetNsxCredentials = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetNsxCredentials( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetNsxCredentials as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetNsxCredentials as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateExternalAccessRuleProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateExternalAccessRuleProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes resetNsxCredentials with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetNsxCredentials = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.resetNsxCredentials(request), expectedError); + const actualRequest = ( + client.innerApiCalls.resetNsxCredentials as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetNsxCredentials as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateExternalAccessRule', () => { - it('invokes updateExternalAccessRule without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest() - ); - request.externalAccessRule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest', ['externalAccessRule', 'name']); - request.externalAccessRule.name = defaultValue1; - const expectedHeaderRequestParams = `external_access_rule.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateExternalAccessRule = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateExternalAccessRule(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes resetNsxCredentials with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetNsxCredentials = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.resetNsxCredentials(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.resetNsxCredentials as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetNsxCredentials as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateExternalAccessRule without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest() - ); - request.externalAccessRule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest', ['externalAccessRule', 'name']); - request.externalAccessRule.name = defaultValue1; - const expectedHeaderRequestParams = `external_access_rule.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateExternalAccessRule = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateExternalAccessRule( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkResetNsxCredentialsProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkResetNsxCredentialsProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateExternalAccessRule with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest() - ); - request.externalAccessRule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest', ['externalAccessRule', 'name']); - request.externalAccessRule.name = defaultValue1; - const expectedHeaderRequestParams = `external_access_rule.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateExternalAccessRule = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateExternalAccessRule(request), expectedError); - const actualRequest = (client.innerApiCalls.updateExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkResetNsxCredentialsProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkResetNsxCredentialsProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('resetVcenterCredentials', () => { + it('invokes resetVcenterCredentials without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.resetVcenterCredentials = + stubLongRunningCall(expectedResponse); + const [operation] = await client.resetVcenterCredentials(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetVcenterCredentials as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetVcenterCredentials as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateExternalAccessRule with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest() - ); - request.externalAccessRule ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateExternalAccessRuleRequest', ['externalAccessRule', 'name']); - request.externalAccessRule.name = defaultValue1; - const expectedHeaderRequestParams = `external_access_rule.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateExternalAccessRule = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateExternalAccessRule(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes resetVcenterCredentials without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.resetVcenterCredentials = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetVcenterCredentials( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateCloud, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetVcenterCredentials as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetVcenterCredentials as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateExternalAccessRuleProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateExternalAccessRuleProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes resetVcenterCredentials with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetVcenterCredentials = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.resetVcenterCredentials(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.resetVcenterCredentials as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetVcenterCredentials as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateExternalAccessRuleProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateExternalAccessRuleProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes resetVcenterCredentials with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', + ['privateCloud'], + ); + request.privateCloud = defaultValue1; + const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetVcenterCredentials = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.resetVcenterCredentials(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.resetVcenterCredentials as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetVcenterCredentials as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteExternalAccessRule', () => { - it('invokes deleteExternalAccessRule without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteExternalAccessRule = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteExternalAccessRule(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkResetVcenterCredentialsProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkResetVcenterCredentialsProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteExternalAccessRule without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteExternalAccessRule = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteExternalAccessRule( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkResetVcenterCredentialsProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkResetVcenterCredentialsProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateDnsForwarding', () => { + it('invokes updateDnsForwarding without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest(), + ); + request.dnsForwarding ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest', + ['dnsForwarding', 'name'], + ); + request.dnsForwarding.name = defaultValue1; + const expectedHeaderRequestParams = `dns_forwarding.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateDnsForwarding = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDnsForwarding(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDnsForwarding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDnsForwarding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteExternalAccessRule with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteExternalAccessRule = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteExternalAccessRule(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateDnsForwarding without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest(), + ); + request.dnsForwarding ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest', + ['dnsForwarding', 'name'], + ); + request.dnsForwarding.name = defaultValue1; + const expectedHeaderRequestParams = `dns_forwarding.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateDnsForwarding = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDnsForwarding( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IDnsForwarding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDnsForwarding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDnsForwarding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteExternalAccessRule with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteExternalAccessRuleRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteExternalAccessRule = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteExternalAccessRule(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteExternalAccessRule as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExternalAccessRule as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateDnsForwarding with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest(), + ); + request.dnsForwarding ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest', + ['dnsForwarding', 'name'], + ); + request.dnsForwarding.name = defaultValue1; + const expectedHeaderRequestParams = `dns_forwarding.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDnsForwarding = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateDnsForwarding(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDnsForwarding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDnsForwarding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteExternalAccessRuleProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteExternalAccessRuleProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateDnsForwarding with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest(), + ); + request.dnsForwarding ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest', + ['dnsForwarding', 'name'], + ); + request.dnsForwarding.name = defaultValue1; + const expectedHeaderRequestParams = `dns_forwarding.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDnsForwarding = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateDnsForwarding(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDnsForwarding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDnsForwarding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteExternalAccessRuleProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteExternalAccessRuleProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateDnsForwardingProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateDnsForwardingProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('createLoggingServer', () => { - it('invokes createLoggingServer without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateLoggingServerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateLoggingServerRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createLoggingServer = stubLongRunningCall(expectedResponse); - const [operation] = await client.createLoggingServer(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateDnsForwardingProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateDnsForwardingProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createNetworkPeering', () => { + it('invokes createNetworkPeering without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createNetworkPeering = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createNetworkPeering(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createLoggingServer without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateLoggingServerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateLoggingServerRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createLoggingServer = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createLoggingServer( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createNetworkPeering without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createNetworkPeering = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNetworkPeering( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createLoggingServer with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateLoggingServerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateLoggingServerRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createLoggingServer = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createLoggingServer(request), expectedError); - const actualRequest = (client.innerApiCalls.createLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createNetworkPeering with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNetworkPeering = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createNetworkPeering(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createLoggingServer with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateLoggingServerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateLoggingServerRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createLoggingServer = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createLoggingServer(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createNetworkPeering with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNetworkPeering = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createNetworkPeering(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateLoggingServerProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateLoggingServerProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateNetworkPeeringProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateNetworkPeeringProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateLoggingServerProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateLoggingServerProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateNetworkPeeringProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateNetworkPeeringProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteNetworkPeering', () => { + it('invokes deleteNetworkPeering without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteNetworkPeering = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteNetworkPeering(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateLoggingServer', () => { - it('invokes updateLoggingServer without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest() - ); - request.loggingServer ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest', ['loggingServer', 'name']); - request.loggingServer.name = defaultValue1; - const expectedHeaderRequestParams = `logging_server.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateLoggingServer = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateLoggingServer(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteNetworkPeering without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteNetworkPeering = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNetworkPeering( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateLoggingServer without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest() - ); - request.loggingServer ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest', ['loggingServer', 'name']); - request.loggingServer.name = defaultValue1; - const expectedHeaderRequestParams = `logging_server.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateLoggingServer = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateLoggingServer( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteNetworkPeering with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNetworkPeering = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteNetworkPeering(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateLoggingServer with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest() - ); - request.loggingServer ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest', ['loggingServer', 'name']); - request.loggingServer.name = defaultValue1; - const expectedHeaderRequestParams = `logging_server.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateLoggingServer = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateLoggingServer(request), expectedError); - const actualRequest = (client.innerApiCalls.updateLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteNetworkPeering with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNetworkPeering = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteNetworkPeering(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateLoggingServer with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest() - ); - request.loggingServer ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateLoggingServerRequest', ['loggingServer', 'name']); - request.loggingServer.name = defaultValue1; - const expectedHeaderRequestParams = `logging_server.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateLoggingServer = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateLoggingServer(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteNetworkPeeringProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteNetworkPeeringProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateLoggingServerProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateLoggingServerProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteNetworkPeeringProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteNetworkPeeringProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateNetworkPeering', () => { + it('invokes updateNetworkPeering without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest(), + ); + request.networkPeering ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest', + ['networkPeering', 'name'], + ); + request.networkPeering.name = defaultValue1; + const expectedHeaderRequestParams = `network_peering.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateNetworkPeering = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateNetworkPeering(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateLoggingServerProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateLoggingServerProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateNetworkPeering without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest(), + ); + request.networkPeering ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest', + ['networkPeering', 'name'], + ); + request.networkPeering.name = defaultValue1; + const expectedHeaderRequestParams = `network_peering.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateNetworkPeering = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNetworkPeering( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPeering, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteLoggingServer', () => { - it('invokes deleteLoggingServer without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteLoggingServer = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteLoggingServer(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateNetworkPeering with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest(), + ); + request.networkPeering ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest', + ['networkPeering', 'name'], + ); + request.networkPeering.name = defaultValue1; + const expectedHeaderRequestParams = `network_peering.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNetworkPeering = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateNetworkPeering(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteLoggingServer without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteLoggingServer = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteLoggingServer( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateNetworkPeering with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest(), + ); + request.networkPeering ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest', + ['networkPeering', 'name'], + ); + request.networkPeering.name = defaultValue1; + const expectedHeaderRequestParams = `network_peering.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNetworkPeering = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateNetworkPeering(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateNetworkPeering as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNetworkPeering as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteLoggingServer with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteLoggingServer = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteLoggingServer(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateNetworkPeeringProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateNetworkPeeringProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteLoggingServer with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteLoggingServerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteLoggingServer = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteLoggingServer(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteLoggingServer as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLoggingServer as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateNetworkPeeringProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateNetworkPeeringProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createHcxActivationKey', () => { + it('invokes createHcxActivationKey without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createHcxActivationKey = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createHcxActivationKey(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createHcxActivationKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createHcxActivationKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteLoggingServerProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteLoggingServerProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createHcxActivationKey without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createHcxActivationKey = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createHcxActivationKey( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IHcxActivationKey, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createHcxActivationKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createHcxActivationKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteLoggingServerProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteLoggingServerProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createHcxActivationKey with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createHcxActivationKey = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createHcxActivationKey(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createHcxActivationKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createHcxActivationKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('resetNsxCredentials', () => { - it('invokes resetNsxCredentials without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.resetNsxCredentials = stubLongRunningCall(expectedResponse); - const [operation] = await client.resetNsxCredentials(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createHcxActivationKey with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createHcxActivationKey = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createHcxActivationKey(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createHcxActivationKey as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createHcxActivationKey as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes resetNsxCredentials without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.resetNsxCredentials = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetNsxCredentials( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateHcxActivationKeyProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateHcxActivationKeyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes resetNsxCredentials with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetNsxCredentials = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.resetNsxCredentials(request), expectedError); - const actualRequest = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateHcxActivationKeyProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateHcxActivationKeyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createNetworkPolicy', () => { + it('invokes createNetworkPolicy without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createNetworkPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createNetworkPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes resetNsxCredentials with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetNsxCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetNsxCredentials = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.resetNsxCredentials(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetNsxCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createNetworkPolicy without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createNetworkPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createNetworkPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkResetNsxCredentialsProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkResetNsxCredentialsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createNetworkPolicy with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNetworkPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createNetworkPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkResetNsxCredentialsProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkResetNsxCredentialsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createNetworkPolicy with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createNetworkPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createNetworkPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('resetVcenterCredentials', () => { - it('invokes resetVcenterCredentials without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.resetVcenterCredentials = stubLongRunningCall(expectedResponse); - const [operation] = await client.resetVcenterCredentials(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateNetworkPolicyProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateNetworkPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes resetVcenterCredentials without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.resetVcenterCredentials = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetVcenterCredentials( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateNetworkPolicyProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateNetworkPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateNetworkPolicy', () => { + it('invokes updateNetworkPolicy without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest(), + ); + request.networkPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', + ['networkPolicy', 'name'], + ); + request.networkPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `network_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateNetworkPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateNetworkPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes resetVcenterCredentials with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetVcenterCredentials = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.resetVcenterCredentials(request), expectedError); - const actualRequest = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateNetworkPolicy without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest(), + ); + request.networkPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', + ['networkPolicy', 'name'], + ); + request.networkPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `network_policy.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateNetworkPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateNetworkPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.INetworkPolicy, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes resetVcenterCredentials with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ResetVcenterCredentialsRequest', ['privateCloud']); - request.privateCloud = defaultValue1; - const expectedHeaderRequestParams = `private_cloud=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetVcenterCredentials = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.resetVcenterCredentials(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetVcenterCredentials as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateNetworkPolicy with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest(), + ); + request.networkPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', + ['networkPolicy', 'name'], + ); + request.networkPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `network_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNetworkPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateNetworkPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkResetVcenterCredentialsProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkResetVcenterCredentialsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateNetworkPolicy with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest(), + ); + request.networkPolicy ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', + ['networkPolicy', 'name'], + ); + request.networkPolicy.name = defaultValue1; + const expectedHeaderRequestParams = `network_policy.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateNetworkPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateNetworkPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkResetVcenterCredentialsProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkResetVcenterCredentialsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateNetworkPolicyProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateNetworkPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateDnsForwarding', () => { - it('invokes updateDnsForwarding without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest() - ); - request.dnsForwarding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest', ['dnsForwarding', 'name']); - request.dnsForwarding.name = defaultValue1; - const expectedHeaderRequestParams = `dns_forwarding.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateDnsForwarding = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateDnsForwarding(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDnsForwarding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDnsForwarding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateNetworkPolicyProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateNetworkPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteNetworkPolicy', () => { + it('invokes deleteNetworkPolicy without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteNetworkPolicy = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteNetworkPolicy(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDnsForwarding without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest() - ); - request.dnsForwarding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest', ['dnsForwarding', 'name']); - request.dnsForwarding.name = defaultValue1; - const expectedHeaderRequestParams = `dns_forwarding.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateDnsForwarding = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDnsForwarding( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDnsForwarding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDnsForwarding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteNetworkPolicy without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteNetworkPolicy = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteNetworkPolicy( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDnsForwarding with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest() - ); - request.dnsForwarding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest', ['dnsForwarding', 'name']); - request.dnsForwarding.name = defaultValue1; - const expectedHeaderRequestParams = `dns_forwarding.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDnsForwarding = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateDnsForwarding(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDnsForwarding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDnsForwarding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteNetworkPolicy with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNetworkPolicy = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteNetworkPolicy(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDnsForwarding with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest() - ); - request.dnsForwarding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateDnsForwardingRequest', ['dnsForwarding', 'name']); - request.dnsForwarding.name = defaultValue1; - const expectedHeaderRequestParams = `dns_forwarding.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDnsForwarding = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateDnsForwarding(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateDnsForwarding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDnsForwarding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteNetworkPolicy with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteNetworkPolicy = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteNetworkPolicy(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteNetworkPolicy as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteNetworkPolicy as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateDnsForwardingProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateDnsForwardingProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteNetworkPolicyProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteNetworkPolicyProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateDnsForwardingProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateDnsForwardingProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteNetworkPolicyProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteNetworkPolicyProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createManagementDnsZoneBinding', () => { + it('invokes createManagementDnsZoneBinding without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createManagementDnsZoneBinding = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createManagementDnsZoneBinding(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createNetworkPeering', () => { - it('invokes createNetworkPeering without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createNetworkPeering = stubLongRunningCall(expectedResponse); - const [operation] = await client.createNetworkPeering(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createManagementDnsZoneBinding without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createManagementDnsZoneBinding = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createManagementDnsZoneBinding( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createNetworkPeering without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createNetworkPeering = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNetworkPeering( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createManagementDnsZoneBinding with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createManagementDnsZoneBinding = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createManagementDnsZoneBinding(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createNetworkPeering with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNetworkPeering = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createNetworkPeering(request), expectedError); - const actualRequest = (client.innerApiCalls.createNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createManagementDnsZoneBinding with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createManagementDnsZoneBinding = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createManagementDnsZoneBinding(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createNetworkPeering with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPeeringRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNetworkPeering = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createNetworkPeering(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateManagementDnsZoneBindingProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkCreateManagementDnsZoneBindingProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateNetworkPeeringProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateNetworkPeeringProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkCreateManagementDnsZoneBindingProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateManagementDnsZoneBindingProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateManagementDnsZoneBinding', () => { + it('invokes updateManagementDnsZoneBinding without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest(), + ); + request.managementDnsZoneBinding ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest', + ['managementDnsZoneBinding', 'name'], + ); + request.managementDnsZoneBinding.name = defaultValue1; + const expectedHeaderRequestParams = `management_dns_zone_binding.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateManagementDnsZoneBinding = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateManagementDnsZoneBinding(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateNetworkPeeringProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateNetworkPeeringProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateManagementDnsZoneBinding without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest(), + ); + request.managementDnsZoneBinding ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest', + ['managementDnsZoneBinding', 'name'], + ); + request.managementDnsZoneBinding.name = defaultValue1; + const expectedHeaderRequestParams = `management_dns_zone_binding.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateManagementDnsZoneBinding = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateManagementDnsZoneBinding( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteNetworkPeering', () => { - it('invokes deleteNetworkPeering without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteNetworkPeering = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteNetworkPeering(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateManagementDnsZoneBinding with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest(), + ); + request.managementDnsZoneBinding ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest', + ['managementDnsZoneBinding', 'name'], + ); + request.managementDnsZoneBinding.name = defaultValue1; + const expectedHeaderRequestParams = `management_dns_zone_binding.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateManagementDnsZoneBinding = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateManagementDnsZoneBinding(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteNetworkPeering without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteNetworkPeering = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNetworkPeering( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateManagementDnsZoneBinding with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest(), + ); + request.managementDnsZoneBinding ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest', + ['managementDnsZoneBinding', 'name'], + ); + request.managementDnsZoneBinding.name = defaultValue1; + const expectedHeaderRequestParams = `management_dns_zone_binding.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateManagementDnsZoneBinding = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateManagementDnsZoneBinding(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteNetworkPeering with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNetworkPeering = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteNetworkPeering(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateManagementDnsZoneBindingProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkUpdateManagementDnsZoneBindingProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteNetworkPeering with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPeeringRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNetworkPeering = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteNetworkPeering(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateManagementDnsZoneBindingProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateManagementDnsZoneBindingProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteManagementDnsZoneBinding', () => { + it('invokes deleteManagementDnsZoneBinding without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteManagementDnsZoneBinding = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteManagementDnsZoneBinding(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteNetworkPeeringProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteNetworkPeeringProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteManagementDnsZoneBinding without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteManagementDnsZoneBinding = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteManagementDnsZoneBinding( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteNetworkPeeringProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteNetworkPeeringProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deleteManagementDnsZoneBinding with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteManagementDnsZoneBinding = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteManagementDnsZoneBinding(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateNetworkPeering', () => { - it('invokes updateNetworkPeering without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest() - ); - request.networkPeering ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest', ['networkPeering', 'name']); - request.networkPeering.name = defaultValue1; - const expectedHeaderRequestParams = `network_peering.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateNetworkPeering = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateNetworkPeering(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteManagementDnsZoneBinding with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteManagementDnsZoneBinding = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteManagementDnsZoneBinding(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateNetworkPeering without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest() - ); - request.networkPeering ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest', ['networkPeering', 'name']); - request.networkPeering.name = defaultValue1; - const expectedHeaderRequestParams = `network_peering.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateNetworkPeering = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNetworkPeering( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteManagementDnsZoneBindingProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkDeleteManagementDnsZoneBindingProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateNetworkPeering with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest() - ); - request.networkPeering ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest', ['networkPeering', 'name']); - request.networkPeering.name = defaultValue1; - const expectedHeaderRequestParams = `network_peering.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNetworkPeering = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateNetworkPeering(request), expectedError); - const actualRequest = (client.innerApiCalls.updateNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteManagementDnsZoneBindingProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteManagementDnsZoneBindingProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('repairManagementDnsZoneBinding', () => { + it('invokes repairManagementDnsZoneBinding without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.repairManagementDnsZoneBinding = + stubLongRunningCall(expectedResponse); + const [operation] = await client.repairManagementDnsZoneBinding(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateNetworkPeering with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest() - ); - request.networkPeering ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPeeringRequest', ['networkPeering', 'name']); - request.networkPeering.name = defaultValue1; - const expectedHeaderRequestParams = `network_peering.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNetworkPeering = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateNetworkPeering(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateNetworkPeering as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPeering as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes repairManagementDnsZoneBinding without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.repairManagementDnsZoneBinding = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.repairManagementDnsZoneBinding( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateNetworkPeeringProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateNetworkPeeringProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes repairManagementDnsZoneBinding with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.repairManagementDnsZoneBinding = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.repairManagementDnsZoneBinding(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateNetworkPeeringProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateNetworkPeeringProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes repairManagementDnsZoneBinding with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.repairManagementDnsZoneBinding = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.repairManagementDnsZoneBinding(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createHcxActivationKey', () => { - it('invokes createHcxActivationKey without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createHcxActivationKey = stubLongRunningCall(expectedResponse); - const [operation] = await client.createHcxActivationKey(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkRepairManagementDnsZoneBindingProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkRepairManagementDnsZoneBindingProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createHcxActivationKey without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createHcxActivationKey = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createHcxActivationKey( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkRepairManagementDnsZoneBindingProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkRepairManagementDnsZoneBindingProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createVmwareEngineNetwork', () => { + it('invokes createVmwareEngineNetwork without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createVmwareEngineNetwork = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createVmwareEngineNetwork(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createHcxActivationKey with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createHcxActivationKey = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createHcxActivationKey(request), expectedError); - const actualRequest = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createVmwareEngineNetwork without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createVmwareEngineNetwork = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createVmwareEngineNetwork( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createHcxActivationKey with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateHcxActivationKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createHcxActivationKey = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createHcxActivationKey(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createHcxActivationKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createVmwareEngineNetwork with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createVmwareEngineNetwork = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createVmwareEngineNetwork(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateHcxActivationKeyProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateHcxActivationKeyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createVmwareEngineNetwork with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createVmwareEngineNetwork = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createVmwareEngineNetwork(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateHcxActivationKeyProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateHcxActivationKeyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateVmwareEngineNetworkProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkCreateVmwareEngineNetworkProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('createNetworkPolicy', () => { - it('invokes createNetworkPolicy without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createNetworkPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.createNetworkPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateVmwareEngineNetworkProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateVmwareEngineNetworkProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateVmwareEngineNetwork', () => { + it('invokes updateVmwareEngineNetwork without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest(), + ); + request.vmwareEngineNetwork ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', + ['vmwareEngineNetwork', 'name'], + ); + request.vmwareEngineNetwork.name = defaultValue1; + const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateVmwareEngineNetwork = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateVmwareEngineNetwork(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createNetworkPolicy without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createNetworkPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNetworkPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateVmwareEngineNetwork without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest(), + ); + request.vmwareEngineNetwork ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', + ['vmwareEngineNetwork', 'name'], + ); + request.vmwareEngineNetwork.name = defaultValue1; + const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateVmwareEngineNetwork = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateVmwareEngineNetwork( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createNetworkPolicy with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNetworkPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createNetworkPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateVmwareEngineNetwork with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest(), + ); + request.vmwareEngineNetwork ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', + ['vmwareEngineNetwork', 'name'], + ); + request.vmwareEngineNetwork.name = defaultValue1; + const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateVmwareEngineNetwork = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updateVmwareEngineNetwork(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updateVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createNetworkPolicy with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateNetworkPolicyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNetworkPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createNetworkPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateVmwareEngineNetwork with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest(), + ); + request.vmwareEngineNetwork ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', + ['vmwareEngineNetwork', 'name'], + ); + request.vmwareEngineNetwork.name = defaultValue1; + const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateVmwareEngineNetwork = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateVmwareEngineNetwork(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateNetworkPolicyProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateNetworkPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateVmwareEngineNetworkProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkUpdateVmwareEngineNetworkProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkCreateNetworkPolicyProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateNetworkPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateVmwareEngineNetworkProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateVmwareEngineNetworkProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteVmwareEngineNetwork', () => { + it('invokes deleteVmwareEngineNetwork without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteVmwareEngineNetwork = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteVmwareEngineNetwork(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateNetworkPolicy', () => { - it('invokes updateNetworkPolicy without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest() - ); - request.networkPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', ['networkPolicy', 'name']); - request.networkPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `network_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateNetworkPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateNetworkPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteVmwareEngineNetwork without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteVmwareEngineNetwork = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteVmwareEngineNetwork( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateNetworkPolicy without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest() - ); - request.networkPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', ['networkPolicy', 'name']); - request.networkPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `network_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateNetworkPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNetworkPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteVmwareEngineNetwork with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVmwareEngineNetwork = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deleteVmwareEngineNetwork(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateNetworkPolicy with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest() - ); - request.networkPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', ['networkPolicy', 'name']); - request.networkPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `network_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNetworkPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateNetworkPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteVmwareEngineNetwork with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVmwareEngineNetwork = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteVmwareEngineNetwork(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateNetworkPolicy with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest() - ); - request.networkPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateNetworkPolicyRequest', ['networkPolicy', 'name']); - request.networkPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `network_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNetworkPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateNetworkPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteVmwareEngineNetworkProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkDeleteVmwareEngineNetworkProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateNetworkPolicyProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateNetworkPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteVmwareEngineNetworkProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteVmwareEngineNetworkProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createPrivateConnection', () => { + it('invokes createPrivateConnection without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createPrivateConnection = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createPrivateConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createPrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateNetworkPolicyProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateNetworkPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createPrivateConnection without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createPrivateConnection = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createPrivateConnection( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createPrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteNetworkPolicy', () => { - it('invokes deleteNetworkPolicy without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteNetworkPolicy = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteNetworkPolicy(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createPrivateConnection with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPrivateConnection = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.createPrivateConnection(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.createPrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteNetworkPolicy without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteNetworkPolicy = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNetworkPolicy( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createPrivateConnection with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPrivateConnection = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createPrivateConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createPrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createPrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteNetworkPolicy with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNetworkPolicy = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteNetworkPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreatePrivateConnectionProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkCreatePrivateConnectionProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteNetworkPolicy with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteNetworkPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNetworkPolicy = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteNetworkPolicy(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNetworkPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreatePrivateConnectionProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreatePrivateConnectionProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updatePrivateConnection', () => { + it('invokes updatePrivateConnection without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest(), + ); + request.privateConnection ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', + ['privateConnection', 'name'], + ); + request.privateConnection.name = defaultValue1; + const expectedHeaderRequestParams = `private_connection.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updatePrivateConnection = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updatePrivateConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updatePrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updatePrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteNetworkPolicyProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteNetworkPolicyProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updatePrivateConnection without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest(), + ); + request.privateConnection ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', + ['privateConnection', 'name'], + ); + request.privateConnection.name = defaultValue1; + const expectedHeaderRequestParams = `private_connection.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updatePrivateConnection = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updatePrivateConnection( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IPrivateConnection, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updatePrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updatePrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteNetworkPolicyProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteNetworkPolicyProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updatePrivateConnection with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest(), + ); + request.privateConnection ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', + ['privateConnection', 'name'], + ); + request.privateConnection.name = defaultValue1; + const expectedHeaderRequestParams = `private_connection.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePrivateConnection = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.updatePrivateConnection(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.updatePrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updatePrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createManagementDnsZoneBinding', () => { - it('invokes createManagementDnsZoneBinding without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createManagementDnsZoneBinding = stubLongRunningCall(expectedResponse); - const [operation] = await client.createManagementDnsZoneBinding(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updatePrivateConnection with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest(), + ); + request.privateConnection ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', + ['privateConnection', 'name'], + ); + request.privateConnection.name = defaultValue1; + const expectedHeaderRequestParams = `private_connection.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePrivateConnection = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updatePrivateConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updatePrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updatePrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createManagementDnsZoneBinding without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createManagementDnsZoneBinding = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createManagementDnsZoneBinding( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdatePrivateConnectionProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkUpdatePrivateConnectionProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes createManagementDnsZoneBinding with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createManagementDnsZoneBinding = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createManagementDnsZoneBinding(request), expectedError); - const actualRequest = (client.innerApiCalls.createManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdatePrivateConnectionProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdatePrivateConnectionProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deletePrivateConnection', () => { + it('invokes deletePrivateConnection without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deletePrivateConnection = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deletePrivateConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deletePrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createManagementDnsZoneBinding with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateManagementDnsZoneBindingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createManagementDnsZoneBinding = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createManagementDnsZoneBinding(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deletePrivateConnection without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deletePrivateConnection = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePrivateConnection( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deletePrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateManagementDnsZoneBindingProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateManagementDnsZoneBindingProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deletePrivateConnection with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePrivateConnection = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.deletePrivateConnection(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.deletePrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateManagementDnsZoneBindingProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateManagementDnsZoneBindingProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes deletePrivateConnection with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePrivateConnection = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deletePrivateConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deletePrivateConnection as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deletePrivateConnection as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateManagementDnsZoneBinding', () => { - it('invokes updateManagementDnsZoneBinding without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest() - ); - request.managementDnsZoneBinding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest', ['managementDnsZoneBinding', 'name']); - request.managementDnsZoneBinding.name = defaultValue1; - const expectedHeaderRequestParams = `management_dns_zone_binding.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateManagementDnsZoneBinding = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateManagementDnsZoneBinding(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeletePrivateConnectionProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkDeletePrivateConnectionProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateManagementDnsZoneBinding without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest() - ); - request.managementDnsZoneBinding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest', ['managementDnsZoneBinding', 'name']); - request.managementDnsZoneBinding.name = defaultValue1; - const expectedHeaderRequestParams = `management_dns_zone_binding.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateManagementDnsZoneBinding = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateManagementDnsZoneBinding( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeletePrivateConnectionProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeletePrivateConnectionProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('grantDnsBindPermission', () => { + it('invokes grantDnsBindPermission without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.grantDnsBindPermission = + stubLongRunningCall(expectedResponse); + const [operation] = await client.grantDnsBindPermission(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.grantDnsBindPermission as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.grantDnsBindPermission as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateManagementDnsZoneBinding with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest() - ); - request.managementDnsZoneBinding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest', ['managementDnsZoneBinding', 'name']); - request.managementDnsZoneBinding.name = defaultValue1; - const expectedHeaderRequestParams = `management_dns_zone_binding.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateManagementDnsZoneBinding = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateManagementDnsZoneBinding(request), expectedError); - const actualRequest = (client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes grantDnsBindPermission without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.grantDnsBindPermission = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.grantDnsBindPermission( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.grantDnsBindPermission as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.grantDnsBindPermission as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateManagementDnsZoneBinding with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest() - ); - request.managementDnsZoneBinding ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateManagementDnsZoneBindingRequest', ['managementDnsZoneBinding', 'name']); - request.managementDnsZoneBinding.name = defaultValue1; - const expectedHeaderRequestParams = `management_dns_zone_binding.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateManagementDnsZoneBinding = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateManagementDnsZoneBinding(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes grantDnsBindPermission with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.grantDnsBindPermission = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.grantDnsBindPermission(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.grantDnsBindPermission as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.grantDnsBindPermission as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateManagementDnsZoneBindingProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateManagementDnsZoneBindingProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes grantDnsBindPermission with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.grantDnsBindPermission = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.grantDnsBindPermission(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.grantDnsBindPermission as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.grantDnsBindPermission as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateManagementDnsZoneBindingProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateManagementDnsZoneBindingProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkGrantDnsBindPermissionProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkGrantDnsBindPermissionProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('deleteManagementDnsZoneBinding', () => { - it('invokes deleteManagementDnsZoneBinding without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteManagementDnsZoneBinding = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteManagementDnsZoneBinding(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkGrantDnsBindPermissionProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkGrantDnsBindPermissionProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('revokeDnsBindPermission', () => { + it('invokes revokeDnsBindPermission without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.revokeDnsBindPermission = + stubLongRunningCall(expectedResponse); + const [operation] = await client.revokeDnsBindPermission(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.revokeDnsBindPermission as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.revokeDnsBindPermission as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteManagementDnsZoneBinding without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteManagementDnsZoneBinding = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteManagementDnsZoneBinding( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes revokeDnsBindPermission without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.revokeDnsBindPermission = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.revokeDnsBindPermission( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vmwareengine.v1.IDnsBindPermission, + protos.google.cloud.vmwareengine.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.revokeDnsBindPermission as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.revokeDnsBindPermission as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteManagementDnsZoneBinding with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteManagementDnsZoneBinding = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteManagementDnsZoneBinding(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes revokeDnsBindPermission with call error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.revokeDnsBindPermission = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.revokeDnsBindPermission(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.revokeDnsBindPermission as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.revokeDnsBindPermission as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteManagementDnsZoneBinding with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteManagementDnsZoneBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteManagementDnsZoneBinding = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteManagementDnsZoneBinding(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes revokeDnsBindPermission with LRO error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.revokeDnsBindPermission = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.revokeDnsBindPermission(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.revokeDnsBindPermission as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.revokeDnsBindPermission as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteManagementDnsZoneBindingProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteManagementDnsZoneBindingProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkRevokeDnsBindPermissionProgress without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkRevokeDnsBindPermissionProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteManagementDnsZoneBindingProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteManagementDnsZoneBindingProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkRevokeDnsBindPermissionProgress with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkRevokeDnsBindPermissionProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listPrivateClouds', () => { + it('invokes listPrivateClouds without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud(), + ), + ]; + client.innerApiCalls.listPrivateClouds = stubSimpleCall(expectedResponse); + const [response] = await client.listPrivateClouds(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPrivateClouds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPrivateClouds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('repairManagementDnsZoneBinding', () => { - it('invokes repairManagementDnsZoneBinding without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.repairManagementDnsZoneBinding = stubLongRunningCall(expectedResponse); - const [operation] = await client.repairManagementDnsZoneBinding(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPrivateClouds without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud(), + ), + ]; + client.innerApiCalls.listPrivateClouds = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPrivateClouds( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.IPrivateCloud[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPrivateClouds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPrivateClouds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes repairManagementDnsZoneBinding without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.repairManagementDnsZoneBinding = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repairManagementDnsZoneBinding( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPrivateClouds with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPrivateClouds = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listPrivateClouds(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listPrivateClouds as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPrivateClouds as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes repairManagementDnsZoneBinding with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.repairManagementDnsZoneBinding = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.repairManagementDnsZoneBinding(request), expectedError); - const actualRequest = (client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPrivateCloudsStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud(), + ), + ]; + client.descriptors.page.listPrivateClouds.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listPrivateCloudsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.PrivateCloud[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.PrivateCloud) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listPrivateClouds.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listPrivateClouds, request), + ); + assert( + (client.descriptors.page.listPrivateClouds.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes repairManagementDnsZoneBinding with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.RepairManagementDnsZoneBindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.repairManagementDnsZoneBinding = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.repairManagementDnsZoneBinding(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repairManagementDnsZoneBinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPrivateCloudsStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateClouds.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listPrivateCloudsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.PrivateCloud[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.PrivateCloud) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listPrivateClouds.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listPrivateClouds, request), + ); + assert( + (client.descriptors.page.listPrivateClouds.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkRepairManagementDnsZoneBindingProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRepairManagementDnsZoneBindingProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('uses async iteration with listPrivateClouds without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateCloud(), + ), + ]; + client.descriptors.page.listPrivateClouds.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IPrivateCloud[] = []; + const iterable = client.listPrivateCloudsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkRepairManagementDnsZoneBindingProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRepairManagementDnsZoneBindingProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with listPrivateClouds with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateClouds.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPrivateCloudsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IPrivateCloud[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listClusters', () => { + it('invokes listClusters without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListClustersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListClustersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster(), + ), + ]; + client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); + const [response] = await client.listClusters(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listClusters as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClusters as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createVmwareEngineNetwork', () => { - it('invokes createVmwareEngineNetwork without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createVmwareEngineNetwork = stubLongRunningCall(expectedResponse); - const [operation] = await client.createVmwareEngineNetwork(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listClusters without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListClustersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListClustersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster(), + ), + ]; + client.innerApiCalls.listClusters = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listClusters( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.ICluster[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listClusters as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClusters as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createVmwareEngineNetwork without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createVmwareEngineNetwork = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createVmwareEngineNetwork( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listClusters with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListClustersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListClustersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listClusters = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listClusters(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listClusters as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listClusters as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createVmwareEngineNetwork with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createVmwareEngineNetwork = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createVmwareEngineNetwork(request), expectedError); - const actualRequest = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listClustersStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListClustersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListClustersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster(), + ), + ]; + client.descriptors.page.listClusters.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.Cluster[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.Cluster) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listClusters.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listClusters, request), + ); + assert( + (client.descriptors.page.listClusters.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes createVmwareEngineNetwork with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreateVmwareEngineNetworkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createVmwareEngineNetwork = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createVmwareEngineNetwork(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listClustersStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListClustersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListClustersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listClusters.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listClustersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.Cluster[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.Cluster) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listClusters.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listClusters, request), + ); + assert( + (client.descriptors.page.listClusters.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkCreateVmwareEngineNetworkProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateVmwareEngineNetworkProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('uses async iteration with listClusters without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListClustersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListClustersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.Cluster(), + ), + ]; + client.descriptors.page.listClusters.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.ICluster[] = []; + const iterable = client.listClustersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listClusters.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listClusters.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkCreateVmwareEngineNetworkProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateVmwareEngineNetworkProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with listClusters with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListClustersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListClustersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listClusters.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listClustersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.ICluster[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listClusters.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listClusters.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listNodes', () => { + it('invokes listNodes without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNodesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), + ]; + client.innerApiCalls.listNodes = stubSimpleCall(expectedResponse); + const [response] = await client.listNodes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateVmwareEngineNetwork', () => { - it('invokes updateVmwareEngineNetwork without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest() - ); - request.vmwareEngineNetwork ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', ['vmwareEngineNetwork', 'name']); - request.vmwareEngineNetwork.name = defaultValue1; - const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateVmwareEngineNetwork = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateVmwareEngineNetwork(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listNodes without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNodesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), + ]; + client.innerApiCalls.listNodes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNodes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.INode[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateVmwareEngineNetwork without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest() - ); - request.vmwareEngineNetwork ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', ['vmwareEngineNetwork', 'name']); - request.vmwareEngineNetwork.name = defaultValue1; - const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateVmwareEngineNetwork = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateVmwareEngineNetwork( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listNodes with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNodesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNodes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listNodes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNodes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateVmwareEngineNetwork with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest() - ); - request.vmwareEngineNetwork ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', ['vmwareEngineNetwork', 'name']); - request.vmwareEngineNetwork.name = defaultValue1; - const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateVmwareEngineNetwork = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateVmwareEngineNetwork(request), expectedError); - const actualRequest = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listNodesStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNodesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), + ]; + client.descriptors.page.listNodes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listNodesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.Node[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.Node) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listNodes, request), + ); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes updateVmwareEngineNetwork with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest() - ); - request.vmwareEngineNetwork ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdateVmwareEngineNetworkRequest', ['vmwareEngineNetwork', 'name']); - request.vmwareEngineNetwork.name = defaultValue1; - const expectedHeaderRequestParams = `vmware_engine_network.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateVmwareEngineNetwork = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateVmwareEngineNetwork(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listNodesStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNodesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodes.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listNodesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.Node[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.Node) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listNodes, request), + ); + assert( + (client.descriptors.page.listNodes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkUpdateVmwareEngineNetworkProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateVmwareEngineNetworkProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('uses async iteration with listNodes without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNodesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), + ]; + client.descriptors.page.listNodes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.INode[] = []; + const iterable = client.listNodesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub).getCall(0) + .args[1], + request, + ); + assert( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkUpdateVmwareEngineNetworkProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateVmwareEngineNetworkProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with listNodes with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNodesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listNodesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.INode[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listNodes.asyncIterate as SinonStub).getCall(0) + .args[1], + request, + ); + assert( + (client.descriptors.page.listNodes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listExternalAddresses', () => { + it('invokes listExternalAddresses without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListExternalAddressesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListExternalAddressesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + ]; + client.innerApiCalls.listExternalAddresses = + stubSimpleCall(expectedResponse); + const [response] = await client.listExternalAddresses(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExternalAddresses as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExternalAddresses as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteVmwareEngineNetwork', () => { - it('invokes deleteVmwareEngineNetwork without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteVmwareEngineNetwork = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteVmwareEngineNetwork(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExternalAddresses without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListExternalAddressesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListExternalAddressesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + ]; + client.innerApiCalls.listExternalAddresses = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExternalAddresses( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmwareengine.v1.IExternalAddress[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExternalAddresses as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExternalAddresses as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteVmwareEngineNetwork without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteVmwareEngineNetwork = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteVmwareEngineNetwork( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExternalAddresses with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListExternalAddressesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListExternalAddressesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExternalAddresses = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listExternalAddresses(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listExternalAddresses as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExternalAddresses as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteVmwareEngineNetwork with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteVmwareEngineNetwork = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteVmwareEngineNetwork(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExternalAddressesStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListExternalAddressesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListExternalAddressesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + ]; + client.descriptors.page.listExternalAddresses.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listExternalAddressesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.ExternalAddress[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.ExternalAddress) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listExternalAddresses + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listExternalAddresses, request), + ); + assert( + ( + client.descriptors.page.listExternalAddresses + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes deleteVmwareEngineNetwork with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeleteVmwareEngineNetworkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteVmwareEngineNetwork = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteVmwareEngineNetwork(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteVmwareEngineNetwork as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExternalAddressesStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListExternalAddressesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListExternalAddressesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExternalAddresses.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listExternalAddressesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.ExternalAddress[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.ExternalAddress) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listExternalAddresses + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listExternalAddresses, request), + ); + assert( + ( + client.descriptors.page.listExternalAddresses + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes checkDeleteVmwareEngineNetworkProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteVmwareEngineNetworkProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('uses async iteration with listExternalAddresses without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListExternalAddressesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListExternalAddressesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + ]; + client.descriptors.page.listExternalAddresses.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IExternalAddress[] = + []; + const iterable = client.listExternalAddressesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listExternalAddresses + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listExternalAddresses + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes checkDeleteVmwareEngineNetworkProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteVmwareEngineNetworkProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with listExternalAddresses with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListExternalAddressesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListExternalAddressesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExternalAddresses.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExternalAddressesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IExternalAddress[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listExternalAddresses + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listExternalAddresses + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('fetchNetworkPolicyExternalAddresses', () => { + it('invokes fetchNetworkPolicyExternalAddresses without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest', + ['networkPolicy'], + ); + request.networkPolicy = defaultValue1; + const expectedHeaderRequestParams = `network_policy=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + ]; + client.innerApiCalls.fetchNetworkPolicyExternalAddresses = + stubSimpleCall(expectedResponse); + const [response] = + await client.fetchNetworkPolicyExternalAddresses(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.fetchNetworkPolicyExternalAddresses as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchNetworkPolicyExternalAddresses as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createPrivateConnection', () => { - it('invokes createPrivateConnection without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPrivateConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.createPrivateConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes fetchNetworkPolicyExternalAddresses without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest', + ['networkPolicy'], + ); + request.networkPolicy = defaultValue1; + const expectedHeaderRequestParams = `network_policy=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + ]; + client.innerApiCalls.fetchNetworkPolicyExternalAddresses = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchNetworkPolicyExternalAddresses( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmwareengine.v1.IExternalAddress[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.fetchNetworkPolicyExternalAddresses as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchNetworkPolicyExternalAddresses as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createPrivateConnection without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPrivateConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createPrivateConnection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes fetchNetworkPolicyExternalAddresses with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest', + ['networkPolicy'], + ); + request.networkPolicy = defaultValue1; + const expectedHeaderRequestParams = `network_policy=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchNetworkPolicyExternalAddresses = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.fetchNetworkPolicyExternalAddresses(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.fetchNetworkPolicyExternalAddresses as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.fetchNetworkPolicyExternalAddresses as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createPrivateConnection with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPrivateConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createPrivateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes fetchNetworkPolicyExternalAddressesStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest', + ['networkPolicy'], + ); + request.networkPolicy = defaultValue1; + const expectedHeaderRequestParams = `network_policy=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + ]; + client.descriptors.page.fetchNetworkPolicyExternalAddresses.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.fetchNetworkPolicyExternalAddressesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.ExternalAddress[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.ExternalAddress) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.fetchNetworkPolicyExternalAddresses + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.fetchNetworkPolicyExternalAddresses, + request, + ), + ); + assert( + ( + client.descriptors.page.fetchNetworkPolicyExternalAddresses + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes createPrivateConnection with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createPrivateConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes fetchNetworkPolicyExternalAddressesStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest', + ['networkPolicy'], + ); + request.networkPolicy = defaultValue1; + const expectedHeaderRequestParams = `network_policy=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.fetchNetworkPolicyExternalAddresses.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.fetchNetworkPolicyExternalAddressesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.ExternalAddress[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.ExternalAddress) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.fetchNetworkPolicyExternalAddresses + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.fetchNetworkPolicyExternalAddresses, + request, + ), + ); + assert( + ( + client.descriptors.page.fetchNetworkPolicyExternalAddresses + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes checkCreatePrivateConnectionProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreatePrivateConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('uses async iteration with fetchNetworkPolicyExternalAddresses without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest', + ['networkPolicy'], + ); + request.networkPolicy = defaultValue1; + const expectedHeaderRequestParams = `network_policy=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAddress(), + ), + ]; + client.descriptors.page.fetchNetworkPolicyExternalAddresses.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IExternalAddress[] = + []; + const iterable = client.fetchNetworkPolicyExternalAddressesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.fetchNetworkPolicyExternalAddresses + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.fetchNetworkPolicyExternalAddresses + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes checkCreatePrivateConnectionProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreatePrivateConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with fetchNetworkPolicyExternalAddresses with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest', + ['networkPolicy'], + ); + request.networkPolicy = defaultValue1; + const expectedHeaderRequestParams = `network_policy=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.fetchNetworkPolicyExternalAddresses.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.fetchNetworkPolicyExternalAddressesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IExternalAddress[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.fetchNetworkPolicyExternalAddresses + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.fetchNetworkPolicyExternalAddresses + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listSubnets', () => { + it('invokes listSubnets without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListSubnetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + ]; + client.innerApiCalls.listSubnets = stubSimpleCall(expectedResponse); + const [response] = await client.listSubnets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSubnets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSubnets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updatePrivateConnection', () => { - it('invokes updatePrivateConnection without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest() - ); - request.privateConnection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', ['privateConnection', 'name']); - request.privateConnection.name = defaultValue1; - const expectedHeaderRequestParams = `private_connection.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updatePrivateConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.updatePrivateConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSubnets without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListSubnetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + ]; + client.innerApiCalls.listSubnets = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSubnets( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.ISubnet[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSubnets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSubnets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updatePrivateConnection without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest() - ); - request.privateConnection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', ['privateConnection', 'name']); - request.privateConnection.name = defaultValue1; - const expectedHeaderRequestParams = `private_connection.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updatePrivateConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updatePrivateConnection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSubnets with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListSubnetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSubnets = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listSubnets(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listSubnets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSubnets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updatePrivateConnection with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest() - ); - request.privateConnection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', ['privateConnection', 'name']); - request.privateConnection.name = defaultValue1; - const expectedHeaderRequestParams = `private_connection.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePrivateConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updatePrivateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSubnetsStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListSubnetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + ]; + client.descriptors.page.listSubnets.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSubnetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.Subnet[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.Subnet) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listSubnets.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSubnets, request), + ); + assert( + (client.descriptors.page.listSubnets.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes updatePrivateConnection with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest() - ); - request.privateConnection ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.UpdatePrivateConnectionRequest', ['privateConnection', 'name']); - request.privateConnection.name = defaultValue1; - const expectedHeaderRequestParams = `private_connection.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updatePrivateConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updatePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listSubnetsStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListSubnetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSubnets.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listSubnetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.Subnet[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.Subnet) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSubnets.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSubnets, request), + ); + assert( + (client.descriptors.page.listSubnets.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkUpdatePrivateConnectionProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdatePrivateConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('uses async iteration with listSubnets without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListSubnetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), + ]; + client.descriptors.page.listSubnets.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.ISubnet[] = []; + const iterable = client.listSubnetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSubnets.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listSubnets.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkUpdatePrivateConnectionProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdatePrivateConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with listSubnets with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListSubnetsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSubnets.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listSubnetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.ISubnet[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSubnets.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listSubnets.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listExternalAccessRules', () => { + it('invokes listExternalAccessRules without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAccessRule(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAccessRule(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAccessRule(), + ), + ]; + client.innerApiCalls.listExternalAccessRules = + stubSimpleCall(expectedResponse); + const [response] = await client.listExternalAccessRules(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExternalAccessRules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExternalAccessRules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deletePrivateConnection', () => { - it('invokes deletePrivateConnection without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.deletePrivateConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExternalAccessRules without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAccessRule(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAccessRule(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAccessRule(), + ), + ]; + client.innerApiCalls.listExternalAccessRules = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExternalAccessRules( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmwareengine.v1.IExternalAccessRule[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExternalAccessRules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExternalAccessRules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deletePrivateConnection without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePrivateConnection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExternalAccessRules with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExternalAccessRules = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listExternalAccessRules(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listExternalAccessRules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExternalAccessRules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deletePrivateConnection with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deletePrivateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExternalAccessRulesStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAccessRule(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAccessRule(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAccessRule(), + ), + ]; + client.descriptors.page.listExternalAccessRules.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listExternalAccessRulesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.ExternalAccessRule[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.vmwareengine.v1.ExternalAccessRule, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listExternalAccessRules + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listExternalAccessRules, request), + ); + assert( + ( + client.descriptors.page.listExternalAccessRules + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes deletePrivateConnection with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deletePrivateConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExternalAccessRulesStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExternalAccessRules.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listExternalAccessRulesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.ExternalAccessRule[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.vmwareengine.v1.ExternalAccessRule, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listExternalAccessRules + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listExternalAccessRules, request), + ); + assert( + ( + client.descriptors.page.listExternalAccessRules + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes checkDeletePrivateConnectionProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeletePrivateConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('uses async iteration with listExternalAccessRules without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAccessRule(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAccessRule(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ExternalAccessRule(), + ), + ]; + client.descriptors.page.listExternalAccessRules.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IExternalAccessRule[] = + []; + const iterable = client.listExternalAccessRulesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listExternalAccessRules + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listExternalAccessRules + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes checkDeletePrivateConnectionProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeletePrivateConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with listExternalAccessRules with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExternalAccessRules.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExternalAccessRulesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IExternalAccessRule[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listExternalAccessRules + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listExternalAccessRules + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listLoggingServers', () => { + it('invokes listLoggingServers without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListLoggingServersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListLoggingServersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.LoggingServer(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.LoggingServer(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.LoggingServer(), + ), + ]; + client.innerApiCalls.listLoggingServers = + stubSimpleCall(expectedResponse); + const [response] = await client.listLoggingServers(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listLoggingServers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listLoggingServers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('grantDnsBindPermission', () => { - it('invokes grantDnsBindPermission without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.grantDnsBindPermission = stubLongRunningCall(expectedResponse); - const [operation] = await client.grantDnsBindPermission(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.grantDnsBindPermission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.grantDnsBindPermission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listLoggingServers without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListLoggingServersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListLoggingServersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.LoggingServer(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.LoggingServer(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.LoggingServer(), + ), + ]; + client.innerApiCalls.listLoggingServers = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listLoggingServers( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmwareengine.v1.ILoggingServer[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listLoggingServers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listLoggingServers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes grantDnsBindPermission without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.grantDnsBindPermission = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.grantDnsBindPermission( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.grantDnsBindPermission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.grantDnsBindPermission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listLoggingServers with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListLoggingServersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListLoggingServersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listLoggingServers = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listLoggingServers(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listLoggingServers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listLoggingServers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes grantDnsBindPermission with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.grantDnsBindPermission = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.grantDnsBindPermission(request), expectedError); - const actualRequest = (client.innerApiCalls.grantDnsBindPermission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.grantDnsBindPermission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listLoggingServersStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListLoggingServersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListLoggingServersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.LoggingServer(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.LoggingServer(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.LoggingServer(), + ), + ]; + client.descriptors.page.listLoggingServers.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listLoggingServersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.LoggingServer[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.LoggingServer) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listLoggingServers.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listLoggingServers, request), + ); + assert( + (client.descriptors.page.listLoggingServers.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes grantDnsBindPermission with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.GrantDnsBindPermissionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.grantDnsBindPermission = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.grantDnsBindPermission(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.grantDnsBindPermission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.grantDnsBindPermission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listLoggingServersStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListLoggingServersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListLoggingServersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listLoggingServers.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listLoggingServersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.LoggingServer[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.LoggingServer) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listLoggingServers.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listLoggingServers, request), + ); + assert( + (client.descriptors.page.listLoggingServers.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkGrantDnsBindPermissionProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkGrantDnsBindPermissionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('uses async iteration with listLoggingServers without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListLoggingServersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListLoggingServersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.LoggingServer(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.LoggingServer(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.LoggingServer(), + ), + ]; + client.descriptors.page.listLoggingServers.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.ILoggingServer[] = + []; + const iterable = client.listLoggingServersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listLoggingServers.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listLoggingServers.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkGrantDnsBindPermissionProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkGrantDnsBindPermissionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with listLoggingServers with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListLoggingServersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListLoggingServersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listLoggingServers.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLoggingServersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.ILoggingServer[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listLoggingServers.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listLoggingServers.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listNodeTypes', () => { + it('invokes listNodeTypes without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNodeTypesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType(), + ), + ]; + client.innerApiCalls.listNodeTypes = stubSimpleCall(expectedResponse); + const [response] = await client.listNodeTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNodeTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNodeTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('revokeDnsBindPermission', () => { - it('invokes revokeDnsBindPermission without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.revokeDnsBindPermission = stubLongRunningCall(expectedResponse); - const [operation] = await client.revokeDnsBindPermission(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.revokeDnsBindPermission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.revokeDnsBindPermission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listNodeTypes without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNodeTypesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType(), + ), + ]; + client.innerApiCalls.listNodeTypes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNodeTypes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.INodeType[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNodeTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNodeTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes revokeDnsBindPermission without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.revokeDnsBindPermission = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.revokeDnsBindPermission( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.revokeDnsBindPermission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.revokeDnsBindPermission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listNodeTypes with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNodeTypesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNodeTypes = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listNodeTypes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listNodeTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNodeTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes revokeDnsBindPermission with call error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.revokeDnsBindPermission = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.revokeDnsBindPermission(request), expectedError); - const actualRequest = (client.innerApiCalls.revokeDnsBindPermission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.revokeDnsBindPermission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listNodeTypesStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNodeTypesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType(), + ), + ]; + client.descriptors.page.listNodeTypes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listNodeTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.NodeType[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.NodeType) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listNodeTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listNodeTypes, request), + ); + assert( + (client.descriptors.page.listNodeTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes revokeDnsBindPermission with LRO error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.RevokeDnsBindPermissionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.revokeDnsBindPermission = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.revokeDnsBindPermission(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.revokeDnsBindPermission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.revokeDnsBindPermission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listNodeTypesStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNodeTypesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodeTypes.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listNodeTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.NodeType[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.NodeType) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listNodeTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listNodeTypes, request), + ); + assert( + (client.descriptors.page.listNodeTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkRevokeDnsBindPermissionProgress without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRevokeDnsBindPermissionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('uses async iteration with listNodeTypes without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNodeTypesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NodeType(), + ), + ]; + client.descriptors.page.listNodeTypes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.INodeType[] = []; + const iterable = client.listNodeTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listNodeTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listNodeTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes checkRevokeDnsBindPermissionProgress with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRevokeDnsBindPermissionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('uses async iteration with listNodeTypes with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNodeTypesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNodeTypes.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNodeTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.INodeType[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listNodeTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listNodeTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listNetworkPeerings', () => { + it('invokes listNetworkPeerings without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPeering(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPeering(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPeering(), + ), + ]; + client.innerApiCalls.listNetworkPeerings = + stubSimpleCall(expectedResponse); + const [response] = await client.listNetworkPeerings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNetworkPeerings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNetworkPeerings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listPrivateClouds', () => { - it('invokes listPrivateClouds without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - ]; - client.innerApiCalls.listPrivateClouds = stubSimpleCall(expectedResponse); - const [response] = await client.listPrivateClouds(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateClouds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateClouds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listNetworkPeerings without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPeering(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPeering(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPeering(), + ), + ]; + client.innerApiCalls.listNetworkPeerings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNetworkPeerings( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmwareengine.v1.INetworkPeering[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNetworkPeerings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNetworkPeerings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listPrivateClouds without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - ]; - client.innerApiCalls.listPrivateClouds = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPrivateClouds( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPrivateCloud[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateClouds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateClouds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listNetworkPeerings with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNetworkPeerings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listNetworkPeerings(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listNetworkPeerings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNetworkPeerings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listPrivateClouds with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPrivateClouds = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPrivateClouds(request), expectedError); - const actualRequest = (client.innerApiCalls.listPrivateClouds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateClouds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listNetworkPeeringsStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPeering(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPeering(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPeering(), + ), + ]; + client.descriptors.page.listNetworkPeerings.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listNetworkPeeringsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.NetworkPeering[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.NetworkPeering) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listNetworkPeerings.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listNetworkPeerings, request), + ); + assert( + (client.descriptors.page.listNetworkPeerings.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listPrivateCloudsStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - ]; - client.descriptors.page.listPrivateClouds.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPrivateCloudsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.PrivateCloud[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PrivateCloud) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listPrivateClouds.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateClouds, request)); - assert( - (client.descriptors.page.listPrivateClouds.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listNetworkPeeringsStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNetworkPeerings.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listNetworkPeeringsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.NetworkPeering[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.NetworkPeering) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listNetworkPeerings.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listNetworkPeerings, request), + ); + assert( + (client.descriptors.page.listNetworkPeerings.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listPrivateCloudsStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateClouds.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPrivateCloudsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.PrivateCloud[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PrivateCloud) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPrivateClouds.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateClouds, request)); - assert( - (client.descriptors.page.listPrivateClouds.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listNetworkPeerings without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPeering(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPeering(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPeering(), + ), + ]; + client.descriptors.page.listNetworkPeerings.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.INetworkPeering[] = + []; + const iterable = client.listNetworkPeeringsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listNetworkPeerings.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listNetworkPeerings.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listPrivateClouds without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateCloud()), - ]; - client.descriptors.page.listPrivateClouds.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IPrivateCloud[] = []; - const iterable = client.listPrivateCloudsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listNetworkPeerings with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNetworkPeerings.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNetworkPeeringsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.INetworkPeering[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listNetworkPeerings.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listNetworkPeerings.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listPeeringRoutes', () => { + it('invokes listPeeringRoutes without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + ]; + client.innerApiCalls.listPeeringRoutes = stubSimpleCall(expectedResponse); + const [response] = await client.listPeeringRoutes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPeeringRoutes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPeeringRoutes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listPrivateClouds with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateCloudsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateClouds.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPrivateCloudsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IPrivateCloud[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateClouds.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listPeeringRoutes without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + ]; + client.innerApiCalls.listPeeringRoutes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPeeringRoutes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.IPeeringRoute[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPeeringRoutes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPeeringRoutes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listClusters', () => { - it('invokes listClusters without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - ]; - client.innerApiCalls.listClusters = stubSimpleCall(expectedResponse); - const [response] = await client.listClusters(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPeeringRoutes with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPeeringRoutes = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listPeeringRoutes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listPeeringRoutes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPeeringRoutes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listClusters without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - ]; - client.innerApiCalls.listClusters = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listClusters( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ICluster[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPeeringRoutesStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + ]; + client.descriptors.page.listPeeringRoutes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listPeeringRoutesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.PeeringRoute[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.PeeringRoute) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listPeeringRoutes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listPeeringRoutes, request), + ); + assert( + (client.descriptors.page.listPeeringRoutes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listClusters with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listClusters = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listClusters(request), expectedError); - const actualRequest = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listClusters as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPeeringRoutesStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPeeringRoutes.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listPeeringRoutesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.PeeringRoute[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.PeeringRoute) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listPeeringRoutes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listPeeringRoutes, request), + ); + assert( + (client.descriptors.page.listPeeringRoutes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listClustersStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - ]; - client.descriptors.page.listClusters.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.Cluster[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.Cluster) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listClusters, request)); - assert( - (client.descriptors.page.listClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listPeeringRoutes without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + ]; + client.descriptors.page.listPeeringRoutes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IPeeringRoute[] = []; + const iterable = client.listPeeringRoutesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listPeeringRoutes.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listPeeringRoutes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listClustersStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listClusters.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listClustersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.Cluster[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.Cluster) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listClusters.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listClusters, request)); - assert( - (client.descriptors.page.listClusters.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listPeeringRoutes with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPeeringRoutes.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPeeringRoutesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IPeeringRoute[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listPeeringRoutes.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listPeeringRoutes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listHcxActivationKeys', () => { + it('invokes listHcxActivationKeys without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey(), + ), + ]; + client.innerApiCalls.listHcxActivationKeys = + stubSimpleCall(expectedResponse); + const [response] = await client.listHcxActivationKeys(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listHcxActivationKeys as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listHcxActivationKeys as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listClusters without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Cluster()), - ]; - client.descriptors.page.listClusters.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.ICluster[] = []; - const iterable = client.listClustersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listHcxActivationKeys without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey(), + ), + ]; + client.innerApiCalls.listHcxActivationKeys = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listHcxActivationKeys( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmwareengine.v1.IHcxActivationKey[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listHcxActivationKeys as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listHcxActivationKeys as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listClusters with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListClustersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListClustersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listClusters.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listClustersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.ICluster[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listClusters.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listHcxActivationKeys with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listHcxActivationKeys = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listHcxActivationKeys(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listHcxActivationKeys as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listHcxActivationKeys as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listNodes', () => { - it('invokes listNodes without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), - ]; - client.innerApiCalls.listNodes = stubSimpleCall(expectedResponse); - const [response] = await client.listNodes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listHcxActivationKeysStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey(), + ), + ]; + client.descriptors.page.listHcxActivationKeys.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listHcxActivationKeysStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.HcxActivationKey[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.HcxActivationKey) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listHcxActivationKeys + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listHcxActivationKeys, request), + ); + assert( + ( + client.descriptors.page.listHcxActivationKeys + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listNodes without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), - ]; - client.innerApiCalls.listNodes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNodes( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INode[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listHcxActivationKeysStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listHcxActivationKeys.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listHcxActivationKeysStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.HcxActivationKey[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.HcxActivationKey) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listHcxActivationKeys + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listHcxActivationKeys, request), + ); + assert( + ( + client.descriptors.page.listHcxActivationKeys + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listNodes with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNodes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNodes(request), expectedError); - const actualRequest = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodesStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), - ]; - client.descriptors.page.listNodes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNodesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.Node[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.Node) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNodes, request)); - assert( - (client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNodesStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNodes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNodesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.Node[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.Node) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNodes, request)); - assert( - (client.descriptors.page.listNodes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNodes without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Node()), - ]; - client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.INode[] = []; - const iterable = client.listNodesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNodes with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNodes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNodesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.INode[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNodes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listHcxActivationKeys without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.HcxActivationKey(), + ), + ]; + client.descriptors.page.listHcxActivationKeys.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IHcxActivationKey[] = + []; + const iterable = client.listHcxActivationKeysAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listHcxActivationKeys + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listHcxActivationKeys + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('listExternalAddresses', () => { - it('invokes listExternalAddresses without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListExternalAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListExternalAddressesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - ]; - client.innerApiCalls.listExternalAddresses = stubSimpleCall(expectedResponse); - const [response] = await client.listExternalAddresses(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExternalAddresses as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExternalAddresses as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExternalAddresses without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListExternalAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListExternalAddressesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - ]; - client.innerApiCalls.listExternalAddresses = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExternalAddresses( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IExternalAddress[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExternalAddresses as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExternalAddresses as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExternalAddresses with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListExternalAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListExternalAddressesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExternalAddresses = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExternalAddresses(request), expectedError); - const actualRequest = (client.innerApiCalls.listExternalAddresses as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExternalAddresses as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExternalAddressesStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListExternalAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListExternalAddressesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - ]; - client.descriptors.page.listExternalAddresses.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExternalAddressesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.ExternalAddress[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.ExternalAddress) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listExternalAddresses.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExternalAddresses, request)); - assert( - (client.descriptors.page.listExternalAddresses.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listExternalAddressesStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListExternalAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListExternalAddressesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExternalAddresses.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExternalAddressesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.ExternalAddress[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.ExternalAddress) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExternalAddresses.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExternalAddresses, request)); - assert( - (client.descriptors.page.listExternalAddresses.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExternalAddresses without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListExternalAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListExternalAddressesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - ]; - client.descriptors.page.listExternalAddresses.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IExternalAddress[] = []; - const iterable = client.listExternalAddressesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExternalAddresses.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExternalAddresses.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExternalAddresses with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListExternalAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListExternalAddressesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExternalAddresses.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExternalAddressesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IExternalAddress[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExternalAddresses.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExternalAddresses.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listHcxActivationKeys with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listHcxActivationKeys.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listHcxActivationKeysAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IHcxActivationKey[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listHcxActivationKeys + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listHcxActivationKeys + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - - describe('fetchNetworkPolicyExternalAddresses', () => { - it('invokes fetchNetworkPolicyExternalAddresses without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest', ['networkPolicy']); - request.networkPolicy = defaultValue1; - const expectedHeaderRequestParams = `network_policy=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - ]; - client.innerApiCalls.fetchNetworkPolicyExternalAddresses = stubSimpleCall(expectedResponse); - const [response] = await client.fetchNetworkPolicyExternalAddresses(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchNetworkPolicyExternalAddresses as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchNetworkPolicyExternalAddresses as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchNetworkPolicyExternalAddresses without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest', ['networkPolicy']); - request.networkPolicy = defaultValue1; - const expectedHeaderRequestParams = `network_policy=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - ]; - client.innerApiCalls.fetchNetworkPolicyExternalAddresses = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchNetworkPolicyExternalAddresses( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IExternalAddress[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchNetworkPolicyExternalAddresses as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchNetworkPolicyExternalAddresses as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchNetworkPolicyExternalAddresses with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest', ['networkPolicy']); - request.networkPolicy = defaultValue1; - const expectedHeaderRequestParams = `network_policy=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchNetworkPolicyExternalAddresses = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchNetworkPolicyExternalAddresses(request), expectedError); - const actualRequest = (client.innerApiCalls.fetchNetworkPolicyExternalAddresses as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchNetworkPolicyExternalAddresses as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchNetworkPolicyExternalAddressesStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest', ['networkPolicy']); - request.networkPolicy = defaultValue1; - const expectedHeaderRequestParams = `network_policy=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - ]; - client.descriptors.page.fetchNetworkPolicyExternalAddresses.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.fetchNetworkPolicyExternalAddressesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.ExternalAddress[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.ExternalAddress) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.fetchNetworkPolicyExternalAddresses.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.fetchNetworkPolicyExternalAddresses, request)); - assert( - (client.descriptors.page.fetchNetworkPolicyExternalAddresses.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes fetchNetworkPolicyExternalAddressesStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest', ['networkPolicy']); - request.networkPolicy = defaultValue1; - const expectedHeaderRequestParams = `network_policy=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.fetchNetworkPolicyExternalAddresses.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.fetchNetworkPolicyExternalAddressesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.ExternalAddress[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.ExternalAddress) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.fetchNetworkPolicyExternalAddresses.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.fetchNetworkPolicyExternalAddresses, request)); - assert( - (client.descriptors.page.fetchNetworkPolicyExternalAddresses.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with fetchNetworkPolicyExternalAddresses without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest', ['networkPolicy']); - request.networkPolicy = defaultValue1; - const expectedHeaderRequestParams = `network_policy=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAddress()), - ]; - client.descriptors.page.fetchNetworkPolicyExternalAddresses.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IExternalAddress[] = []; - const iterable = client.fetchNetworkPolicyExternalAddressesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.fetchNetworkPolicyExternalAddresses.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.fetchNetworkPolicyExternalAddresses.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with fetchNetworkPolicyExternalAddresses with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.FetchNetworkPolicyExternalAddressesRequest', ['networkPolicy']); - request.networkPolicy = defaultValue1; - const expectedHeaderRequestParams = `network_policy=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.fetchNetworkPolicyExternalAddresses.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.fetchNetworkPolicyExternalAddressesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IExternalAddress[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.fetchNetworkPolicyExternalAddresses.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.fetchNetworkPolicyExternalAddresses.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }); + + describe('listNetworkPolicies', () => { + it('invokes listNetworkPolicies without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy(), + ), + ]; + client.innerApiCalls.listNetworkPolicies = + stubSimpleCall(expectedResponse); + const [response] = await client.listNetworkPolicies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNetworkPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNetworkPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listSubnets', () => { - it('invokes listSubnets without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - ]; - client.innerApiCalls.listSubnets = stubSimpleCall(expectedResponse); - const [response] = await client.listSubnets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSubnets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSubnets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSubnets without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - ]; - client.innerApiCalls.listSubnets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSubnets( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ISubnet[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSubnets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSubnets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSubnets with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSubnets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSubnets(request), expectedError); - const actualRequest = (client.innerApiCalls.listSubnets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSubnets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSubnetsStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - ]; - client.descriptors.page.listSubnets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSubnetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.Subnet[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.Subnet) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSubnets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSubnets, request)); - assert( - (client.descriptors.page.listSubnets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSubnetsStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSubnets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSubnetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.Subnet[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.Subnet) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSubnets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSubnets, request)); - assert( - (client.descriptors.page.listSubnets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSubnets without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.Subnet()), - ]; - client.descriptors.page.listSubnets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.ISubnet[] = []; - const iterable = client.listSubnetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listNetworkPolicies without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy(), + ), + ]; + client.innerApiCalls.listNetworkPolicies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listNetworkPolicies( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmwareengine.v1.INetworkPolicy[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSubnets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSubnets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSubnets with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListSubnetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListSubnetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSubnets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSubnetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.ISubnet[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSubnets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSubnets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listNetworkPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNetworkPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listExternalAccessRules', () => { - it('invokes listExternalAccessRules without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAccessRule()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAccessRule()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAccessRule()), - ]; - client.innerApiCalls.listExternalAccessRules = stubSimpleCall(expectedResponse); - const [response] = await client.listExternalAccessRules(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExternalAccessRules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExternalAccessRules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExternalAccessRules without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAccessRule()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAccessRule()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAccessRule()), - ]; - client.innerApiCalls.listExternalAccessRules = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExternalAccessRules( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IExternalAccessRule[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExternalAccessRules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExternalAccessRules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExternalAccessRules with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExternalAccessRules = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExternalAccessRules(request), expectedError); - const actualRequest = (client.innerApiCalls.listExternalAccessRules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExternalAccessRules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExternalAccessRulesStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAccessRule()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAccessRule()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAccessRule()), - ]; - client.descriptors.page.listExternalAccessRules.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExternalAccessRulesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.ExternalAccessRule[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.ExternalAccessRule) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listExternalAccessRules.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExternalAccessRules, request)); - assert( - (client.descriptors.page.listExternalAccessRules.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listExternalAccessRulesStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExternalAccessRules.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExternalAccessRulesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.ExternalAccessRule[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.ExternalAccessRule) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExternalAccessRules.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExternalAccessRules, request)); - assert( - (client.descriptors.page.listExternalAccessRules.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExternalAccessRules without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAccessRule()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAccessRule()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ExternalAccessRule()), - ]; - client.descriptors.page.listExternalAccessRules.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IExternalAccessRule[] = []; - const iterable = client.listExternalAccessRulesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExternalAccessRules.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExternalAccessRules.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExternalAccessRules with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListExternalAccessRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExternalAccessRules.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExternalAccessRulesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IExternalAccessRule[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExternalAccessRules.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExternalAccessRules.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listNetworkPolicies with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listNetworkPolicies = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listNetworkPolicies(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listNetworkPolicies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listNetworkPolicies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listLoggingServers', () => { - it('invokes listLoggingServers without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListLoggingServersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListLoggingServersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.LoggingServer()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.LoggingServer()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.LoggingServer()), - ]; - client.innerApiCalls.listLoggingServers = stubSimpleCall(expectedResponse); - const [response] = await client.listLoggingServers(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLoggingServers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLoggingServers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLoggingServers without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListLoggingServersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListLoggingServersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.LoggingServer()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.LoggingServer()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.LoggingServer()), - ]; - client.innerApiCalls.listLoggingServers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLoggingServers( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.ILoggingServer[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLoggingServers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLoggingServers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLoggingServers with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListLoggingServersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListLoggingServersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLoggingServers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLoggingServers(request), expectedError); - const actualRequest = (client.innerApiCalls.listLoggingServers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLoggingServers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLoggingServersStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListLoggingServersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListLoggingServersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.LoggingServer()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.LoggingServer()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.LoggingServer()), - ]; - client.descriptors.page.listLoggingServers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLoggingServersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.LoggingServer[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.LoggingServer) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLoggingServers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLoggingServers, request)); - assert( - (client.descriptors.page.listLoggingServers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listLoggingServersStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListLoggingServersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListLoggingServersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLoggingServers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLoggingServersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.LoggingServer[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.LoggingServer) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLoggingServers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLoggingServers, request)); - assert( - (client.descriptors.page.listLoggingServers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLoggingServers without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListLoggingServersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListLoggingServersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.LoggingServer()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.LoggingServer()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.LoggingServer()), - ]; - client.descriptors.page.listLoggingServers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.ILoggingServer[] = []; - const iterable = client.listLoggingServersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLoggingServers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLoggingServers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLoggingServers with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListLoggingServersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListLoggingServersRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLoggingServers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLoggingServersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.ILoggingServer[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLoggingServers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLoggingServers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listNetworkPoliciesStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy(), + ), + ]; + client.descriptors.page.listNetworkPolicies.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listNetworkPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.NetworkPolicy[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.NetworkPolicy) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listNetworkPolicies.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listNetworkPolicies, request), + ); + assert( + (client.descriptors.page.listNetworkPolicies.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('listNodeTypes', () => { - it('invokes listNodeTypes without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - ]; - client.innerApiCalls.listNodeTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listNodeTypes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodeTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodeTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodeTypes without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - ]; - client.innerApiCalls.listNodeTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNodeTypes( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INodeType[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNodeTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodeTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodeTypes with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNodeTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNodeTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listNodeTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNodeTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNodeTypesStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - ]; - client.descriptors.page.listNodeTypes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNodeTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.NodeType[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.NodeType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listNodeTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNodeTypes, request)); - assert( - (client.descriptors.page.listNodeTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNodeTypesStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNodeTypes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNodeTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.NodeType[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.NodeType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNodeTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNodeTypes, request)); - assert( - (client.descriptors.page.listNodeTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNodeTypes without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NodeType()), - ]; - client.descriptors.page.listNodeTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.INodeType[] = []; - const iterable = client.listNodeTypesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNodeTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNodeTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNodeTypes with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNodeTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNodeTypesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNodeTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNodeTypesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.INodeType[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNodeTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNodeTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listNetworkPoliciesStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNetworkPolicies.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listNetworkPoliciesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.NetworkPolicy[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.NetworkPolicy) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listNetworkPolicies.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listNetworkPolicies, request), + ); + assert( + (client.descriptors.page.listNetworkPolicies.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('listNetworkPeerings', () => { - it('invokes listNetworkPeerings without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPeering()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPeering()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPeering()), - ]; - client.innerApiCalls.listNetworkPeerings = stubSimpleCall(expectedResponse); - const [response] = await client.listNetworkPeerings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNetworkPeerings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNetworkPeerings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNetworkPeerings without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPeering()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPeering()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPeering()), - ]; - client.innerApiCalls.listNetworkPeerings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNetworkPeerings( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INetworkPeering[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNetworkPeerings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNetworkPeerings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNetworkPeerings with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNetworkPeerings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNetworkPeerings(request), expectedError); - const actualRequest = (client.innerApiCalls.listNetworkPeerings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNetworkPeerings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNetworkPeeringsStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPeering()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPeering()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPeering()), - ]; - client.descriptors.page.listNetworkPeerings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNetworkPeeringsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.NetworkPeering[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.NetworkPeering) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listNetworkPeerings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNetworkPeerings, request)); - assert( - (client.descriptors.page.listNetworkPeerings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNetworkPeeringsStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNetworkPeerings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNetworkPeeringsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.NetworkPeering[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.NetworkPeering) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNetworkPeerings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNetworkPeerings, request)); - assert( - (client.descriptors.page.listNetworkPeerings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNetworkPeerings without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPeering()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPeering()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPeering()), - ]; - client.descriptors.page.listNetworkPeerings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.INetworkPeering[] = []; - const iterable = client.listNetworkPeeringsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNetworkPeerings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNetworkPeerings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNetworkPeerings with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPeeringsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNetworkPeerings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNetworkPeeringsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.INetworkPeering[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNetworkPeerings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNetworkPeerings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listNetworkPolicies without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.NetworkPolicy(), + ), + ]; + client.descriptors.page.listNetworkPolicies.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.INetworkPolicy[] = + []; + const iterable = client.listNetworkPoliciesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('listPeeringRoutes', () => { - it('invokes listPeeringRoutes without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - ]; - client.innerApiCalls.listPeeringRoutes = stubSimpleCall(expectedResponse); - const [response] = await client.listPeeringRoutes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPeeringRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPeeringRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPeeringRoutes without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - ]; - client.innerApiCalls.listPeeringRoutes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPeeringRoutes( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPeeringRoute[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPeeringRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPeeringRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPeeringRoutes with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPeeringRoutes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPeeringRoutes(request), expectedError); - const actualRequest = (client.innerApiCalls.listPeeringRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPeeringRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPeeringRoutesStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - ]; - client.descriptors.page.listPeeringRoutes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPeeringRoutesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.PeeringRoute[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PeeringRoute) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listPeeringRoutes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPeeringRoutes, request)); - assert( - (client.descriptors.page.listPeeringRoutes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPeeringRoutesStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listPeeringRoutes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPeeringRoutesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.PeeringRoute[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PeeringRoute) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPeeringRoutes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPeeringRoutes, request)); - assert( - (client.descriptors.page.listPeeringRoutes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPeeringRoutes without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - ]; - client.descriptors.page.listPeeringRoutes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IPeeringRoute[] = []; - const iterable = client.listPeeringRoutesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPeeringRoutes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPeeringRoutes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPeeringRoutes with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listPeeringRoutes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPeeringRoutesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IPeeringRoute[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPeeringRoutes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPeeringRoutes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listNetworkPolicies with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listNetworkPolicies.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listNetworkPoliciesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.INetworkPolicy[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - - describe('listHcxActivationKeys', () => { - it('invokes listHcxActivationKeys without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - ]; - client.innerApiCalls.listHcxActivationKeys = stubSimpleCall(expectedResponse); - const [response] = await client.listHcxActivationKeys(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listHcxActivationKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listHcxActivationKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listHcxActivationKeys without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - ]; - client.innerApiCalls.listHcxActivationKeys = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listHcxActivationKeys( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IHcxActivationKey[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listHcxActivationKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listHcxActivationKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listHcxActivationKeys with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listHcxActivationKeys = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listHcxActivationKeys(request), expectedError); - const actualRequest = (client.innerApiCalls.listHcxActivationKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listHcxActivationKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listHcxActivationKeysStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - ]; - client.descriptors.page.listHcxActivationKeys.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listHcxActivationKeysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.HcxActivationKey[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.HcxActivationKey) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listHcxActivationKeys.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listHcxActivationKeys, request)); - assert( - (client.descriptors.page.listHcxActivationKeys.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listHcxActivationKeysStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listHcxActivationKeys.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listHcxActivationKeysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.HcxActivationKey[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.HcxActivationKey) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listHcxActivationKeys.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listHcxActivationKeys, request)); - assert( - (client.descriptors.page.listHcxActivationKeys.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listHcxActivationKeys without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.HcxActivationKey()), - ]; - client.descriptors.page.listHcxActivationKeys.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IHcxActivationKey[] = []; - const iterable = client.listHcxActivationKeysAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listHcxActivationKeys.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listHcxActivationKeys.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listHcxActivationKeys with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListHcxActivationKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listHcxActivationKeys.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listHcxActivationKeysAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IHcxActivationKey[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listHcxActivationKeys.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listHcxActivationKeys.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }); + + describe('listManagementDnsZoneBindings', () => { + it('invokes listManagementDnsZoneBindings without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding(), + ), + ]; + client.innerApiCalls.listManagementDnsZoneBindings = + stubSimpleCall(expectedResponse); + const [response] = await client.listManagementDnsZoneBindings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listManagementDnsZoneBindings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listManagementDnsZoneBindings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listNetworkPolicies', () => { - it('invokes listNetworkPolicies without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - ]; - client.innerApiCalls.listNetworkPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listNetworkPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNetworkPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNetworkPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNetworkPolicies without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - ]; - client.innerApiCalls.listNetworkPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNetworkPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.INetworkPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNetworkPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNetworkPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNetworkPolicies with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNetworkPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNetworkPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listNetworkPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNetworkPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNetworkPoliciesStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - ]; - client.descriptors.page.listNetworkPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNetworkPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.NetworkPolicy[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.NetworkPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listNetworkPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNetworkPolicies, request)); - assert( - (client.descriptors.page.listNetworkPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNetworkPoliciesStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNetworkPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNetworkPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.NetworkPolicy[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.NetworkPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNetworkPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNetworkPolicies, request)); - assert( - (client.descriptors.page.listNetworkPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNetworkPolicies without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.NetworkPolicy()), - ]; - client.descriptors.page.listNetworkPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.INetworkPolicy[] = []; - const iterable = client.listNetworkPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listManagementDnsZoneBindings without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding(), + ), + ]; + client.innerApiCalls.listManagementDnsZoneBindings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listManagementDnsZoneBindings( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNetworkPolicies with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListNetworkPoliciesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNetworkPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNetworkPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.INetworkPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNetworkPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listManagementDnsZoneBindings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listManagementDnsZoneBindings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listManagementDnsZoneBindings', () => { - it('invokes listManagementDnsZoneBindings without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding()), - ]; - client.innerApiCalls.listManagementDnsZoneBindings = stubSimpleCall(expectedResponse); - const [response] = await client.listManagementDnsZoneBindings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listManagementDnsZoneBindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listManagementDnsZoneBindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listManagementDnsZoneBindings with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listManagementDnsZoneBindings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listManagementDnsZoneBindings(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listManagementDnsZoneBindings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listManagementDnsZoneBindings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listManagementDnsZoneBindings without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding()), - ]; - client.innerApiCalls.listManagementDnsZoneBindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listManagementDnsZoneBindings( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listManagementDnsZoneBindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listManagementDnsZoneBindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listManagementDnsZoneBindingsStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding(), + ), + ]; + client.descriptors.page.listManagementDnsZoneBindings.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listManagementDnsZoneBindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listManagementDnsZoneBindings + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listManagementDnsZoneBindings, + request, + ), + ); + assert( + ( + client.descriptors.page.listManagementDnsZoneBindings + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listManagementDnsZoneBindings with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listManagementDnsZoneBindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listManagementDnsZoneBindings(request), expectedError); - const actualRequest = (client.innerApiCalls.listManagementDnsZoneBindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listManagementDnsZoneBindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listManagementDnsZoneBindingsStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listManagementDnsZoneBindings.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listManagementDnsZoneBindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listManagementDnsZoneBindings + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listManagementDnsZoneBindings, + request, + ), + ); + assert( + ( + client.descriptors.page.listManagementDnsZoneBindings + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listManagementDnsZoneBindingsStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding()), - ]; - client.descriptors.page.listManagementDnsZoneBindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listManagementDnsZoneBindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listManagementDnsZoneBindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listManagementDnsZoneBindings, request)); - assert( - (client.descriptors.page.listManagementDnsZoneBindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listManagementDnsZoneBindings without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding(), + ), + ]; + client.descriptors.page.listManagementDnsZoneBindings.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding[] = + []; + const iterable = client.listManagementDnsZoneBindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listManagementDnsZoneBindings + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listManagementDnsZoneBindings + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listManagementDnsZoneBindingsStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listManagementDnsZoneBindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listManagementDnsZoneBindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listManagementDnsZoneBindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listManagementDnsZoneBindings, request)); - assert( - (client.descriptors.page.listManagementDnsZoneBindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listManagementDnsZoneBindings with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listManagementDnsZoneBindings.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listManagementDnsZoneBindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listManagementDnsZoneBindings + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listManagementDnsZoneBindings + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listVmwareEngineNetworks', () => { + it('invokes listVmwareEngineNetworks without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork(), + ), + ]; + client.innerApiCalls.listVmwareEngineNetworks = + stubSimpleCall(expectedResponse); + const [response] = await client.listVmwareEngineNetworks(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listVmwareEngineNetworks as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listVmwareEngineNetworks as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listManagementDnsZoneBindings without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.ManagementDnsZoneBinding()), - ]; - client.descriptors.page.listManagementDnsZoneBindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding[] = []; - const iterable = client.listManagementDnsZoneBindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listVmwareEngineNetworks without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork(), + ), + ]; + client.innerApiCalls.listVmwareEngineNetworks = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listVmwareEngineNetworks( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listManagementDnsZoneBindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listManagementDnsZoneBindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listManagementDnsZoneBindings with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListManagementDnsZoneBindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listManagementDnsZoneBindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listManagementDnsZoneBindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IManagementDnsZoneBinding[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listManagementDnsZoneBindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listManagementDnsZoneBindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listVmwareEngineNetworks as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listVmwareEngineNetworks as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listVmwareEngineNetworks', () => { - it('invokes listVmwareEngineNetworks without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - ]; - client.innerApiCalls.listVmwareEngineNetworks = stubSimpleCall(expectedResponse); - const [response] = await client.listVmwareEngineNetworks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listVmwareEngineNetworks with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listVmwareEngineNetworks = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listVmwareEngineNetworks(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listVmwareEngineNetworks as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listVmwareEngineNetworks as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listVmwareEngineNetworks without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - ]; - client.innerApiCalls.listVmwareEngineNetworks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listVmwareEngineNetworks( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listVmwareEngineNetworksStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork(), + ), + ]; + client.descriptors.page.listVmwareEngineNetworks.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listVmwareEngineNetworksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listVmwareEngineNetworks + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listVmwareEngineNetworks, request), + ); + assert( + ( + client.descriptors.page.listVmwareEngineNetworks + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listVmwareEngineNetworks with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listVmwareEngineNetworks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listVmwareEngineNetworks(request), expectedError); - const actualRequest = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listVmwareEngineNetworks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listVmwareEngineNetworksStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVmwareEngineNetworks.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listVmwareEngineNetworksStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listVmwareEngineNetworks + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listVmwareEngineNetworks, request), + ); + assert( + ( + client.descriptors.page.listVmwareEngineNetworks + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listVmwareEngineNetworksStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - ]; - client.descriptors.page.listVmwareEngineNetworks.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listVmwareEngineNetworksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listVmwareEngineNetworks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVmwareEngineNetworks, request)); - assert( - (client.descriptors.page.listVmwareEngineNetworks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listVmwareEngineNetworks without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork(), + ), + ]; + client.descriptors.page.listVmwareEngineNetworks.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[] = + []; + const iterable = client.listVmwareEngineNetworksAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listVmwareEngineNetworks + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listVmwareEngineNetworks + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listVmwareEngineNetworksStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listVmwareEngineNetworks.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listVmwareEngineNetworksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listVmwareEngineNetworks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listVmwareEngineNetworks, request)); - assert( - (client.descriptors.page.listVmwareEngineNetworks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listVmwareEngineNetworks with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVmwareEngineNetworks.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listVmwareEngineNetworksAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listVmwareEngineNetworks + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listVmwareEngineNetworks + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listPrivateConnections', () => { + it('invokes listPrivateConnections without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection(), + ), + ]; + client.innerApiCalls.listPrivateConnections = + stubSimpleCall(expectedResponse); + const [response] = await client.listPrivateConnections(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPrivateConnections as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPrivateConnections as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listVmwareEngineNetworks without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.VmwareEngineNetwork()), - ]; - client.descriptors.page.listVmwareEngineNetworks.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[] = []; - const iterable = client.listVmwareEngineNetworksAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listPrivateConnections without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection(), + ), + ]; + client.innerApiCalls.listPrivateConnections = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPrivateConnections( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.vmwareengine.v1.IPrivateConnection[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listVmwareEngineNetworks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listVmwareEngineNetworks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listVmwareEngineNetworks with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListVmwareEngineNetworksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listVmwareEngineNetworks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listVmwareEngineNetworksAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IVmwareEngineNetwork[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listVmwareEngineNetworks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listVmwareEngineNetworks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPrivateConnections as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPrivateConnections as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listPrivateConnections', () => { - it('invokes listPrivateConnections without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - ]; - client.innerApiCalls.listPrivateConnections = stubSimpleCall(expectedResponse); - const [response] = await client.listPrivateConnections(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPrivateConnections with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPrivateConnections = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listPrivateConnections(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listPrivateConnections as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPrivateConnections as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listPrivateConnections without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - ]; - client.innerApiCalls.listPrivateConnections = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPrivateConnections( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPrivateConnection[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPrivateConnectionsStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection(), + ), + ]; + client.descriptors.page.listPrivateConnections.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listPrivateConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.PrivateConnection[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.PrivateConnection) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listPrivateConnections + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listPrivateConnections, request), + ); + assert( + ( + client.descriptors.page.listPrivateConnections + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listPrivateConnections with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPrivateConnections = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPrivateConnections(request), expectedError); - const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPrivateConnectionsStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateConnections.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listPrivateConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.PrivateConnection[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.PrivateConnection) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listPrivateConnections + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listPrivateConnections, request), + ); + assert( + ( + client.descriptors.page.listPrivateConnections + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listPrivateConnectionsStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - ]; - client.descriptors.page.listPrivateConnections.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPrivateConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.PrivateConnection[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PrivateConnection) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listPrivateConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateConnections, request)); - assert( - (client.descriptors.page.listPrivateConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listPrivateConnections without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PrivateConnection(), + ), + ]; + client.descriptors.page.listPrivateConnections.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IPrivateConnection[] = + []; + const iterable = client.listPrivateConnectionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listPrivateConnections + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listPrivateConnections + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listPrivateConnectionsStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateConnections.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPrivateConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.PrivateConnection[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PrivateConnection) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPrivateConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateConnections, request)); - assert( - (client.descriptors.page.listPrivateConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listPrivateConnections with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateConnections.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPrivateConnectionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IPrivateConnection[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listPrivateConnections + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listPrivateConnections + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('listPrivateConnectionPeeringRoutes', () => { + it('invokes listPrivateConnectionPeeringRoutes without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + ]; + client.innerApiCalls.listPrivateConnectionPeeringRoutes = + stubSimpleCall(expectedResponse); + const [response] = + await client.listPrivateConnectionPeeringRoutes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listPrivateConnections without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PrivateConnection()), - ]; - client.descriptors.page.listPrivateConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IPrivateConnection[] = []; - const iterable = client.listPrivateConnectionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listPrivateConnectionPeeringRoutes without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + ]; + client.innerApiCalls.listPrivateConnectionPeeringRoutes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPrivateConnectionPeeringRoutes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vmwareengine.v1.IPeeringRoute[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPrivateConnections with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPrivateConnectionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IPrivateConnection[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listPrivateConnectionPeeringRoutes', () => { - it('invokes listPrivateConnectionPeeringRoutes without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - ]; - client.innerApiCalls.listPrivateConnectionPeeringRoutes = stubSimpleCall(expectedResponse); - const [response] = await client.listPrivateConnectionPeeringRoutes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateConnectionPeeringRoutes without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - ]; - client.innerApiCalls.listPrivateConnectionPeeringRoutes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPrivateConnectionPeeringRoutes( - request, - (err?: Error|null, result?: protos.google.cloud.vmwareengine.v1.IPeeringRoute[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateConnectionPeeringRoutes with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPrivateConnectionPeeringRoutes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPrivateConnectionPeeringRoutes(request), expectedError); - const actualRequest = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listPrivateConnectionPeeringRoutes with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPrivateConnectionPeeringRoutes = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listPrivateConnectionPeeringRoutes(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listPrivateConnectionPeeringRoutesStream without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - ]; - client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPrivateConnectionPeeringRoutesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.PeeringRoute[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PeeringRoute) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateConnectionPeeringRoutes, request)); - assert( - (client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listPrivateConnectionPeeringRoutesStream without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + ]; + client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listPrivateConnectionPeeringRoutesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.PeeringRoute[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.PeeringRoute) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listPrivateConnectionPeeringRoutes + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listPrivateConnectionPeeringRoutes, + request, + ), + ); + assert( + ( + client.descriptors.page.listPrivateConnectionPeeringRoutes + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('invokes listPrivateConnectionPeeringRoutesStream with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPrivateConnectionPeeringRoutesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vmwareengine.v1.PeeringRoute[] = []; - stream.on('data', (response: protos.google.cloud.vmwareengine.v1.PeeringRoute) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateConnectionPeeringRoutes, request)); - assert( - (client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listPrivateConnectionPeeringRoutesStream with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateConnectionPeeringRoutes.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listPrivateConnectionPeeringRoutesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vmwareengine.v1.PeeringRoute[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.vmwareengine.v1.PeeringRoute) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listPrivateConnectionPeeringRoutes + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listPrivateConnectionPeeringRoutes, + request, + ), + ); + assert( + ( + client.descriptors.page.listPrivateConnectionPeeringRoutes + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listPrivateConnectionPeeringRoutes without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - generateSampleMessage(new protos.google.cloud.vmwareengine.v1.PeeringRoute()), - ]; - client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vmwareengine.v1.IPeeringRoute[] = []; - const iterable = client.listPrivateConnectionPeeringRoutesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listPrivateConnectionPeeringRoutes without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.PeeringRoute(), + ), + ]; + client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vmwareengine.v1.IPeeringRoute[] = []; + const iterable = client.listPrivateConnectionPeeringRoutesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listPrivateConnectionPeeringRoutes + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listPrivateConnectionPeeringRoutes + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); - it('uses async iteration with listPrivateConnectionPeeringRoutes with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPrivateConnectionPeeringRoutesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vmwareengine.v1.IPeeringRoute[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listPrivateConnectionPeeringRoutes with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vmwareengine.v1.ListPrivateConnectionPeeringRoutesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateConnectionPeeringRoutes.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPrivateConnectionPeeringRoutesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vmwareengine.v1.IPeeringRoute[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listPrivateConnectionPeeringRoutes + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listPrivateConnectionPeeringRoutes + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.getIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .getIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub).getCall(0)); }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + it('invokes getIamPolicy with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.getIamPolicy(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.getIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy(), + ); + client.iamClient.setIamPolicy = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .setIamPolicy( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.Policy | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('invokes setIamPolicy with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects( + client.setIamPolicy(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.setIamPolicy as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse(), + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions( + request, + expectedOptions, + ); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse(), + ); + client.iamClient.testIamPermissions = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client + .testIamPermissions( + request, + expectedOptions, + ( + err?: Error | null, + result?: IamProtos.google.iam.v1.TestIamPermissionsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub).getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest(), + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.testIamPermissions(request, expectedOptions), + expectedError, + ); + assert( + (client.iamClient.testIamPermissions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.IOperation[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.IOperation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + }); + + describe('Path templates', () => { + describe('cluster', async () => { + const fakePath = '/rendered/path/cluster'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + private_cloud: 'privateCloudValue', + cluster: 'clusterValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.clusterPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.clusterPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('clusterPath', () => { + const result = client.clusterPath( + 'projectValue', + 'locationValue', + 'privateCloudValue', + 'clusterValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.clusterPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromClusterName', () => { + const result = client.matchProjectFromClusterName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromClusterName', () => { + const result = client.matchLocationFromClusterName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPrivateCloudFromClusterName', () => { + const result = client.matchPrivateCloudFromClusterName(fakePath); + assert.strictEqual(result, 'privateCloudValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromClusterName', () => { + const result = client.matchClusterFromClusterName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.clusterPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('cluster', async () => { - const fakePath = "/rendered/path/cluster"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_cloud: "privateCloudValue", - cluster: "clusterValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.clusterPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.clusterPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('clusterPath', () => { - const result = client.clusterPath("projectValue", "locationValue", "privateCloudValue", "clusterValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.clusterPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromClusterName', () => { - const result = client.matchProjectFromClusterName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromClusterName', () => { - const result = client.matchLocationFromClusterName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateCloudFromClusterName', () => { - const result = client.matchPrivateCloudFromClusterName(fakePath); - assert.strictEqual(result, "privateCloudValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromClusterName', () => { - const result = client.matchClusterFromClusterName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.clusterPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('dnsBindPermission', async () => { - const fakePath = "/rendered/path/dnsBindPermission"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsBindPermissionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsBindPermissionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsBindPermissionPath', () => { - const result = client.dnsBindPermissionPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsBindPermissionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsBindPermissionName', () => { - const result = client.matchProjectFromDnsBindPermissionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsBindPermissionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsBindPermissionName', () => { - const result = client.matchLocationFromDnsBindPermissionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsBindPermissionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dnsBindPermission', async () => { + const fakePath = '/rendered/path/dnsBindPermission'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsBindPermissionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsBindPermissionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsBindPermissionPath', () => { + const result = client.dnsBindPermissionPath( + 'projectValue', + 'locationValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.dnsBindPermissionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsBindPermissionName', () => { + const result = client.matchProjectFromDnsBindPermissionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.dnsBindPermissionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsBindPermissionName', () => { + const result = client.matchLocationFromDnsBindPermissionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.dnsBindPermissionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dnsForwarding', async () => { - const fakePath = "/rendered/path/dnsForwarding"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_cloud: "privateCloudValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dnsForwardingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dnsForwardingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dnsForwardingPath', () => { - const result = client.dnsForwardingPath("projectValue", "locationValue", "privateCloudValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dnsForwardingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDnsForwardingName', () => { - const result = client.matchProjectFromDnsForwardingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dnsForwardingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromDnsForwardingName', () => { - const result = client.matchLocationFromDnsForwardingName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.dnsForwardingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateCloudFromDnsForwardingName', () => { - const result = client.matchPrivateCloudFromDnsForwardingName(fakePath); - assert.strictEqual(result, "privateCloudValue"); - assert((client.pathTemplates.dnsForwardingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dnsForwarding', async () => { + const fakePath = '/rendered/path/dnsForwarding'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + private_cloud: 'privateCloudValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dnsForwardingPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dnsForwardingPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dnsForwardingPath', () => { + const result = client.dnsForwardingPath( + 'projectValue', + 'locationValue', + 'privateCloudValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.dnsForwardingPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromDnsForwardingName', () => { + const result = client.matchProjectFromDnsForwardingName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.dnsForwardingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromDnsForwardingName', () => { + const result = client.matchLocationFromDnsForwardingName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.dnsForwardingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPrivateCloudFromDnsForwardingName', () => { + const result = client.matchPrivateCloudFromDnsForwardingName(fakePath); + assert.strictEqual(result, 'privateCloudValue'); + assert( + (client.pathTemplates.dnsForwardingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('externalAccessRule', async () => { - const fakePath = "/rendered/path/externalAccessRule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - network_policy: "networkPolicyValue", - external_access_rule: "externalAccessRuleValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.externalAccessRulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.externalAccessRulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('externalAccessRulePath', () => { - const result = client.externalAccessRulePath("projectValue", "locationValue", "networkPolicyValue", "externalAccessRuleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.externalAccessRulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromExternalAccessRuleName', () => { - const result = client.matchProjectFromExternalAccessRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.externalAccessRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromExternalAccessRuleName', () => { - const result = client.matchLocationFromExternalAccessRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.externalAccessRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkPolicyFromExternalAccessRuleName', () => { - const result = client.matchNetworkPolicyFromExternalAccessRuleName(fakePath); - assert.strictEqual(result, "networkPolicyValue"); - assert((client.pathTemplates.externalAccessRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExternalAccessRuleFromExternalAccessRuleName', () => { - const result = client.matchExternalAccessRuleFromExternalAccessRuleName(fakePath); - assert.strictEqual(result, "externalAccessRuleValue"); - assert((client.pathTemplates.externalAccessRulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('externalAccessRule', async () => { + const fakePath = '/rendered/path/externalAccessRule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + network_policy: 'networkPolicyValue', + external_access_rule: 'externalAccessRuleValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.externalAccessRulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.externalAccessRulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('externalAccessRulePath', () => { + const result = client.externalAccessRulePath( + 'projectValue', + 'locationValue', + 'networkPolicyValue', + 'externalAccessRuleValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.externalAccessRulePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromExternalAccessRuleName', () => { + const result = client.matchProjectFromExternalAccessRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.externalAccessRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromExternalAccessRuleName', () => { + const result = client.matchLocationFromExternalAccessRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.externalAccessRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNetworkPolicyFromExternalAccessRuleName', () => { + const result = + client.matchNetworkPolicyFromExternalAccessRuleName(fakePath); + assert.strictEqual(result, 'networkPolicyValue'); + assert( + ( + client.pathTemplates.externalAccessRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchExternalAccessRuleFromExternalAccessRuleName', () => { + const result = + client.matchExternalAccessRuleFromExternalAccessRuleName(fakePath); + assert.strictEqual(result, 'externalAccessRuleValue'); + assert( + ( + client.pathTemplates.externalAccessRulePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('externalAddress', async () => { - const fakePath = "/rendered/path/externalAddress"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_cloud: "privateCloudValue", - external_address: "externalAddressValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.externalAddressPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.externalAddressPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('externalAddressPath', () => { - const result = client.externalAddressPath("projectValue", "locationValue", "privateCloudValue", "externalAddressValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.externalAddressPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromExternalAddressName', () => { - const result = client.matchProjectFromExternalAddressName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.externalAddressPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromExternalAddressName', () => { - const result = client.matchLocationFromExternalAddressName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.externalAddressPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateCloudFromExternalAddressName', () => { - const result = client.matchPrivateCloudFromExternalAddressName(fakePath); - assert.strictEqual(result, "privateCloudValue"); - assert((client.pathTemplates.externalAddressPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExternalAddressFromExternalAddressName', () => { - const result = client.matchExternalAddressFromExternalAddressName(fakePath); - assert.strictEqual(result, "externalAddressValue"); - assert((client.pathTemplates.externalAddressPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('externalAddress', async () => { + const fakePath = '/rendered/path/externalAddress'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + private_cloud: 'privateCloudValue', + external_address: 'externalAddressValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.externalAddressPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.externalAddressPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('externalAddressPath', () => { + const result = client.externalAddressPath( + 'projectValue', + 'locationValue', + 'privateCloudValue', + 'externalAddressValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.externalAddressPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromExternalAddressName', () => { + const result = client.matchProjectFromExternalAddressName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.externalAddressPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromExternalAddressName', () => { + const result = client.matchLocationFromExternalAddressName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.externalAddressPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPrivateCloudFromExternalAddressName', () => { + const result = + client.matchPrivateCloudFromExternalAddressName(fakePath); + assert.strictEqual(result, 'privateCloudValue'); + assert( + (client.pathTemplates.externalAddressPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchExternalAddressFromExternalAddressName', () => { + const result = + client.matchExternalAddressFromExternalAddressName(fakePath); + assert.strictEqual(result, 'externalAddressValue'); + assert( + (client.pathTemplates.externalAddressPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('hcxActivationKey', async () => { - const fakePath = "/rendered/path/hcxActivationKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_cloud: "privateCloudValue", - hcx_activation_key: "hcxActivationKeyValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.hcxActivationKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.hcxActivationKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('hcxActivationKeyPath', () => { - const result = client.hcxActivationKeyPath("projectValue", "locationValue", "privateCloudValue", "hcxActivationKeyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.hcxActivationKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromHcxActivationKeyName', () => { - const result = client.matchProjectFromHcxActivationKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromHcxActivationKeyName', () => { - const result = client.matchLocationFromHcxActivationKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateCloudFromHcxActivationKeyName', () => { - const result = client.matchPrivateCloudFromHcxActivationKeyName(fakePath); - assert.strictEqual(result, "privateCloudValue"); - assert((client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchHcxActivationKeyFromHcxActivationKeyName', () => { - const result = client.matchHcxActivationKeyFromHcxActivationKeyName(fakePath); - assert.strictEqual(result, "hcxActivationKeyValue"); - assert((client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('hcxActivationKey', async () => { + const fakePath = '/rendered/path/hcxActivationKey'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + private_cloud: 'privateCloudValue', + hcx_activation_key: 'hcxActivationKeyValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.hcxActivationKeyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.hcxActivationKeyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('hcxActivationKeyPath', () => { + const result = client.hcxActivationKeyPath( + 'projectValue', + 'locationValue', + 'privateCloudValue', + 'hcxActivationKeyValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.hcxActivationKeyPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromHcxActivationKeyName', () => { + const result = client.matchProjectFromHcxActivationKeyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromHcxActivationKeyName', () => { + const result = client.matchLocationFromHcxActivationKeyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPrivateCloudFromHcxActivationKeyName', () => { + const result = + client.matchPrivateCloudFromHcxActivationKeyName(fakePath); + assert.strictEqual(result, 'privateCloudValue'); + assert( + (client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchHcxActivationKeyFromHcxActivationKeyName', () => { + const result = + client.matchHcxActivationKeyFromHcxActivationKeyName(fakePath); + assert.strictEqual(result, 'hcxActivationKeyValue'); + assert( + (client.pathTemplates.hcxActivationKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('loggingServer', async () => { - const fakePath = "/rendered/path/loggingServer"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_cloud: "privateCloudValue", - logging_server: "loggingServerValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingServerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingServerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingServerPath', () => { - const result = client.loggingServerPath("projectValue", "locationValue", "privateCloudValue", "loggingServerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingServerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingServerName', () => { - const result = client.matchProjectFromLoggingServerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingServerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLoggingServerName', () => { - const result = client.matchLocationFromLoggingServerName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.loggingServerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateCloudFromLoggingServerName', () => { - const result = client.matchPrivateCloudFromLoggingServerName(fakePath); - assert.strictEqual(result, "privateCloudValue"); - assert((client.pathTemplates.loggingServerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLoggingServerFromLoggingServerName', () => { - const result = client.matchLoggingServerFromLoggingServerName(fakePath); - assert.strictEqual(result, "loggingServerValue"); - assert((client.pathTemplates.loggingServerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('loggingServer', async () => { + const fakePath = '/rendered/path/loggingServer'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + private_cloud: 'privateCloudValue', + logging_server: 'loggingServerValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.loggingServerPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.loggingServerPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('loggingServerPath', () => { + const result = client.loggingServerPath( + 'projectValue', + 'locationValue', + 'privateCloudValue', + 'loggingServerValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.loggingServerPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromLoggingServerName', () => { + const result = client.matchProjectFromLoggingServerName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.loggingServerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromLoggingServerName', () => { + const result = client.matchLocationFromLoggingServerName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.loggingServerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPrivateCloudFromLoggingServerName', () => { + const result = client.matchPrivateCloudFromLoggingServerName(fakePath); + assert.strictEqual(result, 'privateCloudValue'); + assert( + (client.pathTemplates.loggingServerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLoggingServerFromLoggingServerName', () => { + const result = client.matchLoggingServerFromLoggingServerName(fakePath); + assert.strictEqual(result, 'loggingServerValue'); + assert( + (client.pathTemplates.loggingServerPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('managementDnsZoneBinding', async () => { - const fakePath = "/rendered/path/managementDnsZoneBinding"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_cloud: "privateCloudValue", - management_dns_zone_binding: "managementDnsZoneBindingValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.managementDnsZoneBindingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.managementDnsZoneBindingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('managementDnsZoneBindingPath', () => { - const result = client.managementDnsZoneBindingPath("projectValue", "locationValue", "privateCloudValue", "managementDnsZoneBindingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.managementDnsZoneBindingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromManagementDnsZoneBindingName', () => { - const result = client.matchProjectFromManagementDnsZoneBindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.managementDnsZoneBindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromManagementDnsZoneBindingName', () => { - const result = client.matchLocationFromManagementDnsZoneBindingName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.managementDnsZoneBindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateCloudFromManagementDnsZoneBindingName', () => { - const result = client.matchPrivateCloudFromManagementDnsZoneBindingName(fakePath); - assert.strictEqual(result, "privateCloudValue"); - assert((client.pathTemplates.managementDnsZoneBindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchManagementDnsZoneBindingFromManagementDnsZoneBindingName', () => { - const result = client.matchManagementDnsZoneBindingFromManagementDnsZoneBindingName(fakePath); - assert.strictEqual(result, "managementDnsZoneBindingValue"); - assert((client.pathTemplates.managementDnsZoneBindingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('managementDnsZoneBinding', async () => { + const fakePath = '/rendered/path/managementDnsZoneBinding'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + private_cloud: 'privateCloudValue', + management_dns_zone_binding: 'managementDnsZoneBindingValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.managementDnsZoneBindingPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.managementDnsZoneBindingPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('managementDnsZoneBindingPath', () => { + const result = client.managementDnsZoneBindingPath( + 'projectValue', + 'locationValue', + 'privateCloudValue', + 'managementDnsZoneBindingValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.managementDnsZoneBindingPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromManagementDnsZoneBindingName', () => { + const result = + client.matchProjectFromManagementDnsZoneBindingName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.managementDnsZoneBindingPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromManagementDnsZoneBindingName', () => { + const result = + client.matchLocationFromManagementDnsZoneBindingName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.managementDnsZoneBindingPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPrivateCloudFromManagementDnsZoneBindingName', () => { + const result = + client.matchPrivateCloudFromManagementDnsZoneBindingName(fakePath); + assert.strictEqual(result, 'privateCloudValue'); + assert( + ( + client.pathTemplates.managementDnsZoneBindingPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchManagementDnsZoneBindingFromManagementDnsZoneBindingName', () => { + const result = + client.matchManagementDnsZoneBindingFromManagementDnsZoneBindingName( + fakePath, + ); + assert.strictEqual(result, 'managementDnsZoneBindingValue'); + assert( + ( + client.pathTemplates.managementDnsZoneBindingPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('networkPeering', async () => { - const fakePath = "/rendered/path/networkPeering"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - network_peering: "networkPeeringValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.networkPeeringPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPeeringPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPeeringPath', () => { - const result = client.networkPeeringPath("projectValue", "locationValue", "networkPeeringValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPeeringPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkPeeringName', () => { - const result = client.matchProjectFromNetworkPeeringName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPeeringPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromNetworkPeeringName', () => { - const result = client.matchLocationFromNetworkPeeringName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.networkPeeringPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkPeeringFromNetworkPeeringName', () => { - const result = client.matchNetworkPeeringFromNetworkPeeringName(fakePath); - assert.strictEqual(result, "networkPeeringValue"); - assert((client.pathTemplates.networkPeeringPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('networkPeering', async () => { + const fakePath = '/rendered/path/networkPeering'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + network_peering: 'networkPeeringValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.networkPeeringPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.networkPeeringPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('networkPeeringPath', () => { + const result = client.networkPeeringPath( + 'projectValue', + 'locationValue', + 'networkPeeringValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.networkPeeringPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromNetworkPeeringName', () => { + const result = client.matchProjectFromNetworkPeeringName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.networkPeeringPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromNetworkPeeringName', () => { + const result = client.matchLocationFromNetworkPeeringName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.networkPeeringPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNetworkPeeringFromNetworkPeeringName', () => { + const result = + client.matchNetworkPeeringFromNetworkPeeringName(fakePath); + assert.strictEqual(result, 'networkPeeringValue'); + assert( + (client.pathTemplates.networkPeeringPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('networkPolicy', async () => { - const fakePath = "/rendered/path/networkPolicy"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - network_policy: "networkPolicyValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.networkPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPolicyPath', () => { - const result = client.networkPolicyPath("projectValue", "locationValue", "networkPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkPolicyName', () => { - const result = client.matchProjectFromNetworkPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromNetworkPolicyName', () => { - const result = client.matchLocationFromNetworkPolicyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.networkPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkPolicyFromNetworkPolicyName', () => { - const result = client.matchNetworkPolicyFromNetworkPolicyName(fakePath); - assert.strictEqual(result, "networkPolicyValue"); - assert((client.pathTemplates.networkPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('networkPolicy', async () => { + const fakePath = '/rendered/path/networkPolicy'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + network_policy: 'networkPolicyValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.networkPolicyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.networkPolicyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('networkPolicyPath', () => { + const result = client.networkPolicyPath( + 'projectValue', + 'locationValue', + 'networkPolicyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.networkPolicyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromNetworkPolicyName', () => { + const result = client.matchProjectFromNetworkPolicyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.networkPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromNetworkPolicyName', () => { + const result = client.matchLocationFromNetworkPolicyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.networkPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNetworkPolicyFromNetworkPolicyName', () => { + const result = client.matchNetworkPolicyFromNetworkPolicyName(fakePath); + assert.strictEqual(result, 'networkPolicyValue'); + assert( + (client.pathTemplates.networkPolicyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('node', async () => { - const fakePath = "/rendered/path/node"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_cloud: "privateCloudValue", - cluster: "clusterValue", - node: "nodeValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.nodePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.nodePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('nodePath', () => { - const result = client.nodePath("projectValue", "locationValue", "privateCloudValue", "clusterValue", "nodeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.nodePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNodeName', () => { - const result = client.matchProjectFromNodeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.nodePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromNodeName', () => { - const result = client.matchLocationFromNodeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.nodePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateCloudFromNodeName', () => { - const result = client.matchPrivateCloudFromNodeName(fakePath); - assert.strictEqual(result, "privateCloudValue"); - assert((client.pathTemplates.nodePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchClusterFromNodeName', () => { - const result = client.matchClusterFromNodeName(fakePath); - assert.strictEqual(result, "clusterValue"); - assert((client.pathTemplates.nodePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNodeFromNodeName', () => { - const result = client.matchNodeFromNodeName(fakePath); - assert.strictEqual(result, "nodeValue"); - assert((client.pathTemplates.nodePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('node', async () => { + const fakePath = '/rendered/path/node'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + private_cloud: 'privateCloudValue', + cluster: 'clusterValue', + node: 'nodeValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.nodePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.nodePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('nodePath', () => { + const result = client.nodePath( + 'projectValue', + 'locationValue', + 'privateCloudValue', + 'clusterValue', + 'nodeValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.nodePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromNodeName', () => { + const result = client.matchProjectFromNodeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromNodeName', () => { + const result = client.matchLocationFromNodeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPrivateCloudFromNodeName', () => { + const result = client.matchPrivateCloudFromNodeName(fakePath); + assert.strictEqual(result, 'privateCloudValue'); + assert( + (client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchClusterFromNodeName', () => { + const result = client.matchClusterFromNodeName(fakePath); + assert.strictEqual(result, 'clusterValue'); + assert( + (client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNodeFromNodeName', () => { + const result = client.matchNodeFromNodeName(fakePath); + assert.strictEqual(result, 'nodeValue'); + assert( + (client.pathTemplates.nodePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('nodeType', async () => { - const fakePath = "/rendered/path/nodeType"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - node_type: "nodeTypeValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.nodeTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.nodeTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('nodeTypePath', () => { - const result = client.nodeTypePath("projectValue", "locationValue", "nodeTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.nodeTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNodeTypeName', () => { - const result = client.matchProjectFromNodeTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.nodeTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromNodeTypeName', () => { - const result = client.matchLocationFromNodeTypeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.nodeTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNodeTypeFromNodeTypeName', () => { - const result = client.matchNodeTypeFromNodeTypeName(fakePath); - assert.strictEqual(result, "nodeTypeValue"); - assert((client.pathTemplates.nodeTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('nodeType', async () => { + const fakePath = '/rendered/path/nodeType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + node_type: 'nodeTypeValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.nodeTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.nodeTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('nodeTypePath', () => { + const result = client.nodeTypePath( + 'projectValue', + 'locationValue', + 'nodeTypeValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.nodeTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromNodeTypeName', () => { + const result = client.matchProjectFromNodeTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.nodeTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromNodeTypeName', () => { + const result = client.matchLocationFromNodeTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.nodeTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNodeTypeFromNodeTypeName', () => { + const result = client.matchNodeTypeFromNodeTypeName(fakePath); + assert.strictEqual(result, 'nodeTypeValue'); + assert( + (client.pathTemplates.nodeTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('privateCloud', async () => { - const fakePath = "/rendered/path/privateCloud"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_cloud: "privateCloudValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.privateCloudPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.privateCloudPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('privateCloudPath', () => { - const result = client.privateCloudPath("projectValue", "locationValue", "privateCloudValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.privateCloudPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPrivateCloudName', () => { - const result = client.matchProjectFromPrivateCloudName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.privateCloudPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPrivateCloudName', () => { - const result = client.matchLocationFromPrivateCloudName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.privateCloudPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateCloudFromPrivateCloudName', () => { - const result = client.matchPrivateCloudFromPrivateCloudName(fakePath); - assert.strictEqual(result, "privateCloudValue"); - assert((client.pathTemplates.privateCloudPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('privateCloud', async () => { + const fakePath = '/rendered/path/privateCloud'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + private_cloud: 'privateCloudValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.privateCloudPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.privateCloudPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('privateCloudPath', () => { + const result = client.privateCloudPath( + 'projectValue', + 'locationValue', + 'privateCloudValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.privateCloudPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPrivateCloudName', () => { + const result = client.matchProjectFromPrivateCloudName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.privateCloudPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPrivateCloudName', () => { + const result = client.matchLocationFromPrivateCloudName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.privateCloudPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPrivateCloudFromPrivateCloudName', () => { + const result = client.matchPrivateCloudFromPrivateCloudName(fakePath); + assert.strictEqual(result, 'privateCloudValue'); + assert( + (client.pathTemplates.privateCloudPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('privateConnection', async () => { - const fakePath = "/rendered/path/privateConnection"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_connection: "privateConnectionValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.privateConnectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.privateConnectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('privateConnectionPath', () => { - const result = client.privateConnectionPath("projectValue", "locationValue", "privateConnectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.privateConnectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPrivateConnectionName', () => { - const result = client.matchProjectFromPrivateConnectionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPrivateConnectionName', () => { - const result = client.matchLocationFromPrivateConnectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateConnectionFromPrivateConnectionName', () => { - const result = client.matchPrivateConnectionFromPrivateConnectionName(fakePath); - assert.strictEqual(result, "privateConnectionValue"); - assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('privateConnection', async () => { + const fakePath = '/rendered/path/privateConnection'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + private_connection: 'privateConnectionValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.privateConnectionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.privateConnectionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('privateConnectionPath', () => { + const result = client.privateConnectionPath( + 'projectValue', + 'locationValue', + 'privateConnectionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.privateConnectionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromPrivateConnectionName', () => { + const result = client.matchProjectFromPrivateConnectionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.privateConnectionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromPrivateConnectionName', () => { + const result = client.matchLocationFromPrivateConnectionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.privateConnectionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPrivateConnectionFromPrivateConnectionName', () => { + const result = + client.matchPrivateConnectionFromPrivateConnectionName(fakePath); + assert.strictEqual(result, 'privateConnectionValue'); + assert( + ( + client.pathTemplates.privateConnectionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('subnet', async () => { - const fakePath = "/rendered/path/subnet"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_cloud: "privateCloudValue", - subnet: "subnetValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.subnetPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.subnetPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('subnetPath', () => { - const result = client.subnetPath("projectValue", "locationValue", "privateCloudValue", "subnetValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.subnetPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSubnetName', () => { - const result = client.matchProjectFromSubnetName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.subnetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSubnetName', () => { - const result = client.matchLocationFromSubnetName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.subnetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateCloudFromSubnetName', () => { - const result = client.matchPrivateCloudFromSubnetName(fakePath); - assert.strictEqual(result, "privateCloudValue"); - assert((client.pathTemplates.subnetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSubnetFromSubnetName', () => { - const result = client.matchSubnetFromSubnetName(fakePath); - assert.strictEqual(result, "subnetValue"); - assert((client.pathTemplates.subnetPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('subnet', async () => { + const fakePath = '/rendered/path/subnet'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + private_cloud: 'privateCloudValue', + subnet: 'subnetValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.subnetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.subnetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('subnetPath', () => { + const result = client.subnetPath( + 'projectValue', + 'locationValue', + 'privateCloudValue', + 'subnetValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.subnetPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSubnetName', () => { + const result = client.matchProjectFromSubnetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.subnetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromSubnetName', () => { + const result = client.matchLocationFromSubnetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.subnetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchPrivateCloudFromSubnetName', () => { + const result = client.matchPrivateCloudFromSubnetName(fakePath); + assert.strictEqual(result, 'privateCloudValue'); + assert( + (client.pathTemplates.subnetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSubnetFromSubnetName', () => { + const result = client.matchSubnetFromSubnetName(fakePath); + assert.strictEqual(result, 'subnetValue'); + assert( + (client.pathTemplates.subnetPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('vmwareEngineNetwork', async () => { - const fakePath = "/rendered/path/vmwareEngineNetwork"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - vmware_engine_network: "vmwareEngineNetworkValue", - }; - const client = new vmwareengineModule.v1.VmwareEngineClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.vmwareEngineNetworkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.vmwareEngineNetworkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('vmwareEngineNetworkPath', () => { - const result = client.vmwareEngineNetworkPath("projectValue", "locationValue", "vmwareEngineNetworkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.vmwareEngineNetworkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromVmwareEngineNetworkName', () => { - const result = client.matchProjectFromVmwareEngineNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.vmwareEngineNetworkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromVmwareEngineNetworkName', () => { - const result = client.matchLocationFromVmwareEngineNetworkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.vmwareEngineNetworkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchVmwareEngineNetworkFromVmwareEngineNetworkName', () => { - const result = client.matchVmwareEngineNetworkFromVmwareEngineNetworkName(fakePath); - assert.strictEqual(result, "vmwareEngineNetworkValue"); - assert((client.pathTemplates.vmwareEngineNetworkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('vmwareEngineNetwork', async () => { + const fakePath = '/rendered/path/vmwareEngineNetwork'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + vmware_engine_network: 'vmwareEngineNetworkValue', + }; + const client = new vmwareengineModule.v1.VmwareEngineClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.vmwareEngineNetworkPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.vmwareEngineNetworkPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('vmwareEngineNetworkPath', () => { + const result = client.vmwareEngineNetworkPath( + 'projectValue', + 'locationValue', + 'vmwareEngineNetworkValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.vmwareEngineNetworkPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromVmwareEngineNetworkName', () => { + const result = client.matchProjectFromVmwareEngineNetworkName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.vmwareEngineNetworkPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromVmwareEngineNetworkName', () => { + const result = + client.matchLocationFromVmwareEngineNetworkName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.vmwareEngineNetworkPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchVmwareEngineNetworkFromVmwareEngineNetworkName', () => { + const result = + client.matchVmwareEngineNetworkFromVmwareEngineNetworkName(fakePath); + assert.strictEqual(result, 'vmwareEngineNetworkValue'); + assert( + ( + client.pathTemplates.vmwareEngineNetworkPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-vmwareengine/webpack.config.js b/packages/google-cloud-vmwareengine/webpack.config.js index f9c5da2c1f67..d5271c69e90b 100644 --- a/packages/google-cloud-vmwareengine/webpack.config.js +++ b/packages/google-cloud-vmwareengine/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2026 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. diff --git a/packages/google-cloud-vpcaccess/.eslintignore b/packages/google-cloud-vpcaccess/.eslintignore new file mode 100644 index 000000000000..cfc348ec4d11 --- /dev/null +++ b/packages/google-cloud-vpcaccess/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/packages/google-cloud-vpcaccess/.eslintrc.json b/packages/google-cloud-vpcaccess/.eslintrc.json new file mode 100644 index 000000000000..3e8d97ccb390 --- /dev/null +++ b/packages/google-cloud-vpcaccess/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "./node_modules/gts", + "root": true +} diff --git a/packages/google-cloud-vpcaccess/README.md b/packages/google-cloud-vpcaccess/README.md index 00370593160f..0da1eec9d5a6 100644 --- a/packages/google-cloud-vpcaccess/README.md +++ b/packages/google-cloud-vpcaccess/README.md @@ -96,7 +96,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-vpcaccess/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). Please note that this `README.md` and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) @@ -106,7 +106,7 @@ are generated from a central template. Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-vpcaccess/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project diff --git a/packages/google-cloud-vpcaccess/protos/protos.d.ts b/packages/google-cloud-vpcaccess/protos/protos.d.ts index 762a9cd9c33d..e073dd97ebbf 100644 --- a/packages/google-cloud-vpcaccess/protos/protos.d.ts +++ b/packages/google-cloud-vpcaccess/protos/protos.d.ts @@ -1411,6 +1411,9 @@ export namespace google { /** CommonLanguageSettings destinations */ destinations?: (google.api.ClientLibraryDestination[]|null); + + /** CommonLanguageSettings selectiveGapicGeneration */ + selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); } /** Represents a CommonLanguageSettings. */ @@ -1428,6 +1431,9 @@ export namespace google { /** CommonLanguageSettings destinations. */ public destinations: google.api.ClientLibraryDestination[]; + /** CommonLanguageSettings selectiveGapicGeneration. */ + public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @param [properties] Properties to set @@ -2128,6 +2134,9 @@ export namespace google { /** PythonSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures */ + experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); } /** Represents a PythonSettings. */ @@ -2142,6 +2151,9 @@ export namespace google { /** PythonSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** PythonSettings experimentalFeatures. */ + public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + /** * Creates a new PythonSettings instance using the specified properties. * @param [properties] Properties to set @@ -2220,6 +2232,118 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace PythonSettings { + + /** Properties of an ExperimentalFeatures. */ + interface IExperimentalFeatures { + + /** ExperimentalFeatures restAsyncIoEnabled */ + restAsyncIoEnabled?: (boolean|null); + + /** ExperimentalFeatures protobufPythonicTypesEnabled */ + protobufPythonicTypesEnabled?: (boolean|null); + + /** ExperimentalFeatures unversionedPackageDisabled */ + unversionedPackageDisabled?: (boolean|null); + } + + /** Represents an ExperimentalFeatures. */ + class ExperimentalFeatures implements IExperimentalFeatures { + + /** + * Constructs a new ExperimentalFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); + + /** ExperimentalFeatures restAsyncIoEnabled. */ + public restAsyncIoEnabled: boolean; + + /** ExperimentalFeatures protobufPythonicTypesEnabled. */ + public protobufPythonicTypesEnabled: boolean; + + /** ExperimentalFeatures unversionedPackageDisabled. */ + public unversionedPackageDisabled: boolean; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns ExperimentalFeatures instance + */ + public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Verifies an ExperimentalFeatures 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 an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExperimentalFeatures + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @param message ExperimentalFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExperimentalFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Properties of a NodeSettings. */ interface INodeSettings { @@ -2546,6 +2670,9 @@ export namespace google { /** GoSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); } /** Represents a GoSettings. */ @@ -2560,6 +2687,9 @@ export namespace google { /** GoSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** GoSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + /** * Creates a new GoSettings instance using the specified properties. * @param [properties] Properties to set @@ -2884,6 +3014,109 @@ export namespace google { PACKAGE_MANAGER = 20 } + /** Properties of a SelectiveGapicGeneration. */ + interface ISelectiveGapicGeneration { + + /** SelectiveGapicGeneration methods */ + methods?: (string[]|null); + + /** SelectiveGapicGeneration generateOmittedAsInternal */ + generateOmittedAsInternal?: (boolean|null); + } + + /** Represents a SelectiveGapicGeneration. */ + class SelectiveGapicGeneration implements ISelectiveGapicGeneration { + + /** + * Constructs a new SelectiveGapicGeneration. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ISelectiveGapicGeneration); + + /** SelectiveGapicGeneration methods. */ + public methods: string[]; + + /** SelectiveGapicGeneration generateOmittedAsInternal. */ + public generateOmittedAsInternal: boolean; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectiveGapicGeneration instance + */ + public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Verifies a SelectiveGapicGeneration 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 SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectiveGapicGeneration + */ + public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @param message SelectiveGapicGeneration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** LaunchStage enum. */ enum LaunchStage { LAUNCH_STAGE_UNSPECIFIED = 0, @@ -3265,6 +3498,7 @@ export namespace google { /** Edition enum. */ enum Edition { EDITION_UNKNOWN = 0, + EDITION_LEGACY = 900, EDITION_PROTO2 = 998, EDITION_PROTO3 = 999, EDITION_2023 = 1000, @@ -3295,6 +3529,9 @@ export namespace google { /** FileDescriptorProto weakDependency */ weakDependency?: (number[]|null); + /** FileDescriptorProto optionDependency */ + optionDependency?: (string[]|null); + /** FileDescriptorProto messageType */ messageType?: (google.protobuf.IDescriptorProto[]|null); @@ -3344,6 +3581,9 @@ export namespace google { /** FileDescriptorProto weakDependency. */ public weakDependency: number[]; + /** FileDescriptorProto optionDependency. */ + public optionDependency: string[]; + /** FileDescriptorProto messageType. */ public messageType: google.protobuf.IDescriptorProto[]; @@ -3478,6 +3718,9 @@ export namespace google { /** DescriptorProto reservedName */ reservedName?: (string[]|null); + + /** DescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents a DescriptorProto. */ @@ -3519,6 +3762,9 @@ export namespace google { /** DescriptorProto reservedName. */ public reservedName: string[]; + /** DescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new DescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -4366,6 +4612,9 @@ export namespace google { /** EnumDescriptorProto reservedName */ reservedName?: (string[]|null); + + /** EnumDescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents an EnumDescriptorProto. */ @@ -4392,6 +4641,9 @@ export namespace google { /** EnumDescriptorProto reservedName. */ public reservedName: string[]; + /** EnumDescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -5326,6 +5578,9 @@ export namespace google { /** FieldOptions features */ features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); @@ -5381,6 +5636,9 @@ export namespace google { /** FieldOptions features. */ public features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -5601,6 +5859,121 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a FeatureSupport. */ + interface IFeatureSupport { + + /** FeatureSupport editionIntroduced */ + editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport editionDeprecated */ + editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport deprecationWarning */ + deprecationWarning?: (string|null); + + /** FeatureSupport editionRemoved */ + editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSupport. */ + class FeatureSupport implements IFeatureSupport { + + /** + * Constructs a new FeatureSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); + + /** FeatureSupport editionIntroduced. */ + public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport editionDeprecated. */ + public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport deprecationWarning. */ + public deprecationWarning: string; + + /** FeatureSupport editionRemoved. */ + public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSupport instance + */ + public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Verifies a FeatureSupport 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 FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSupport + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @param message FeatureSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of an OneofOptions. */ @@ -5839,6 +6212,9 @@ export namespace google { /** EnumValueOptions debugRedact */ debugRedact?: (boolean|null); + /** EnumValueOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); } @@ -5861,6 +6237,9 @@ export namespace google { /** EnumValueOptions debugRedact. */ public debugRedact: boolean; + /** EnumValueOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -6453,6 +6832,12 @@ export namespace google { /** FeatureSet jsonFormat */ jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); + + /** FeatureSet enforceNamingStyle */ + enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); + + /** FeatureSet defaultSymbolVisibility */ + defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); } /** Represents a FeatureSet. */ @@ -6482,6 +6867,12 @@ export namespace google { /** FeatureSet jsonFormat. */ public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); + /** FeatureSet enforceNamingStyle. */ + public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); + + /** FeatureSet defaultSymbolVisibility. */ + public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); + /** * Creates a new FeatureSet instance using the specified properties. * @param [properties] Properties to set @@ -6604,6 +6995,116 @@ export namespace google { ALLOW = 1, LEGACY_BEST_EFFORT = 2 } + + /** EnforceNamingStyle enum. */ + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2 + } + + /** Properties of a VisibilityFeature. */ + interface IVisibilityFeature { + } + + /** Represents a VisibilityFeature. */ + class VisibilityFeature implements IVisibilityFeature { + + /** + * Constructs a new VisibilityFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns VisibilityFeature instance + */ + public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Verifies a VisibilityFeature 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 VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisibilityFeature + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @param message VisibilityFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisibilityFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisibilityFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VisibilityFeature { + + /** DefaultSymbolVisibility enum. */ + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + EXPORT_ALL = 1, + EXPORT_TOP_LEVEL = 2, + LOCAL_ALL = 3, + STRICT = 4 + } + } } /** Properties of a FeatureSetDefaults. */ @@ -6723,8 +7224,11 @@ export namespace google { /** FeatureSetEditionDefault edition */ edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - /** FeatureSetEditionDefault features */ - features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures */ + overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures */ + fixedFeatures?: (google.protobuf.IFeatureSet|null); } /** Represents a FeatureSetEditionDefault. */ @@ -6739,8 +7243,11 @@ export namespace google { /** FeatureSetEditionDefault edition. */ public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - /** FeatureSetEditionDefault features. */ - public features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures. */ + public overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures. */ + public fixedFeatures?: (google.protobuf.IFeatureSet|null); /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -7273,6 +7780,13 @@ export namespace google { } } + /** SymbolVisibility enum. */ + enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2 + } + /** Properties of a Duration. */ interface IDuration { diff --git a/packages/google-cloud-vpcaccess/protos/protos.js b/packages/google-cloud-vpcaccess/protos/protos.js index 25c77fae63e1..542210b68fb8 100644 --- a/packages/google-cloud-vpcaccess/protos/protos.js +++ b/packages/google-cloud-vpcaccess/protos/protos.js @@ -3430,6 +3430,7 @@ * @interface ICommonLanguageSettings * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri * @property {Array.|null} [destinations] CommonLanguageSettings destinations + * @property {google.api.ISelectiveGapicGeneration|null} [selectiveGapicGeneration] CommonLanguageSettings selectiveGapicGeneration */ /** @@ -3464,6 +3465,14 @@ */ CommonLanguageSettings.prototype.destinations = $util.emptyArray; + /** + * CommonLanguageSettings selectiveGapicGeneration. + * @member {google.api.ISelectiveGapicGeneration|null|undefined} selectiveGapicGeneration + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.selectiveGapicGeneration = null; + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @function create @@ -3496,6 +3505,8 @@ writer.int32(message.destinations[i]); writer.ldelim(); } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -3547,6 +3558,10 @@ message.destinations.push(reader.int32()); break; } + case 3: { + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -3598,6 +3613,11 @@ break; } } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { + var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration); + if (error) + return "selectiveGapicGeneration." + error; + } return null; }; @@ -3640,6 +3660,11 @@ break; } } + if (object.selectiveGapicGeneration != null) { + if (typeof object.selectiveGapicGeneration !== "object") + throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration); + } return message; }; @@ -3658,8 +3683,10 @@ var object = {}; if (options.arrays || options.defaults) object.destinations = []; - if (options.defaults) + if (options.defaults) { object.referenceDocsUri = ""; + object.selectiveGapicGeneration = null; + } if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) object.referenceDocsUri = message.referenceDocsUri; if (message.destinations && message.destinations.length) { @@ -3667,6 +3694,8 @@ for (var j = 0; j < message.destinations.length; ++j) object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) + object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options); return object; }; @@ -5489,6 +5518,7 @@ * @memberof google.api * @interface IPythonSettings * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common + * @property {google.api.PythonSettings.IExperimentalFeatures|null} [experimentalFeatures] PythonSettings experimentalFeatures */ /** @@ -5514,6 +5544,14 @@ */ PythonSettings.prototype.common = null; + /** + * PythonSettings experimentalFeatures. + * @member {google.api.PythonSettings.IExperimentalFeatures|null|undefined} experimentalFeatures + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.experimentalFeatures = null; + /** * Creates a new PythonSettings instance using the specified properties. * @function create @@ -5540,6 +5578,8 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -5580,6 +5620,10 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -5620,6 +5664,11 @@ if (error) return "common." + error; } + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { + var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures); + if (error) + return "experimentalFeatures." + error; + } return null; }; @@ -5640,6 +5689,11 @@ throw TypeError(".google.api.PythonSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.experimentalFeatures != null) { + if (typeof object.experimentalFeatures !== "object") + throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures); + } return message; }; @@ -5656,10 +5710,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.common = null; + object.experimentalFeatures = null; + } if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) + object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options); return object; }; @@ -5689,6 +5747,258 @@ return typeUrlPrefix + "/google.api.PythonSettings"; }; + PythonSettings.ExperimentalFeatures = (function() { + + /** + * Properties of an ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @interface IExperimentalFeatures + * @property {boolean|null} [restAsyncIoEnabled] ExperimentalFeatures restAsyncIoEnabled + * @property {boolean|null} [protobufPythonicTypesEnabled] ExperimentalFeatures protobufPythonicTypesEnabled + * @property {boolean|null} [unversionedPackageDisabled] ExperimentalFeatures unversionedPackageDisabled + */ + + /** + * Constructs a new ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @classdesc Represents an ExperimentalFeatures. + * @implements IExperimentalFeatures + * @constructor + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + */ + function ExperimentalFeatures(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]]; + } + + /** + * ExperimentalFeatures restAsyncIoEnabled. + * @member {boolean} restAsyncIoEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.restAsyncIoEnabled = false; + + /** + * ExperimentalFeatures protobufPythonicTypesEnabled. + * @member {boolean} protobufPythonicTypesEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.protobufPythonicTypesEnabled = false; + + /** + * ExperimentalFeatures unversionedPackageDisabled. + * @member {boolean} unversionedPackageDisabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.unversionedPackageDisabled = false; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures instance + */ + ExperimentalFeatures.create = function create(properties) { + return new ExperimentalFeatures(properties); + }; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.protobufPythonicTypesEnabled); + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unversionedPackageDisabled); + return writer; + }; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restAsyncIoEnabled = reader.bool(); + break; + } + case 2: { + message.protobufPythonicTypesEnabled = reader.bool(); + break; + } + case 3: { + message.unversionedPackageDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExperimentalFeatures message. + * @function verify + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExperimentalFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + if (typeof message.restAsyncIoEnabled !== "boolean") + return "restAsyncIoEnabled: boolean expected"; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + if (typeof message.protobufPythonicTypesEnabled !== "boolean") + return "protobufPythonicTypesEnabled: boolean expected"; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + if (typeof message.unversionedPackageDisabled !== "boolean") + return "unversionedPackageDisabled: boolean expected"; + return null; + }; + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + */ + ExperimentalFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) + return object; + var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + if (object.restAsyncIoEnabled != null) + message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); + if (object.protobufPythonicTypesEnabled != null) + message.protobufPythonicTypesEnabled = Boolean(object.protobufPythonicTypesEnabled); + if (object.unversionedPackageDisabled != null) + message.unversionedPackageDisabled = Boolean(object.unversionedPackageDisabled); + return message; + }; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.ExperimentalFeatures} message ExperimentalFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExperimentalFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.restAsyncIoEnabled = false; + object.protobufPythonicTypesEnabled = false; + object.unversionedPackageDisabled = false; + } + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + object.restAsyncIoEnabled = message.restAsyncIoEnabled; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + object.unversionedPackageDisabled = message.unversionedPackageDisabled; + return object; + }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @function toJSON + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + * @returns {Object.} JSON object + */ + ExperimentalFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExperimentalFeatures + * @function getTypeUrl + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExperimentalFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings.ExperimentalFeatures"; + }; + + return ExperimentalFeatures; + })(); + return PythonSettings; })(); @@ -6565,6 +6875,7 @@ * @memberof google.api * @interface IGoSettings * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common + * @property {Object.|null} [renamedServices] GoSettings renamedServices */ /** @@ -6576,6 +6887,7 @@ * @param {google.api.IGoSettings=} [properties] Properties to set */ function GoSettings(properties) { + this.renamedServices = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6590,6 +6902,14 @@ */ GoSettings.prototype.common = null; + /** + * GoSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.renamedServices = $util.emptyObject; + /** * Creates a new GoSettings instance using the specified properties. * @function create @@ -6616,6 +6936,9 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); return writer; }; @@ -6646,7 +6969,7 @@ GoSettings.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) @@ -6656,6 +6979,29 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedServices[key] = value; + break; + } default: reader.skipType(tag & 7); break; @@ -6696,6 +7042,14 @@ if (error) return "common." + error; } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } return null; }; @@ -6716,6 +7070,13 @@ throw TypeError(".google.api.GoSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.GoSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } return message; }; @@ -6732,10 +7093,18 @@ if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) + object.renamedServices = {}; if (options.defaults) object.common = null; if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } return object; }; @@ -7374,29 +7743,274 @@ return values; })(); - /** - * LaunchStage enum. - * @name google.api.LaunchStage - * @enum {number} - * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value - * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value - * @property {number} PRELAUNCH=7 PRELAUNCH value - * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value - * @property {number} ALPHA=2 ALPHA value - * @property {number} BETA=3 BETA value - * @property {number} GA=4 GA value - * @property {number} DEPRECATED=5 DEPRECATED value - */ - api.LaunchStage = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; - values[valuesById[6] = "UNIMPLEMENTED"] = 6; - values[valuesById[7] = "PRELAUNCH"] = 7; - values[valuesById[1] = "EARLY_ACCESS"] = 1; - values[valuesById[2] = "ALPHA"] = 2; - values[valuesById[3] = "BETA"] = 3; - values[valuesById[4] = "GA"] = 4; - values[valuesById[5] = "DEPRECATED"] = 5; + api.SelectiveGapicGeneration = (function() { + + /** + * Properties of a SelectiveGapicGeneration. + * @memberof google.api + * @interface ISelectiveGapicGeneration + * @property {Array.|null} [methods] SelectiveGapicGeneration methods + * @property {boolean|null} [generateOmittedAsInternal] SelectiveGapicGeneration generateOmittedAsInternal + */ + + /** + * Constructs a new SelectiveGapicGeneration. + * @memberof google.api + * @classdesc Represents a SelectiveGapicGeneration. + * @implements ISelectiveGapicGeneration + * @constructor + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + */ + function SelectiveGapicGeneration(properties) { + this.methods = []; + 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]]; + } + + /** + * SelectiveGapicGeneration methods. + * @member {Array.} methods + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.methods = $util.emptyArray; + + /** + * SelectiveGapicGeneration generateOmittedAsInternal. + * @member {boolean} generateOmittedAsInternal + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.generateOmittedAsInternal = false; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @function create + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration instance + */ + SelectiveGapicGeneration.create = function create(properties) { + return new SelectiveGapicGeneration(properties); + }; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methods != null && message.methods.length) + for (var i = 0; i < message.methods.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.generateOmittedAsInternal); + return writer; + }; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @function decode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.methods && message.methods.length)) + message.methods = []; + message.methods.push(reader.string()); + break; + } + case 2: { + message.generateOmittedAsInternal = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectiveGapicGeneration message. + * @function verify + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectiveGapicGeneration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methods != null && message.hasOwnProperty("methods")) { + if (!Array.isArray(message.methods)) + return "methods: array expected"; + for (var i = 0; i < message.methods.length; ++i) + if (!$util.isString(message.methods[i])) + return "methods: string[] expected"; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + if (typeof message.generateOmittedAsInternal !== "boolean") + return "generateOmittedAsInternal: boolean expected"; + return null; + }; + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} object Plain object + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + */ + SelectiveGapicGeneration.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.SelectiveGapicGeneration) + return object; + var message = new $root.google.api.SelectiveGapicGeneration(); + if (object.methods) { + if (!Array.isArray(object.methods)) + throw TypeError(".google.api.SelectiveGapicGeneration.methods: array expected"); + message.methods = []; + for (var i = 0; i < object.methods.length; ++i) + message.methods[i] = String(object.methods[i]); + } + if (object.generateOmittedAsInternal != null) + message.generateOmittedAsInternal = Boolean(object.generateOmittedAsInternal); + return message; + }; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.SelectiveGapicGeneration} message SelectiveGapicGeneration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectiveGapicGeneration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.methods = []; + if (options.defaults) + object.generateOmittedAsInternal = false; + if (message.methods && message.methods.length) { + object.methods = []; + for (var j = 0; j < message.methods.length; ++j) + object.methods[j] = message.methods[j]; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + object.generateOmittedAsInternal = message.generateOmittedAsInternal; + return object; + }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @function toJSON + * @memberof google.api.SelectiveGapicGeneration + * @instance + * @returns {Object.} JSON object + */ + SelectiveGapicGeneration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @function getTypeUrl + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectiveGapicGeneration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.SelectiveGapicGeneration"; + }; + + return SelectiveGapicGeneration; + })(); + + /** + * LaunchStage enum. + * @name google.api.LaunchStage + * @enum {number} + * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value + * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value + * @property {number} PRELAUNCH=7 PRELAUNCH value + * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + */ + api.LaunchStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; + values[valuesById[6] = "UNIMPLEMENTED"] = 6; + values[valuesById[7] = "PRELAUNCH"] = 7; + values[valuesById[1] = "EARLY_ACCESS"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; return values; })(); @@ -8359,6 +8973,7 @@ * @name google.protobuf.Edition * @enum {number} * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_LEGACY=900 EDITION_LEGACY value * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value * @property {number} EDITION_2023=1000 EDITION_2023 value @@ -8373,6 +8988,7 @@ protobuf.Edition = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[900] = "EDITION_LEGACY"] = 900; values[valuesById[998] = "EDITION_PROTO2"] = 998; values[valuesById[999] = "EDITION_PROTO3"] = 999; values[valuesById[1000] = "EDITION_2023"] = 1000; @@ -8397,6 +9013,7 @@ * @property {Array.|null} [dependency] FileDescriptorProto dependency * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [optionDependency] FileDescriptorProto optionDependency * @property {Array.|null} [messageType] FileDescriptorProto messageType * @property {Array.|null} [enumType] FileDescriptorProto enumType * @property {Array.|null} [service] FileDescriptorProto service @@ -8419,6 +9036,7 @@ this.dependency = []; this.publicDependency = []; this.weakDependency = []; + this.optionDependency = []; this.messageType = []; this.enumType = []; this.service = []; @@ -8469,6 +9087,14 @@ */ FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + /** + * FileDescriptorProto optionDependency. + * @member {Array.} optionDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.optionDependency = $util.emptyArray; + /** * FileDescriptorProto messageType. * @member {Array.} messageType @@ -8590,6 +9216,9 @@ writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + if (message.optionDependency != null && message.optionDependency.length) + for (var i = 0; i < message.optionDependency.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.optionDependency[i]); return writer; }; @@ -8662,6 +9291,12 @@ message.weakDependency.push(reader.int32()); break; } + case 15: { + if (!(message.optionDependency && message.optionDependency.length)) + message.optionDependency = []; + message.optionDependency.push(reader.string()); + break; + } case 4: { if (!(message.messageType && message.messageType.length)) message.messageType = []; @@ -8764,6 +9399,13 @@ if (!$util.isInteger(message.weakDependency[i])) return "weakDependency: integer[] expected"; } + if (message.optionDependency != null && message.hasOwnProperty("optionDependency")) { + if (!Array.isArray(message.optionDependency)) + return "optionDependency: array expected"; + for (var i = 0; i < message.optionDependency.length; ++i) + if (!$util.isString(message.optionDependency[i])) + return "optionDependency: string[] expected"; + } if (message.messageType != null && message.hasOwnProperty("messageType")) { if (!Array.isArray(message.messageType)) return "messageType: array expected"; @@ -8818,6 +9460,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -8870,6 +9513,13 @@ for (var i = 0; i < object.weakDependency.length; ++i) message.weakDependency[i] = object.weakDependency[i] | 0; } + if (object.optionDependency) { + if (!Array.isArray(object.optionDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.optionDependency: array expected"); + message.optionDependency = []; + for (var i = 0; i < object.optionDependency.length; ++i) + message.optionDependency[i] = String(object.optionDependency[i]); + } if (object.messageType) { if (!Array.isArray(object.messageType)) throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); @@ -8933,6 +9583,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -8998,6 +9652,7 @@ object.extension = []; object.publicDependency = []; object.weakDependency = []; + object.optionDependency = []; } if (options.defaults) { object.name = ""; @@ -9054,6 +9709,11 @@ object.syntax = message.syntax; if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.optionDependency && message.optionDependency.length) { + object.optionDependency = []; + for (var j = 0; j < message.optionDependency.length; ++j) + object.optionDependency[j] = message.optionDependency[j]; + } return object; }; @@ -9102,6 +9762,7 @@ * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options * @property {Array.|null} [reservedRange] DescriptorProto reservedRange * @property {Array.|null} [reservedName] DescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] DescriptorProto visibility */ /** @@ -9207,6 +9868,14 @@ */ DescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * DescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.visibility = 0; + /** * Creates a new DescriptorProto instance using the specified properties. * @function create @@ -9259,6 +9928,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.visibility); return writer; }; @@ -9351,6 +10022,10 @@ message.reservedName.push(reader.string()); break; } + case 11: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -9464,6 +10139,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -9563,6 +10247,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -9592,6 +10296,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -9637,6 +10342,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -11681,6 +12388,7 @@ * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] EnumDescriptorProto visibility */ /** @@ -11741,6 +12449,14 @@ */ EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * EnumDescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.visibility = 0; + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @function create @@ -11778,6 +12494,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.visibility); return writer; }; @@ -11840,6 +12558,10 @@ message.reservedName.push(reader.string()); break; } + case 6: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -11908,6 +12630,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -11957,6 +12688,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -11981,6 +12732,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -12001,6 +12753,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -14319,6 +15073,7 @@ * @property {Array.|null} [targets] FieldOptions targets * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] FieldOptions featureSupport * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference @@ -14439,6 +15194,14 @@ */ FieldOptions.prototype.features = null; + /** + * FieldOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.featureSupport = null; + /** * FieldOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -14513,6 +15276,8 @@ $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); if (message.features != null && Object.hasOwnProperty.call(message, "features")) $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -14614,6 +15379,10 @@ message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } + case 22: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -14749,6 +15518,11 @@ if (error) return "features." + error; } + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -14937,6 +15711,11 @@ throw TypeError(".google.protobuf.FieldOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); } + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); @@ -15034,6 +15813,7 @@ object.debugRedact = false; object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; object.features = null; + object.featureSupport = null; object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) @@ -15066,6 +15846,8 @@ } if (message.features != null && message.hasOwnProperty("features")) object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -15338,6 +16120,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -15379,103 +16162,589 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EditionDefault.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + return object; + }; + + /** + * Converts this EditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + * @returns {Object.} JSON object + */ + EditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + }; + + return EditionDefault; + })(); + + FieldOptions.FeatureSupport = (function() { + + /** + * Properties of a FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @interface IFeatureSupport + * @property {google.protobuf.Edition|null} [editionIntroduced] FeatureSupport editionIntroduced + * @property {google.protobuf.Edition|null} [editionDeprecated] FeatureSupport editionDeprecated + * @property {string|null} [deprecationWarning] FeatureSupport deprecationWarning + * @property {google.protobuf.Edition|null} [editionRemoved] FeatureSupport editionRemoved + */ + + /** + * Constructs a new FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents a FeatureSupport. + * @implements IFeatureSupport + * @constructor + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + */ + function FeatureSupport(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]]; + } + + /** + * FeatureSupport editionIntroduced. + * @member {google.protobuf.Edition} editionIntroduced + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionIntroduced = 0; + + /** + * FeatureSupport editionDeprecated. + * @member {google.protobuf.Edition} editionDeprecated + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionDeprecated = 0; + + /** + * FeatureSupport deprecationWarning. + * @member {string} deprecationWarning + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.deprecationWarning = ""; + + /** + * FeatureSupport editionRemoved. + * @member {google.protobuf.Edition} editionRemoved + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionRemoved = 0; + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport instance + */ + FeatureSupport.create = function create(properties) { + return new FeatureSupport(properties); + }; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editionDeprecated); + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.deprecationWarning); + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.editionRemoved); + return writer; + }; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.editionIntroduced = reader.int32(); + break; + } + case 2: { + message.editionDeprecated = reader.int32(); + break; + } + case 3: { + message.deprecationWarning = reader.string(); + break; + } + case 4: { + message.editionRemoved = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSupport message. + * @function verify + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSupport.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + switch (message.editionIntroduced) { + default: + return "editionIntroduced: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + switch (message.editionDeprecated) { + default: + return "editionDeprecated: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + if (!$util.isString(message.deprecationWarning)) + return "deprecationWarning: string expected"; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + switch (message.editionRemoved) { + default: + return "editionRemoved: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + */ + FeatureSupport.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) + return object; + var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + switch (object.editionIntroduced) { + default: + if (typeof object.editionIntroduced === "number") { + message.editionIntroduced = object.editionIntroduced; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionIntroduced = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionIntroduced = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionIntroduced = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionIntroduced = 999; + break; + case "EDITION_2023": + case 1000: + message.editionIntroduced = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionIntroduced = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionIntroduced = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionIntroduced = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionIntroduced = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionIntroduced = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionIntroduced = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionIntroduced = 2147483647; + break; + } + switch (object.editionDeprecated) { + default: + if (typeof object.editionDeprecated === "number") { + message.editionDeprecated = object.editionDeprecated; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionDeprecated = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionDeprecated = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionDeprecated = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionDeprecated = 999; + break; + case "EDITION_2023": + case 1000: + message.editionDeprecated = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionDeprecated = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionDeprecated = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionDeprecated = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionDeprecated = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionDeprecated = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionDeprecated = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionDeprecated = 2147483647; + break; + } + if (object.deprecationWarning != null) + message.deprecationWarning = String(object.deprecationWarning); + switch (object.editionRemoved) { + default: + if (typeof object.editionRemoved === "number") { + message.editionRemoved = object.editionRemoved; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionRemoved = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionRemoved = 900; + break; case "EDITION_PROTO2": case 998: - message.edition = 998; + message.editionRemoved = 998; break; case "EDITION_PROTO3": case 999: - message.edition = 999; + message.editionRemoved = 999; break; case "EDITION_2023": case 1000: - message.edition = 1000; + message.editionRemoved = 1000; break; case "EDITION_2024": case 1001: - message.edition = 1001; + message.editionRemoved = 1001; break; case "EDITION_1_TEST_ONLY": case 1: - message.edition = 1; + message.editionRemoved = 1; break; case "EDITION_2_TEST_ONLY": case 2: - message.edition = 2; + message.editionRemoved = 2; break; case "EDITION_99997_TEST_ONLY": case 99997: - message.edition = 99997; + message.editionRemoved = 99997; break; case "EDITION_99998_TEST_ONLY": case 99998: - message.edition = 99998; + message.editionRemoved = 99998; break; case "EDITION_99999_TEST_ONLY": case 99999: - message.edition = 99999; + message.editionRemoved = 99999; break; case "EDITION_MAX": case 2147483647: - message.edition = 2147483647; + message.editionRemoved = 2147483647; break; } - if (object.value != null) - message.value = String(object.value); return message; }; /** - * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {google.protobuf.FieldOptions.FeatureSupport} message FeatureSupport * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EditionDefault.toObject = function toObject(message, options) { + FeatureSupport.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.value = ""; - object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionDeprecated = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.deprecationWarning = ""; + object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + object.deprecationWarning = message.deprecationWarning; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; return object; }; /** - * Converts this EditionDefault to JSON. + * Converts this FeatureSupport to JSON. * @function toJSON - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @instance * @returns {Object.} JSON object */ - EditionDefault.prototype.toJSON = function toJSON() { + FeatureSupport.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for EditionDefault + * Gets the default type url for FeatureSupport * @function getTypeUrl - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FeatureSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + return typeUrlPrefix + "/google.protobuf.FieldOptions.FeatureSupport"; }; - return EditionDefault; + return FeatureSupport; })(); return FieldOptions; @@ -16070,6 +17339,7 @@ * @property {boolean|null} [deprecated] EnumValueOptions deprecated * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] EnumValueOptions featureSupport * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption */ @@ -16113,6 +17383,14 @@ */ EnumValueOptions.prototype.debugRedact = false; + /** + * EnumValueOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.featureSupport = null; + /** * EnumValueOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -16151,6 +17429,8 @@ $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -16202,6 +17482,10 @@ message.debugRedact = reader.bool(); break; } + case 4: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -16254,6 +17538,11 @@ if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) if (typeof message.debugRedact !== "boolean") return "debugRedact: boolean expected"; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -16287,6 +17576,11 @@ } if (object.debugRedact != null) message.debugRedact = Boolean(object.debugRedact); + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); @@ -16319,6 +17613,7 @@ object.deprecated = false; object.features = null; object.debugRedact = false; + object.featureSupport = null; } if (message.deprecated != null && message.hasOwnProperty("deprecated")) object.deprecated = message.deprecated; @@ -16326,6 +17621,8 @@ object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) object.debugRedact = message.debugRedact; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -17793,6 +19090,8 @@ * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + * @property {google.protobuf.FeatureSet.EnforceNamingStyle|null} [enforceNamingStyle] FeatureSet enforceNamingStyle + * @property {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null} [defaultSymbolVisibility] FeatureSet defaultSymbolVisibility */ /** @@ -17858,6 +19157,22 @@ */ FeatureSet.prototype.jsonFormat = 0; + /** + * FeatureSet enforceNamingStyle. + * @member {google.protobuf.FeatureSet.EnforceNamingStyle} enforceNamingStyle + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enforceNamingStyle = 0; + + /** + * FeatureSet defaultSymbolVisibility. + * @member {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility} defaultSymbolVisibility + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.defaultSymbolVisibility = 0; + /** * Creates a new FeatureSet instance using the specified properties. * @function create @@ -17894,6 +19209,10 @@ writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enforceNamingStyle); + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.defaultSymbolVisibility); return writer; }; @@ -17954,6 +19273,14 @@ message.jsonFormat = reader.int32(); break; } + case 7: { + message.enforceNamingStyle = reader.int32(); + break; + } + case 8: { + message.defaultSymbolVisibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -18044,6 +19371,26 @@ case 2: break; } + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + switch (message.enforceNamingStyle) { + default: + return "enforceNamingStyle: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + switch (message.defaultSymbolVisibility) { + default: + return "defaultSymbolVisibility: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } return null; }; @@ -18183,6 +19530,54 @@ message.jsonFormat = 2; break; } + switch (object.enforceNamingStyle) { + default: + if (typeof object.enforceNamingStyle === "number") { + message.enforceNamingStyle = object.enforceNamingStyle; + break; + } + break; + case "ENFORCE_NAMING_STYLE_UNKNOWN": + case 0: + message.enforceNamingStyle = 0; + break; + case "STYLE2024": + case 1: + message.enforceNamingStyle = 1; + break; + case "STYLE_LEGACY": + case 2: + message.enforceNamingStyle = 2; + break; + } + switch (object.defaultSymbolVisibility) { + default: + if (typeof object.defaultSymbolVisibility === "number") { + message.defaultSymbolVisibility = object.defaultSymbolVisibility; + break; + } + break; + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + case 0: + message.defaultSymbolVisibility = 0; + break; + case "EXPORT_ALL": + case 1: + message.defaultSymbolVisibility = 1; + break; + case "EXPORT_TOP_LEVEL": + case 2: + message.defaultSymbolVisibility = 2; + break; + case "LOCAL_ALL": + case 3: + message.defaultSymbolVisibility = 3; + break; + case "STRICT": + case 4: + message.defaultSymbolVisibility = 4; + break; + } return message; }; @@ -18206,6 +19601,8 @@ object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; + object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; } if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; @@ -18219,6 +19616,10 @@ object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; return object; }; @@ -18346,6 +19747,219 @@ return values; })(); + /** + * EnforceNamingStyle enum. + * @name google.protobuf.FeatureSet.EnforceNamingStyle + * @enum {number} + * @property {number} ENFORCE_NAMING_STYLE_UNKNOWN=0 ENFORCE_NAMING_STYLE_UNKNOWN value + * @property {number} STYLE2024=1 STYLE2024 value + * @property {number} STYLE_LEGACY=2 STYLE_LEGACY value + */ + FeatureSet.EnforceNamingStyle = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENFORCE_NAMING_STYLE_UNKNOWN"] = 0; + values[valuesById[1] = "STYLE2024"] = 1; + values[valuesById[2] = "STYLE_LEGACY"] = 2; + return values; + })(); + + FeatureSet.VisibilityFeature = (function() { + + /** + * Properties of a VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @interface IVisibilityFeature + */ + + /** + * Constructs a new VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @classdesc Represents a VisibilityFeature. + * @implements IVisibilityFeature + * @constructor + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + */ + function VisibilityFeature(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]]; + } + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature instance + */ + VisibilityFeature.create = function create(properties) { + return new VisibilityFeature(properties); + }; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisibilityFeature message. + * @function verify + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisibilityFeature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + */ + VisibilityFeature.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) + return object; + return new $root.google.protobuf.FeatureSet.VisibilityFeature(); + }; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.VisibilityFeature} message VisibilityFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisibilityFeature.toObject = function toObject() { + return {}; + }; + + /** + * Converts this VisibilityFeature to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @instance + * @returns {Object.} JSON object + */ + VisibilityFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VisibilityFeature + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisibilityFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet.VisibilityFeature"; + }; + + /** + * DefaultSymbolVisibility enum. + * @name google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + * @enum {number} + * @property {number} DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN value + * @property {number} EXPORT_ALL=1 EXPORT_ALL value + * @property {number} EXPORT_TOP_LEVEL=2 EXPORT_TOP_LEVEL value + * @property {number} LOCAL_ALL=3 LOCAL_ALL value + * @property {number} STRICT=4 STRICT value + */ + VisibilityFeature.DefaultSymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0; + values[valuesById[1] = "EXPORT_ALL"] = 1; + values[valuesById[2] = "EXPORT_TOP_LEVEL"] = 2; + values[valuesById[3] = "LOCAL_ALL"] = 3; + values[valuesById[4] = "STRICT"] = 4; + return values; + })(); + + return VisibilityFeature; + })(); + return FeatureSet; })(); @@ -18530,6 +20144,7 @@ default: return "minimumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -18547,6 +20162,7 @@ default: return "maximumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -18595,6 +20211,10 @@ case 0: message.minimumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.minimumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.minimumEdition = 998; @@ -18647,6 +20267,10 @@ case 0: message.maximumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.maximumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.maximumEdition = 998; @@ -18755,7 +20379,8 @@ * @memberof google.protobuf.FeatureSetDefaults * @interface IFeatureSetEditionDefault * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition - * @property {google.protobuf.IFeatureSet|null} [features] FeatureSetEditionDefault features + * @property {google.protobuf.IFeatureSet|null} [overridableFeatures] FeatureSetEditionDefault overridableFeatures + * @property {google.protobuf.IFeatureSet|null} [fixedFeatures] FeatureSetEditionDefault fixedFeatures */ /** @@ -18782,12 +20407,20 @@ FeatureSetEditionDefault.prototype.edition = 0; /** - * FeatureSetEditionDefault features. - * @member {google.protobuf.IFeatureSet|null|undefined} features + * FeatureSetEditionDefault overridableFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} overridableFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.overridableFeatures = null; + + /** + * FeatureSetEditionDefault fixedFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} fixedFeatures * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @instance */ - FeatureSetEditionDefault.prototype.features = null; + FeatureSetEditionDefault.prototype.fixedFeatures = null; /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -18813,10 +20446,12 @@ FeatureSetEditionDefault.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -18857,8 +20492,12 @@ message.edition = reader.int32(); break; } - case 2: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + case 4: { + message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 5: { + message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } default: @@ -18901,6 +20540,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -18913,10 +20553,15 @@ case 2147483647: break; } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures); + if (error) + return "overridableFeatures." + error; + } + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures); if (error) - return "features." + error; + return "fixedFeatures." + error; } return null; }; @@ -18944,6 +20589,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -18985,10 +20634,15 @@ message.edition = 2147483647; break; } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + if (object.overridableFeatures != null) { + if (typeof object.overridableFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); + message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures); + } + if (object.fixedFeatures != null) { + if (typeof object.fixedFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); + message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures); } return message; }; @@ -19007,13 +20661,16 @@ options = {}; var object = {}; if (options.defaults) { - object.features = null; object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.overridableFeatures = null; + object.fixedFeatures = null; } - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) + object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options); + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) + object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options); return object; }; @@ -20228,6 +21885,22 @@ return GeneratedCodeInfo; })(); + /** + * SymbolVisibility enum. + * @name google.protobuf.SymbolVisibility + * @enum {number} + * @property {number} VISIBILITY_UNSET=0 VISIBILITY_UNSET value + * @property {number} VISIBILITY_LOCAL=1 VISIBILITY_LOCAL value + * @property {number} VISIBILITY_EXPORT=2 VISIBILITY_EXPORT value + */ + protobuf.SymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VISIBILITY_UNSET"] = 0; + values[valuesById[1] = "VISIBILITY_LOCAL"] = 1; + values[valuesById[2] = "VISIBILITY_EXPORT"] = 2; + return values; + })(); + protobuf.Duration = (function() { /** diff --git a/packages/google-cloud-vpcaccess/protos/protos.json b/packages/google-cloud-vpcaccess/protos/protos.json index e2f7e97fc979..94cbdef13212 100644 --- a/packages/google-cloud-vpcaccess/protos/protos.json +++ b/packages/google-cloud-vpcaccess/protos/protos.json @@ -326,8 +326,7 @@ "java_multiple_files": true, "java_outer_classname": "ResourceProto", "java_package": "com.google.api", - "objc_class_prefix": "GAPI", - "cc_enable_arenas": true + "objc_class_prefix": "GAPI" }, "nested": { "http": { @@ -451,6 +450,10 @@ "rule": "repeated", "type": "ClientLibraryDestination", "id": 2 + }, + "selectiveGapicGeneration": { + "type": "SelectiveGapicGeneration", + "id": 3 } } }, @@ -591,6 +594,28 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "experimentalFeatures": { + "type": "ExperimentalFeatures", + "id": 2 + } + }, + "nested": { + "ExperimentalFeatures": { + "fields": { + "restAsyncIoEnabled": { + "type": "bool", + "id": 1 + }, + "protobufPythonicTypesEnabled": { + "type": "bool", + "id": 2 + }, + "unversionedPackageDisabled": { + "type": "bool", + "id": 3 + } + } } } }, @@ -648,6 +673,11 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 } } }, @@ -709,6 +739,19 @@ "PACKAGE_MANAGER": 20 } }, + "SelectiveGapicGeneration": { + "fields": { + "methods": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "generateOmittedAsInternal": { + "type": "bool", + "id": 2 + } + } + }, "LaunchStage": { "values": { "LAUNCH_STAGE_UNSPECIFIED": 0, @@ -841,12 +884,19 @@ "type": "FileDescriptorProto", "id": 1 } - } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ] }, "Edition": { "edition": "proto2", "values": { "EDITION_UNKNOWN": 0, + "EDITION_LEGACY": 900, "EDITION_PROTO2": 998, "EDITION_PROTO3": 999, "EDITION_2023": 1000, @@ -885,6 +935,11 @@ "type": "int32", "id": 11 }, + "optionDependency": { + "rule": "repeated", + "type": "string", + "id": 15 + }, "messageType": { "rule": "repeated", "type": "DescriptorProto", @@ -973,6 +1028,10 @@ "rule": "repeated", "type": "string", "id": 10 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 11 } }, "nested": { @@ -1198,6 +1257,10 @@ "rule": "repeated", "type": "string", "id": 5 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 6 } }, "nested": { @@ -1248,7 +1311,14 @@ "type": "ServiceOptions", "id": 3 } - } + }, + "reserved": [ + [ + 4, + 4 + ], + "stream" + ] }, "MethodDescriptorProto": { "edition": "proto2", @@ -1412,6 +1482,7 @@ 42, 42 ], + "php_generic_services", [ 38, 38 @@ -1547,7 +1618,8 @@ "type": "bool", "id": 10, "options": { - "default": false + "default": false, + "deprecated": true } }, "debugRedact": { @@ -1575,6 +1647,10 @@ "type": "FeatureSet", "id": 21 }, + "featureSupport": { + "type": "FeatureSupport", + "id": 22 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -1644,6 +1720,26 @@ "id": 2 } } + }, + "FeatureSupport": { + "fields": { + "editionIntroduced": { + "type": "Edition", + "id": 1 + }, + "editionDeprecated": { + "type": "Edition", + "id": 2 + }, + "deprecationWarning": { + "type": "string", + "id": 3 + }, + "editionRemoved": { + "type": "Edition", + "id": 4 + } + } } } }, @@ -1732,6 +1828,10 @@ "default": false } }, + "featureSupport": { + "type": "FieldOptions.FeatureSupport", + "id": 4 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -1874,6 +1974,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_2023", "edition_defaults.value": "EXPLICIT" } @@ -1884,6 +1985,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "OPEN" } @@ -1894,6 +1996,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "PACKED" } @@ -1904,6 +2007,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "VERIFY" } @@ -1914,7 +2018,8 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "EDITION_PROTO2", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_LEGACY", "edition_defaults.value": "LENGTH_PREFIXED" } }, @@ -1924,27 +2029,38 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "ALLOW" } + }, + "enforceNamingStyle": { + "type": "EnforceNamingStyle", + "id": 7, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_METHOD", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "STYLE2024" + } + }, + "defaultSymbolVisibility": { + "type": "VisibilityFeature.DefaultSymbolVisibility", + "id": 8, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "EXPORT_TOP_LEVEL" + } } }, "extensions": [ [ 1000, - 1000 - ], - [ - 1001, - 1001 - ], - [ - 1002, - 1002 - ], - [ - 9990, - 9990 + 9994 ], [ 9995, @@ -1989,7 +2105,13 @@ "UTF8_VALIDATION_UNKNOWN": 0, "VERIFY": 2, "NONE": 3 - } + }, + "reserved": [ + [ + 1, + 1 + ] + ] }, "MessageEncoding": { "values": { @@ -2004,6 +2126,33 @@ "ALLOW": 1, "LEGACY_BEST_EFFORT": 2 } + }, + "EnforceNamingStyle": { + "values": { + "ENFORCE_NAMING_STYLE_UNKNOWN": 0, + "STYLE2024": 1, + "STYLE_LEGACY": 2 + } + }, + "VisibilityFeature": { + "fields": {}, + "reserved": [ + [ + 1, + 536870911 + ] + ], + "nested": { + "DefaultSymbolVisibility": { + "values": { + "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, + "EXPORT_ALL": 1, + "EXPORT_TOP_LEVEL": 2, + "LOCAL_ALL": 3, + "STRICT": 4 + } + } + } } } }, @@ -2031,11 +2180,26 @@ "type": "Edition", "id": 3 }, - "features": { + "overridableFeatures": { "type": "FeatureSet", - "id": 2 + "id": 4 + }, + "fixedFeatures": { + "type": "FeatureSet", + "id": 5 } - } + }, + "reserved": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + "features" + ] } } }, @@ -2048,6 +2212,12 @@ "id": 1 } }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ], "nested": { "Location": { "fields": { @@ -2133,6 +2303,14 @@ } } }, + "SymbolVisibility": { + "edition": "proto2", + "values": { + "VISIBILITY_UNSET": 0, + "VISIBILITY_LOCAL": 1, + "VISIBILITY_EXPORT": 2 + } + }, "Duration": { "fields": { "seconds": { @@ -2182,6 +2360,7 @@ "java_multiple_files": true, "java_outer_classname": "OperationsProto", "java_package": "com.google.longrunning", + "objc_class_prefix": "GLRUN", "php_namespace": "Google\\LongRunning" }, "nested": { diff --git a/packages/google-cloud-vpcaccess/samples/generated/v1/snippet_metadata_google.cloud.vpcaccess.v1.json b/packages/google-cloud-vpcaccess/samples/generated/v1/snippet_metadata_google.cloud.vpcaccess.v1.json index c55a2fe0e7f5..577467cc1b35 100644 --- a/packages/google-cloud-vpcaccess/samples/generated/v1/snippet_metadata_google.cloud.vpcaccess.v1.json +++ b/packages/google-cloud-vpcaccess/samples/generated/v1/snippet_metadata_google.cloud.vpcaccess.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-vpcaccess", - "version": "4.2.1", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-vpcaccess/src/v1/index.ts b/packages/google-cloud-vpcaccess/src/v1/index.ts index f9858b00f056..7b641a9bc3b8 100644 --- a/packages/google-cloud-vpcaccess/src/v1/index.ts +++ b/packages/google-cloud-vpcaccess/src/v1/index.ts @@ -16,4 +16,4 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {VpcAccessServiceClient} from './vpc_access_service_client'; +export { VpcAccessServiceClient } from './vpc_access_service_client'; diff --git a/packages/google-cloud-vpcaccess/src/v1/vpc_access_service_client.ts b/packages/google-cloud-vpcaccess/src/v1/vpc_access_service_client.ts index 9afb3710a10c..0cafda7fe544 100644 --- a/packages/google-cloud-vpcaccess/src/v1/vpc_access_service_client.ts +++ b/packages/google-cloud-vpcaccess/src/v1/vpc_access_service_client.ts @@ -18,11 +18,22 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -46,7 +57,7 @@ export class VpcAccessServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('vpc-access'); @@ -59,11 +70,11 @@ export class VpcAccessServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - vpcAccessServiceStub?: Promise<{[name: string]: Function}>; + vpcAccessServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of VpcAccessServiceClient. @@ -104,21 +115,42 @@ export class VpcAccessServiceClient { * const client = new VpcAccessServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof VpcAccessServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'vpcaccess.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -143,7 +175,7 @@ export class VpcAccessServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -157,15 +189,11 @@ export class VpcAccessServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -187,10 +215,10 @@ export class VpcAccessServiceClient { // Create useful helper objects for these. this.pathTemplates = { connectorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/connectors/{connector}' + 'projects/{project}/locations/{location}/connectors/{connector}', ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), }; @@ -198,8 +226,11 @@ export class VpcAccessServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listConnectors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'connectors') + listConnectors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'connectors', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -208,37 +239,61 @@ export class VpcAccessServiceClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createConnectorResponse = protoFilesRoot.lookup( - '.google.cloud.vpcaccess.v1.Connector') as gax.protobuf.Type; + '.google.cloud.vpcaccess.v1.Connector', + ) as gax.protobuf.Type; const createConnectorMetadata = protoFilesRoot.lookup( - '.google.cloud.vpcaccess.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vpcaccess.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteConnectorResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteConnectorMetadata = protoFilesRoot.lookup( - '.google.cloud.vpcaccess.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.vpcaccess.v1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createConnector: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createConnectorResponse.decode.bind(createConnectorResponse), - createConnectorMetadata.decode.bind(createConnectorMetadata)), + createConnectorMetadata.decode.bind(createConnectorMetadata), + ), deleteConnector: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteConnectorResponse.decode.bind(deleteConnectorResponse), - deleteConnectorMetadata.decode.bind(deleteConnectorMetadata)) + deleteConnectorMetadata.decode.bind(deleteConnectorMetadata), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.vpcaccess.v1.VpcAccessService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.vpcaccess.v1.VpcAccessService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -269,28 +324,38 @@ export class VpcAccessServiceClient { // Put together the "service stub" for // google.cloud.vpcaccess.v1.VpcAccessService. this.vpcAccessServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.vpcaccess.v1.VpcAccessService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.vpcaccess.v1.VpcAccessService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.vpcaccess.v1.VpcAccessService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const vpcAccessServiceStubMethods = - ['createConnector', 'getConnector', 'listConnectors', 'deleteConnector']; + const vpcAccessServiceStubMethods = [ + 'createConnector', + 'getConnector', + 'listConnectors', + 'deleteConnector', + ]; for (const methodName of vpcAccessServiceStubMethods) { const callPromise = this.vpcAccessServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); const descriptor = this.descriptors.page[methodName] || @@ -300,7 +365,7 @@ export class VpcAccessServiceClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -315,8 +380,14 @@ export class VpcAccessServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'vpcaccess.googleapis.com'; } @@ -327,8 +398,14 @@ export class VpcAccessServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'vpcaccess.googleapis.com'; } @@ -359,9 +436,7 @@ export class VpcAccessServiceClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -370,8 +445,9 @@ export class VpcAccessServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -382,403 +458,586 @@ export class VpcAccessServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource - * does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of a Serverless VPC Access connector to get. - * @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 protos.google.cloud.vpcaccess.v1.Connector|Connector}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vpc_access_service.get_connector.js - * region_tag:vpcaccess_v1_generated_VpcAccessService_GetConnector_async - */ + /** + * Gets a Serverless VPC Access connector. Returns NOT_FOUND if the resource + * does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of a Serverless VPC Access connector to get. + * @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 protos.google.cloud.vpcaccess.v1.Connector|Connector}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_access_service.get_connector.js + * region_tag:vpcaccess_v1_generated_VpcAccessService_GetConnector_async + */ getConnector( - request?: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vpcaccess.v1.IConnector, - protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IGetConnectorRequest | undefined, + {} | undefined, + ] + >; getConnector( - request: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.vpcaccess.v1.IConnector, - protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IGetConnectorRequest | null | undefined, + {} | null | undefined + >, + ): void; getConnector( - request: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, - callback: Callback< - protos.google.cloud.vpcaccess.v1.IConnector, - protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, + callback: Callback< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IGetConnectorRequest | null | undefined, + {} | null | undefined + >, + ): void; getConnector( - request?: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.vpcaccess.v1.IConnector, - protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.vpcaccess.v1.IGetConnectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.vpcaccess.v1.IConnector, - protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.vpcaccess.v1.IConnector, - protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.vpcaccess.v1.IGetConnectorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IGetConnectorRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IGetConnectorRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getConnector request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.vpcaccess.v1.IConnector, - protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.vpcaccess.v1.IConnector, + | protos.google.cloud.vpcaccess.v1.IGetConnectorRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getConnector response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getConnector(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.vpcaccess.v1.IConnector, - protos.google.cloud.vpcaccess.v1.IGetConnectorRequest|undefined, - {}|undefined - ]) => { - this._log.info('getConnector response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getConnector(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IGetConnectorRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getConnector response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a Serverless VPC Access connector, returns an operation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location in which the configuration should be created, - * specified in the format `projects/* /locations/*`. - * @param {string} request.connectorId - * Required. The ID to use for this connector. - * @param {google.cloud.vpcaccess.v1.Connector} request.connector - * Required. Resource to create. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vpc_access_service.create_connector.js - * region_tag:vpcaccess_v1_generated_VpcAccessService_CreateConnector_async - */ + /** + * Creates a Serverless VPC Access connector, returns an operation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location in which the configuration should be created, + * specified in the format `projects/* /locations/*`. + * @param {string} request.connectorId + * Required. The ID to use for this connector. + * @param {google.cloud.vpcaccess.v1.Connector} request.connector + * Required. Resource to create. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_access_service.create_connector.js + * region_tag:vpcaccess_v1_generated_VpcAccessService_CreateConnector_async + */ createConnector( - request?: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createConnector( - request: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createConnector( - request: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, + callback: Callback< + LROperation< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createConnector( - request?: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vpcaccess.v1.ICreateConnectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createConnector response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createConnector request %j', request); - return this.innerApiCalls.createConnector(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createConnector response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createConnector(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createConnector response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createConnector()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vpc_access_service.create_connector.js - * region_tag:vpcaccess_v1_generated_VpcAccessService_CreateConnector_async - */ - async checkCreateConnectorProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createConnector()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_access_service.create_connector.js + * region_tag:vpcaccess_v1_generated_VpcAccessService_CreateConnector_async + */ + async checkCreateConnectorProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.vpcaccess.v1.Connector, + protos.google.cloud.vpcaccess.v1.OperationMetadata + > + > { this._log.info('createConnector long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnector, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createConnector, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.vpcaccess.v1.Connector, + protos.google.cloud.vpcaccess.v1.OperationMetadata + >; } -/** - * Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the - * resource does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of a Serverless VPC Access connector to delete. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vpc_access_service.delete_connector.js - * region_tag:vpcaccess_v1_generated_VpcAccessService_DeleteConnector_async - */ + /** + * Deletes a Serverless VPC Access connector. Returns NOT_FOUND if the + * resource does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of a Serverless VPC Access connector to delete. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_access_service.delete_connector.js + * region_tag:vpcaccess_v1_generated_VpcAccessService_DeleteConnector_async + */ deleteConnector( - request?: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteConnector( - request: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteConnector( - request: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteConnector( - request?: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.vpcaccess.v1.IDeleteConnectorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteConnector response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteConnector request %j', request); - return this.innerApiCalls.deleteConnector(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteConnector response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteConnector(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteConnector response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteConnector()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vpc_access_service.delete_connector.js - * region_tag:vpcaccess_v1_generated_VpcAccessService_DeleteConnector_async - */ - async checkDeleteConnectorProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteConnector()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_access_service.delete_connector.js + * region_tag:vpcaccess_v1_generated_VpcAccessService_DeleteConnector_async + */ + async checkDeleteConnectorProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vpcaccess.v1.OperationMetadata + > + > { this._log.info('deleteConnector long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnector, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteConnector, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.vpcaccess.v1.OperationMetadata + >; } - /** - * Lists Serverless VPC Access connectors. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the routes should be listed. - * @param {number} request.pageSize - * Maximum number of functions to return per call. - * @param {string} request.pageToken - * Continuation token. - * @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 Array of {@link protos.google.cloud.vpcaccess.v1.Connector|Connector}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listConnectorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Serverless VPC Access connectors. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the routes should be listed. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * Continuation token. + * @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 Array of {@link protos.google.cloud.vpcaccess.v1.Connector|Connector}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listConnectorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listConnectors( - request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.vpcaccess.v1.IConnector[], - protos.google.cloud.vpcaccess.v1.IListConnectorsRequest|null, - protos.google.cloud.vpcaccess.v1.IListConnectorsResponse - ]>; + request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.vpcaccess.v1.IConnector[], + protos.google.cloud.vpcaccess.v1.IListConnectorsRequest | null, + protos.google.cloud.vpcaccess.v1.IListConnectorsResponse, + ] + >; listConnectors( - request: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - protos.google.cloud.vpcaccess.v1.IListConnectorsResponse|null|undefined, - protos.google.cloud.vpcaccess.v1.IConnector>): void; + request: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + | protos.google.cloud.vpcaccess.v1.IListConnectorsResponse + | null + | undefined, + protos.google.cloud.vpcaccess.v1.IConnector + >, + ): void; listConnectors( - request: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - callback: PaginationCallback< - protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - protos.google.cloud.vpcaccess.v1.IListConnectorsResponse|null|undefined, - protos.google.cloud.vpcaccess.v1.IConnector>): void; + request: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + callback: PaginationCallback< + protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + | protos.google.cloud.vpcaccess.v1.IListConnectorsResponse + | null + | undefined, + protos.google.cloud.vpcaccess.v1.IConnector + >, + ): void; listConnectors( - request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - protos.google.cloud.vpcaccess.v1.IListConnectorsResponse|null|undefined, - protos.google.cloud.vpcaccess.v1.IConnector>, - callback?: PaginationCallback< + request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - protos.google.cloud.vpcaccess.v1.IListConnectorsResponse|null|undefined, - protos.google.cloud.vpcaccess.v1.IConnector>): - Promise<[ - protos.google.cloud.vpcaccess.v1.IConnector[], - protos.google.cloud.vpcaccess.v1.IListConnectorsRequest|null, - protos.google.cloud.vpcaccess.v1.IListConnectorsResponse - ]>|void { + | protos.google.cloud.vpcaccess.v1.IListConnectorsResponse + | null + | undefined, + protos.google.cloud.vpcaccess.v1.IConnector + >, + callback?: PaginationCallback< + protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + | protos.google.cloud.vpcaccess.v1.IListConnectorsResponse + | null + | undefined, + protos.google.cloud.vpcaccess.v1.IConnector + >, + ): Promise< + [ + protos.google.cloud.vpcaccess.v1.IConnector[], + protos.google.cloud.vpcaccess.v1.IListConnectorsRequest | null, + protos.google.cloud.vpcaccess.v1.IListConnectorsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - protos.google.cloud.vpcaccess.v1.IListConnectorsResponse|null|undefined, - protos.google.cloud.vpcaccess.v1.IConnector>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + | protos.google.cloud.vpcaccess.v1.IListConnectorsResponse + | null + | undefined, + protos.google.cloud.vpcaccess.v1.IConnector + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listConnectors values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -787,109 +1046,114 @@ export class VpcAccessServiceClient { this._log.info('listConnectors request %j', request); return this.innerApiCalls .listConnectors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.vpcaccess.v1.IConnector[], - protos.google.cloud.vpcaccess.v1.IListConnectorsRequest|null, - protos.google.cloud.vpcaccess.v1.IListConnectorsResponse - ]) => { - this._log.info('listConnectors values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.vpcaccess.v1.IConnector[], + protos.google.cloud.vpcaccess.v1.IListConnectorsRequest | null, + protos.google.cloud.vpcaccess.v1.IListConnectorsResponse, + ]) => { + this._log.info('listConnectors values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listConnectors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the routes should be listed. - * @param {number} request.pageSize - * Maximum number of functions to return per call. - * @param {string} request.pageToken - * Continuation token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.vpcaccess.v1.Connector|Connector} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listConnectorsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listConnectors`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the routes should be listed. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * Continuation token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.vpcaccess.v1.Connector|Connector} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listConnectorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listConnectorsStream( - request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listConnectors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listConnectors stream %j', request); return this.descriptors.page.listConnectors.createStream( this.innerApiCalls.listConnectors as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listConnectors`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location from which the routes should be listed. - * @param {number} request.pageSize - * Maximum number of functions to return per call. - * @param {string} request.pageToken - * Continuation token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.vpcaccess.v1.Connector|Connector}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/vpc_access_service.list_connectors.js - * region_tag:vpcaccess_v1_generated_VpcAccessService_ListConnectors_async - */ + /** + * Equivalent to `listConnectors`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location from which the routes should be listed. + * @param {number} request.pageSize + * Maximum number of functions to return per call. + * @param {string} request.pageToken + * Continuation token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.vpcaccess.v1.Connector|Connector}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/vpc_access_service.list_connectors.js + * region_tag:vpcaccess_v1_generated_VpcAccessService_ListConnectors_async + */ listConnectorsAsync( - request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.vpcaccess.v1.IListConnectorsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listConnectors']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listConnectors iterate %j', request); return this.descriptors.page.listConnectors.asyncIterate( this.innerApiCalls['listConnectors'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } -/** + + /** * Gets information about a location. * * @param {Object} request @@ -924,12 +1188,11 @@ export class VpcAccessServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -962,12 +1225,12 @@ export class VpcAccessServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } -/** + /** * Gets the latest state of a long-running operation. Clients can use this * method to poll the operation result at intervals as recommended by the API * service. @@ -1010,22 +1273,22 @@ export class VpcAccessServiceClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -1060,15 +1323,15 @@ export class VpcAccessServiceClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -1102,7 +1365,7 @@ export class VpcAccessServiceClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -1115,25 +1378,24 @@ export class VpcAccessServiceClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.cancelOperation(request, options, callback); } - /** * Deletes a long-running operation. This method indicates that the client is * no longer interested in the operation result. It does not cancel the @@ -1172,22 +1434,22 @@ export class VpcAccessServiceClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -1203,7 +1465,7 @@ export class VpcAccessServiceClient { * @param {string} connector * @returns {string} Resource name string. */ - connectorPath(project:string,location:string,connector:string) { + connectorPath(project: string, location: string, connector: string) { return this.pathTemplates.connectorPathTemplate.render({ project: project, location: location, @@ -1219,7 +1481,8 @@ export class VpcAccessServiceClient { * @returns {string} A string representing the project. */ matchProjectFromConnectorName(connectorName: string) { - return this.pathTemplates.connectorPathTemplate.match(connectorName).project; + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .project; } /** @@ -1230,7 +1493,8 @@ export class VpcAccessServiceClient { * @returns {string} A string representing the location. */ matchLocationFromConnectorName(connectorName: string) { - return this.pathTemplates.connectorPathTemplate.match(connectorName).location; + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .location; } /** @@ -1241,7 +1505,8 @@ export class VpcAccessServiceClient { * @returns {string} A string representing the connector. */ matchConnectorFromConnectorName(connectorName: string) { - return this.pathTemplates.connectorPathTemplate.match(connectorName).connector; + return this.pathTemplates.connectorPathTemplate.match(connectorName) + .connector; } /** @@ -1251,7 +1516,7 @@ export class VpcAccessServiceClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -1288,14 +1553,16 @@ export class VpcAccessServiceClient { */ close(): Promise { if (this.vpcAccessServiceStub && !this._terminated) { - return this.vpcAccessServiceStub.then(stub => { + return this.vpcAccessServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-vpcaccess/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-vpcaccess/system-test/fixtures/sample/src/index.ts index 0218e085154f..79a5501d9ca0 100644 --- a/packages/google-cloud-vpcaccess/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-vpcaccess/system-test/fixtures/sample/src/index.ts @@ -16,7 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {VpcAccessServiceClient} from '@google-cloud/vpc-access'; +import { VpcAccessServiceClient } from '@google-cloud/vpc-access'; // check that the client class type name can be used function doStuffWithVpcAccessServiceClient(client: VpcAccessServiceClient) { diff --git a/packages/google-cloud-vpcaccess/system-test/install.ts b/packages/google-cloud-vpcaccess/system-test/install.ts index 394f3362d203..ccf167042d2e 100644 --- a/packages/google-cloud-vpcaccess/system-test/install.ts +++ b/packages/google-cloud-vpcaccess/system-test/install.ts @@ -16,34 +16,36 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { + it('TypeScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts', + ).toString(), + }, }; await packNTest(options); }); - it('JavaScript code', async function() { + it('JavaScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } + cjs: readFileSync( + './system-test/fixtures/sample/src/index.js', + ).toString(), + }, }; await packNTest(options); }); - }); diff --git a/packages/google-cloud-vpcaccess/test/gapic_vpc_access_service_v1.ts b/packages/google-cloud-vpcaccess/test/gapic_vpc_access_service_v1.ts index b090ed04eae5..a7cebab4e6dd 100644 --- a/packages/google-cloud-vpcaccess/test/gapic_vpc_access_service_v1.ts +++ b/packages/google-cloud-vpcaccess/test/gapic_vpc_access_service_v1.ts @@ -19,1428 +19,1787 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as vpcaccessserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); } -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.VpcAccessServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'vpcaccess.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = vpcaccessserviceModule.v1.VpcAccessServiceClient.servicePath; - assert.strictEqual(servicePath, 'vpcaccess.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = vpcaccessserviceModule.v1.VpcAccessServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'vpcaccess.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'vpcaccess.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'vpcaccess.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'vpcaccess.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'vpcaccess.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new vpcaccessserviceModule.v1.VpcAccessServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'vpcaccess.googleapis.com'); + }); - it('has port', () => { - const port = vpcaccessserviceModule.v1.VpcAccessServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('has universeDomain', () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('should create a client with no option', () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient(); - assert(client); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + vpcaccessserviceModule.v1.VpcAccessServiceClient.servicePath; + assert.strictEqual(servicePath, 'vpcaccess.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + vpcaccessserviceModule.v1.VpcAccessServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'vpcaccess.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'vpcaccess.example.com'); + }); - it('should create a client with gRPC fallback', () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - fallback: true, - }); - assert(client); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'vpcaccess.example.com'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.vpcAccessServiceStub, undefined); - await client.initialize(); - assert(client.vpcAccessServiceStub); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'vpcaccess.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('has close method for the initialized client', done => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.vpcAccessServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'vpcaccess.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has close method for the non-initialized client', done => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.vpcAccessServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + it('has port', () => { + const port = vpcaccessserviceModule.v1.VpcAccessServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('should create a client with no option', () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient(); + assert(client); }); - describe('getConnector', () => { - it('invokes getConnector without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.GetConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.GetConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.Connector() - ); - client.innerApiCalls.getConnector = stubSimpleCall(expectedResponse); - const [response] = await client.getConnector(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + fallback: true, + }); + assert(client); + }); - it('invokes getConnector without error using callback', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.GetConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.GetConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.Connector() - ); - client.innerApiCalls.getConnector = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConnector( - request, - (err?: Error|null, result?: protos.google.cloud.vpcaccess.v1.IConnector|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.vpcAccessServiceStub, undefined); + await client.initialize(); + assert(client.vpcAccessServiceStub); + }); - it('invokes getConnector with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.GetConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.GetConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConnector = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConnector(request), expectedError); - const actualRequest = (client.innerApiCalls.getConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.vpcAccessServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getConnector with closed client', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.GetConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.GetConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getConnector(request), expectedError); + it('has close method for the non-initialized client', (done) => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.vpcAccessServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('createConnector', () => { - it('invokes createConnector without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.CreateConnectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnector = stubLongRunningCall(expectedResponse); - const [operation] = await client.createConnector(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes createConnector without error using callback', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.CreateConnectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnector = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConnector( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getConnector', () => { + it('invokes getConnector without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.GetConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.GetConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.Connector(), + ); + client.innerApiCalls.getConnector = stubSimpleCall(expectedResponse); + const [response] = await client.getConnector(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createConnector with call error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.CreateConnectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnector = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createConnector(request), expectedError); - const actualRequest = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getConnector without error using callback', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.GetConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.GetConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.Connector(), + ); + client.innerApiCalls.getConnector = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConnector( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vpcaccess.v1.IConnector | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createConnector with LRO error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.CreateConnectorRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnector = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createConnector(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getConnector with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.GetConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.GetConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConnector = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getConnector(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateConnectorProgress without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + it('invokes getConnector with closed client', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.GetConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.GetConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getConnector(request), expectedError); + }); + }); + + describe('createConnector', () => { + it('invokes createConnector without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.CreateConnectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createConnector = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createConnector(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateConnectorProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createConnector without error using callback', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.CreateConnectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createConnector = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConnector( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.vpcaccess.v1.IConnector, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateConnectorProgress with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes createConnector with call error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.CreateConnectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnector = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createConnector(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateConnectorProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createConnector with LRO error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.CreateConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.CreateConnectorRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnector = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createConnector(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteConnector', () => { - it('invokes deleteConnector without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.DeleteConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnector = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteConnector(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateConnectorProgress without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateConnectorProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteConnector without error using callback', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.DeleteConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnector = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteConnector( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateConnectorProgress with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateConnectorProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteConnector', () => { + it('invokes deleteConnector without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.DeleteConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteConnector = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteConnector(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteConnector with call error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.DeleteConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnector = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteConnector(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteConnector without error using callback', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.DeleteConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteConnector = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConnector( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.vpcaccess.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteConnector with LRO error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.DeleteConnectorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnector = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteConnector(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnector as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteConnector with call error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.DeleteConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnector = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteConnector(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteConnectorProgress without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + it('invokes deleteConnector with LRO error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.DeleteConnectorRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.DeleteConnectorRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnector = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteConnector(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteConnector as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConnector as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteConnectorProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteConnectorProgress without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteConnectorProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteConnectorProgress with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkDeleteConnectorProgress with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteConnectorProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listConnectors', () => { + it('invokes listConnectors without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.ListConnectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + ]; + client.innerApiCalls.listConnectors = stubSimpleCall(expectedResponse); + const [response] = await client.listConnectors(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConnectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConnectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteConnectorProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listConnectors without error using callback', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.ListConnectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + ]; + client.innerApiCalls.listConnectors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConnectors( + request, + ( + err?: Error | null, + result?: protos.google.cloud.vpcaccess.v1.IConnector[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConnectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConnectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listConnectors', () => { - it('invokes listConnectors without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - ]; - client.innerApiCalls.listConnectors = stubSimpleCall(expectedResponse); - const [response] = await client.listConnectors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listConnectors with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.ListConnectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConnectors = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listConnectors(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listConnectors as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConnectors as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listConnectors without error using callback', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - ]; - client.innerApiCalls.listConnectors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConnectors( - request, - (err?: Error|null, result?: protos.google.cloud.vpcaccess.v1.IConnector[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listConnectorsStream without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.ListConnectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + ]; + client.descriptors.page.listConnectors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listConnectorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vpcaccess.v1.Connector[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vpcaccess.v1.Connector) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listConnectors with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConnectors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConnectors(request), expectedError); - const actualRequest = (client.innerApiCalls.listConnectors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listConnectors.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listConnectors, request), + ); + assert( + (client.descriptors.page.listConnectors.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listConnectorsStream without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - ]; - client.descriptors.page.listConnectors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConnectorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vpcaccess.v1.Connector[] = []; - stream.on('data', (response: protos.google.cloud.vpcaccess.v1.Connector) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listConnectors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnectors, request)); - assert( - (client.descriptors.page.listConnectors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listConnectorsStream with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.ListConnectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnectors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listConnectorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.vpcaccess.v1.Connector[] = []; + stream.on( + 'data', + (response: protos.google.cloud.vpcaccess.v1.Connector) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); - - it('invokes listConnectorsStream with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnectors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConnectorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.vpcaccess.v1.Connector[] = []; - stream.on('data', (response: protos.google.cloud.vpcaccess.v1.Connector) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConnectors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnectors, request)); - assert( - (client.descriptors.page.listConnectors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listConnectors.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listConnectors, request), + ); + assert( + (client.descriptors.page.listConnectors.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listConnectors without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), - ]; - client.descriptors.page.listConnectors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.vpcaccess.v1.IConnector[] = []; - const iterable = client.listConnectorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConnectors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnectors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listConnectors without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.ListConnectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + generateSampleMessage(new protos.google.cloud.vpcaccess.v1.Connector()), + ]; + client.descriptors.page.listConnectors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.vpcaccess.v1.IConnector[] = []; + const iterable = client.listConnectorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listConnectors.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listConnectors.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listConnectors with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.vpcaccess.v1.ListConnectorsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnectors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConnectorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.vpcaccess.v1.IConnector[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConnectors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnectors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listConnectors with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.vpcaccess.v1.ListConnectorsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.vpcaccess.v1.ListConnectorsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnectors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConnectorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.vpcaccess.v1.IConnector[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listConnectors.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listConnectors.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('invokes getLocation with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('uses async iteration with listLocations with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.IOperation[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.IOperation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + }); + + describe('Path templates', () => { + describe('connector', async () => { + const fakePath = '/rendered/path/connector'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + connector: 'connectorValue', + }; + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.connectorPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.connectorPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('connectorPath', () => { + const result = client.connectorPath( + 'projectValue', + 'locationValue', + 'connectorValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.connectorPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromConnectorName', () => { + const result = client.matchProjectFromConnectorName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromConnectorName', () => { + const result = client.matchLocationFromConnectorName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchConnectorFromConnectorName', () => { + const result = client.matchConnectorFromConnectorName(fakePath); + assert.strictEqual(result, 'connectorValue'); + assert( + (client.pathTemplates.connectorPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('connector', async () => { - const fakePath = "/rendered/path/connector"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - connector: "connectorValue", - }; - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.connectorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.connectorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('connectorPath', () => { - const result = client.connectorPath("projectValue", "locationValue", "connectorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.connectorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConnectorName', () => { - const result = client.matchProjectFromConnectorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConnectorName', () => { - const result = client.matchLocationFromConnectorName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConnectorFromConnectorName', () => { - const result = client.matchConnectorFromConnectorName(fakePath); - assert.strictEqual(result, "connectorValue"); - assert((client.pathTemplates.connectorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new vpcaccessserviceModule.v1.VpcAccessServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-vpcaccess/webpack.config.js b/packages/google-cloud-vpcaccess/webpack.config.js index a86136be0e03..5f9bfc1ebfff 100644 --- a/packages/google-cloud-vpcaccess/webpack.config.js +++ b/packages/google-cloud-vpcaccess/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2026 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. diff --git a/packages/google-cloud-webrisk/.eslintignore b/packages/google-cloud-webrisk/.eslintignore new file mode 100644 index 000000000000..cfc348ec4d11 --- /dev/null +++ b/packages/google-cloud-webrisk/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/packages/google-cloud-webrisk/.eslintrc.json b/packages/google-cloud-webrisk/.eslintrc.json new file mode 100644 index 000000000000..3e8d97ccb390 --- /dev/null +++ b/packages/google-cloud-webrisk/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "./node_modules/gts", + "root": true +} diff --git a/packages/google-cloud-webrisk/README.md b/packages/google-cloud-webrisk/README.md index fd84f752451c..4c0b3df5547c 100644 --- a/packages/google-cloud-webrisk/README.md +++ b/packages/google-cloud-webrisk/README.md @@ -101,7 +101,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-webrisk/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). Please note that this `README.md` and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) @@ -111,7 +111,7 @@ are generated from a central template. Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-webrisk/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project diff --git a/packages/google-cloud-webrisk/protos/protos.d.ts b/packages/google-cloud-webrisk/protos/protos.d.ts index 73f5ceb8481d..23460f2a5f74 100644 --- a/packages/google-cloud-webrisk/protos/protos.d.ts +++ b/packages/google-cloud-webrisk/protos/protos.d.ts @@ -4760,6 +4760,9 @@ export namespace google { /** CommonLanguageSettings destinations */ destinations?: (google.api.ClientLibraryDestination[]|null); + + /** CommonLanguageSettings selectiveGapicGeneration */ + selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); } /** Represents a CommonLanguageSettings. */ @@ -4777,6 +4780,9 @@ export namespace google { /** CommonLanguageSettings destinations. */ public destinations: google.api.ClientLibraryDestination[]; + /** CommonLanguageSettings selectiveGapicGeneration. */ + public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @param [properties] Properties to set @@ -5477,6 +5483,9 @@ export namespace google { /** PythonSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures */ + experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); } /** Represents a PythonSettings. */ @@ -5491,6 +5500,9 @@ export namespace google { /** PythonSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** PythonSettings experimentalFeatures. */ + public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + /** * Creates a new PythonSettings instance using the specified properties. * @param [properties] Properties to set @@ -5569,6 +5581,118 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace PythonSettings { + + /** Properties of an ExperimentalFeatures. */ + interface IExperimentalFeatures { + + /** ExperimentalFeatures restAsyncIoEnabled */ + restAsyncIoEnabled?: (boolean|null); + + /** ExperimentalFeatures protobufPythonicTypesEnabled */ + protobufPythonicTypesEnabled?: (boolean|null); + + /** ExperimentalFeatures unversionedPackageDisabled */ + unversionedPackageDisabled?: (boolean|null); + } + + /** Represents an ExperimentalFeatures. */ + class ExperimentalFeatures implements IExperimentalFeatures { + + /** + * Constructs a new ExperimentalFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); + + /** ExperimentalFeatures restAsyncIoEnabled. */ + public restAsyncIoEnabled: boolean; + + /** ExperimentalFeatures protobufPythonicTypesEnabled. */ + public protobufPythonicTypesEnabled: boolean; + + /** ExperimentalFeatures unversionedPackageDisabled. */ + public unversionedPackageDisabled: boolean; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns ExperimentalFeatures instance + */ + public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Verifies an ExperimentalFeatures 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 an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExperimentalFeatures + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @param message ExperimentalFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExperimentalFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Properties of a NodeSettings. */ interface INodeSettings { @@ -5895,6 +6019,9 @@ export namespace google { /** GoSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); } /** Represents a GoSettings. */ @@ -5909,6 +6036,9 @@ export namespace google { /** GoSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** GoSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + /** * Creates a new GoSettings instance using the specified properties. * @param [properties] Properties to set @@ -6233,6 +6363,109 @@ export namespace google { PACKAGE_MANAGER = 20 } + /** Properties of a SelectiveGapicGeneration. */ + interface ISelectiveGapicGeneration { + + /** SelectiveGapicGeneration methods */ + methods?: (string[]|null); + + /** SelectiveGapicGeneration generateOmittedAsInternal */ + generateOmittedAsInternal?: (boolean|null); + } + + /** Represents a SelectiveGapicGeneration. */ + class SelectiveGapicGeneration implements ISelectiveGapicGeneration { + + /** + * Constructs a new SelectiveGapicGeneration. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ISelectiveGapicGeneration); + + /** SelectiveGapicGeneration methods. */ + public methods: string[]; + + /** SelectiveGapicGeneration generateOmittedAsInternal. */ + public generateOmittedAsInternal: boolean; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectiveGapicGeneration instance + */ + public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Verifies a SelectiveGapicGeneration 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 SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectiveGapicGeneration + */ + public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @param message SelectiveGapicGeneration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** LaunchStage enum. */ enum LaunchStage { LAUNCH_STAGE_UNSPECIFIED = 0, @@ -6614,6 +6847,7 @@ export namespace google { /** Edition enum. */ enum Edition { EDITION_UNKNOWN = 0, + EDITION_LEGACY = 900, EDITION_PROTO2 = 998, EDITION_PROTO3 = 999, EDITION_2023 = 1000, @@ -6644,6 +6878,9 @@ export namespace google { /** FileDescriptorProto weakDependency */ weakDependency?: (number[]|null); + /** FileDescriptorProto optionDependency */ + optionDependency?: (string[]|null); + /** FileDescriptorProto messageType */ messageType?: (google.protobuf.IDescriptorProto[]|null); @@ -6693,6 +6930,9 @@ export namespace google { /** FileDescriptorProto weakDependency. */ public weakDependency: number[]; + /** FileDescriptorProto optionDependency. */ + public optionDependency: string[]; + /** FileDescriptorProto messageType. */ public messageType: google.protobuf.IDescriptorProto[]; @@ -6827,6 +7067,9 @@ export namespace google { /** DescriptorProto reservedName */ reservedName?: (string[]|null); + + /** DescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents a DescriptorProto. */ @@ -6868,6 +7111,9 @@ export namespace google { /** DescriptorProto reservedName. */ public reservedName: string[]; + /** DescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new DescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -7715,6 +7961,9 @@ export namespace google { /** EnumDescriptorProto reservedName */ reservedName?: (string[]|null); + + /** EnumDescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents an EnumDescriptorProto. */ @@ -7741,6 +7990,9 @@ export namespace google { /** EnumDescriptorProto reservedName. */ public reservedName: string[]; + /** EnumDescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -8675,6 +8927,9 @@ export namespace google { /** FieldOptions features */ features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); @@ -8730,6 +8985,9 @@ export namespace google { /** FieldOptions features. */ public features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -8950,6 +9208,121 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a FeatureSupport. */ + interface IFeatureSupport { + + /** FeatureSupport editionIntroduced */ + editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport editionDeprecated */ + editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport deprecationWarning */ + deprecationWarning?: (string|null); + + /** FeatureSupport editionRemoved */ + editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSupport. */ + class FeatureSupport implements IFeatureSupport { + + /** + * Constructs a new FeatureSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); + + /** FeatureSupport editionIntroduced. */ + public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport editionDeprecated. */ + public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport deprecationWarning. */ + public deprecationWarning: string; + + /** FeatureSupport editionRemoved. */ + public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSupport instance + */ + public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Verifies a FeatureSupport 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 FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSupport + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @param message FeatureSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of an OneofOptions. */ @@ -9188,6 +9561,9 @@ export namespace google { /** EnumValueOptions debugRedact */ debugRedact?: (boolean|null); + /** EnumValueOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); } @@ -9210,6 +9586,9 @@ export namespace google { /** EnumValueOptions debugRedact. */ public debugRedact: boolean; + /** EnumValueOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -9802,6 +10181,12 @@ export namespace google { /** FeatureSet jsonFormat */ jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); + + /** FeatureSet enforceNamingStyle */ + enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); + + /** FeatureSet defaultSymbolVisibility */ + defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); } /** Represents a FeatureSet. */ @@ -9831,6 +10216,12 @@ export namespace google { /** FeatureSet jsonFormat. */ public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); + /** FeatureSet enforceNamingStyle. */ + public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); + + /** FeatureSet defaultSymbolVisibility. */ + public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); + /** * Creates a new FeatureSet instance using the specified properties. * @param [properties] Properties to set @@ -9953,6 +10344,116 @@ export namespace google { ALLOW = 1, LEGACY_BEST_EFFORT = 2 } + + /** EnforceNamingStyle enum. */ + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2 + } + + /** Properties of a VisibilityFeature. */ + interface IVisibilityFeature { + } + + /** Represents a VisibilityFeature. */ + class VisibilityFeature implements IVisibilityFeature { + + /** + * Constructs a new VisibilityFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns VisibilityFeature instance + */ + public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Verifies a VisibilityFeature 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 VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisibilityFeature + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @param message VisibilityFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisibilityFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisibilityFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VisibilityFeature { + + /** DefaultSymbolVisibility enum. */ + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + EXPORT_ALL = 1, + EXPORT_TOP_LEVEL = 2, + LOCAL_ALL = 3, + STRICT = 4 + } + } } /** Properties of a FeatureSetDefaults. */ @@ -10072,8 +10573,11 @@ export namespace google { /** FeatureSetEditionDefault edition */ edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - /** FeatureSetEditionDefault features */ - features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures */ + overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures */ + fixedFeatures?: (google.protobuf.IFeatureSet|null); } /** Represents a FeatureSetEditionDefault. */ @@ -10088,8 +10592,11 @@ export namespace google { /** FeatureSetEditionDefault edition. */ public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - /** FeatureSetEditionDefault features. */ - public features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures. */ + public overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures. */ + public fixedFeatures?: (google.protobuf.IFeatureSet|null); /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -10622,6 +11129,13 @@ export namespace google { } } + /** SymbolVisibility enum. */ + enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2 + } + /** Properties of a Duration. */ interface IDuration { diff --git a/packages/google-cloud-webrisk/protos/protos.js b/packages/google-cloud-webrisk/protos/protos.js index 1b0aeb5a2960..0ab6208c64b2 100644 --- a/packages/google-cloud-webrisk/protos/protos.js +++ b/packages/google-cloud-webrisk/protos/protos.js @@ -12067,6 +12067,7 @@ * @interface ICommonLanguageSettings * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri * @property {Array.|null} [destinations] CommonLanguageSettings destinations + * @property {google.api.ISelectiveGapicGeneration|null} [selectiveGapicGeneration] CommonLanguageSettings selectiveGapicGeneration */ /** @@ -12101,6 +12102,14 @@ */ CommonLanguageSettings.prototype.destinations = $util.emptyArray; + /** + * CommonLanguageSettings selectiveGapicGeneration. + * @member {google.api.ISelectiveGapicGeneration|null|undefined} selectiveGapicGeneration + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.selectiveGapicGeneration = null; + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @function create @@ -12133,6 +12142,8 @@ writer.int32(message.destinations[i]); writer.ldelim(); } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -12184,6 +12195,10 @@ message.destinations.push(reader.int32()); break; } + case 3: { + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -12235,6 +12250,11 @@ break; } } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { + var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration); + if (error) + return "selectiveGapicGeneration." + error; + } return null; }; @@ -12277,6 +12297,11 @@ break; } } + if (object.selectiveGapicGeneration != null) { + if (typeof object.selectiveGapicGeneration !== "object") + throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration); + } return message; }; @@ -12295,8 +12320,10 @@ var object = {}; if (options.arrays || options.defaults) object.destinations = []; - if (options.defaults) + if (options.defaults) { object.referenceDocsUri = ""; + object.selectiveGapicGeneration = null; + } if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) object.referenceDocsUri = message.referenceDocsUri; if (message.destinations && message.destinations.length) { @@ -12304,6 +12331,8 @@ for (var j = 0; j < message.destinations.length; ++j) object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) + object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options); return object; }; @@ -14126,6 +14155,7 @@ * @memberof google.api * @interface IPythonSettings * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common + * @property {google.api.PythonSettings.IExperimentalFeatures|null} [experimentalFeatures] PythonSettings experimentalFeatures */ /** @@ -14151,6 +14181,14 @@ */ PythonSettings.prototype.common = null; + /** + * PythonSettings experimentalFeatures. + * @member {google.api.PythonSettings.IExperimentalFeatures|null|undefined} experimentalFeatures + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.experimentalFeatures = null; + /** * Creates a new PythonSettings instance using the specified properties. * @function create @@ -14177,6 +14215,8 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -14217,6 +14257,10 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -14257,6 +14301,11 @@ if (error) return "common." + error; } + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { + var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures); + if (error) + return "experimentalFeatures." + error; + } return null; }; @@ -14277,6 +14326,11 @@ throw TypeError(".google.api.PythonSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.experimentalFeatures != null) { + if (typeof object.experimentalFeatures !== "object") + throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures); + } return message; }; @@ -14293,10 +14347,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.common = null; + object.experimentalFeatures = null; + } if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) + object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options); return object; }; @@ -14326,6 +14384,258 @@ return typeUrlPrefix + "/google.api.PythonSettings"; }; + PythonSettings.ExperimentalFeatures = (function() { + + /** + * Properties of an ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @interface IExperimentalFeatures + * @property {boolean|null} [restAsyncIoEnabled] ExperimentalFeatures restAsyncIoEnabled + * @property {boolean|null} [protobufPythonicTypesEnabled] ExperimentalFeatures protobufPythonicTypesEnabled + * @property {boolean|null} [unversionedPackageDisabled] ExperimentalFeatures unversionedPackageDisabled + */ + + /** + * Constructs a new ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @classdesc Represents an ExperimentalFeatures. + * @implements IExperimentalFeatures + * @constructor + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + */ + function ExperimentalFeatures(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]]; + } + + /** + * ExperimentalFeatures restAsyncIoEnabled. + * @member {boolean} restAsyncIoEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.restAsyncIoEnabled = false; + + /** + * ExperimentalFeatures protobufPythonicTypesEnabled. + * @member {boolean} protobufPythonicTypesEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.protobufPythonicTypesEnabled = false; + + /** + * ExperimentalFeatures unversionedPackageDisabled. + * @member {boolean} unversionedPackageDisabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.unversionedPackageDisabled = false; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures instance + */ + ExperimentalFeatures.create = function create(properties) { + return new ExperimentalFeatures(properties); + }; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.protobufPythonicTypesEnabled); + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unversionedPackageDisabled); + return writer; + }; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restAsyncIoEnabled = reader.bool(); + break; + } + case 2: { + message.protobufPythonicTypesEnabled = reader.bool(); + break; + } + case 3: { + message.unversionedPackageDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExperimentalFeatures message. + * @function verify + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExperimentalFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + if (typeof message.restAsyncIoEnabled !== "boolean") + return "restAsyncIoEnabled: boolean expected"; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + if (typeof message.protobufPythonicTypesEnabled !== "boolean") + return "protobufPythonicTypesEnabled: boolean expected"; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + if (typeof message.unversionedPackageDisabled !== "boolean") + return "unversionedPackageDisabled: boolean expected"; + return null; + }; + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + */ + ExperimentalFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) + return object; + var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + if (object.restAsyncIoEnabled != null) + message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); + if (object.protobufPythonicTypesEnabled != null) + message.protobufPythonicTypesEnabled = Boolean(object.protobufPythonicTypesEnabled); + if (object.unversionedPackageDisabled != null) + message.unversionedPackageDisabled = Boolean(object.unversionedPackageDisabled); + return message; + }; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.ExperimentalFeatures} message ExperimentalFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExperimentalFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.restAsyncIoEnabled = false; + object.protobufPythonicTypesEnabled = false; + object.unversionedPackageDisabled = false; + } + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + object.restAsyncIoEnabled = message.restAsyncIoEnabled; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + object.unversionedPackageDisabled = message.unversionedPackageDisabled; + return object; + }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @function toJSON + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + * @returns {Object.} JSON object + */ + ExperimentalFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExperimentalFeatures + * @function getTypeUrl + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExperimentalFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings.ExperimentalFeatures"; + }; + + return ExperimentalFeatures; + })(); + return PythonSettings; })(); @@ -15202,6 +15512,7 @@ * @memberof google.api * @interface IGoSettings * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common + * @property {Object.|null} [renamedServices] GoSettings renamedServices */ /** @@ -15213,6 +15524,7 @@ * @param {google.api.IGoSettings=} [properties] Properties to set */ function GoSettings(properties) { + this.renamedServices = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15227,6 +15539,14 @@ */ GoSettings.prototype.common = null; + /** + * GoSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.renamedServices = $util.emptyObject; + /** * Creates a new GoSettings instance using the specified properties. * @function create @@ -15253,6 +15573,9 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); return writer; }; @@ -15283,7 +15606,7 @@ GoSettings.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) @@ -15293,6 +15616,29 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedServices[key] = value; + break; + } default: reader.skipType(tag & 7); break; @@ -15333,6 +15679,14 @@ if (error) return "common." + error; } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } return null; }; @@ -15353,6 +15707,13 @@ throw TypeError(".google.api.GoSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.GoSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } return message; }; @@ -15369,10 +15730,18 @@ if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) + object.renamedServices = {}; if (options.defaults) object.common = null; if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } return object; }; @@ -16011,30 +16380,275 @@ return values; })(); - /** - * LaunchStage enum. - * @name google.api.LaunchStage - * @enum {number} - * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value - * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value - * @property {number} PRELAUNCH=7 PRELAUNCH value - * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value - * @property {number} ALPHA=2 ALPHA value - * @property {number} BETA=3 BETA value - * @property {number} GA=4 GA value - * @property {number} DEPRECATED=5 DEPRECATED value - */ - api.LaunchStage = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; - values[valuesById[6] = "UNIMPLEMENTED"] = 6; - values[valuesById[7] = "PRELAUNCH"] = 7; - values[valuesById[1] = "EARLY_ACCESS"] = 1; - values[valuesById[2] = "ALPHA"] = 2; - values[valuesById[3] = "BETA"] = 3; - values[valuesById[4] = "GA"] = 4; - values[valuesById[5] = "DEPRECATED"] = 5; - return values; + api.SelectiveGapicGeneration = (function() { + + /** + * Properties of a SelectiveGapicGeneration. + * @memberof google.api + * @interface ISelectiveGapicGeneration + * @property {Array.|null} [methods] SelectiveGapicGeneration methods + * @property {boolean|null} [generateOmittedAsInternal] SelectiveGapicGeneration generateOmittedAsInternal + */ + + /** + * Constructs a new SelectiveGapicGeneration. + * @memberof google.api + * @classdesc Represents a SelectiveGapicGeneration. + * @implements ISelectiveGapicGeneration + * @constructor + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + */ + function SelectiveGapicGeneration(properties) { + this.methods = []; + 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]]; + } + + /** + * SelectiveGapicGeneration methods. + * @member {Array.} methods + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.methods = $util.emptyArray; + + /** + * SelectiveGapicGeneration generateOmittedAsInternal. + * @member {boolean} generateOmittedAsInternal + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.generateOmittedAsInternal = false; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @function create + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration instance + */ + SelectiveGapicGeneration.create = function create(properties) { + return new SelectiveGapicGeneration(properties); + }; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methods != null && message.methods.length) + for (var i = 0; i < message.methods.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.generateOmittedAsInternal); + return writer; + }; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @function decode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.methods && message.methods.length)) + message.methods = []; + message.methods.push(reader.string()); + break; + } + case 2: { + message.generateOmittedAsInternal = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectiveGapicGeneration message. + * @function verify + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectiveGapicGeneration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methods != null && message.hasOwnProperty("methods")) { + if (!Array.isArray(message.methods)) + return "methods: array expected"; + for (var i = 0; i < message.methods.length; ++i) + if (!$util.isString(message.methods[i])) + return "methods: string[] expected"; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + if (typeof message.generateOmittedAsInternal !== "boolean") + return "generateOmittedAsInternal: boolean expected"; + return null; + }; + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} object Plain object + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + */ + SelectiveGapicGeneration.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.SelectiveGapicGeneration) + return object; + var message = new $root.google.api.SelectiveGapicGeneration(); + if (object.methods) { + if (!Array.isArray(object.methods)) + throw TypeError(".google.api.SelectiveGapicGeneration.methods: array expected"); + message.methods = []; + for (var i = 0; i < object.methods.length; ++i) + message.methods[i] = String(object.methods[i]); + } + if (object.generateOmittedAsInternal != null) + message.generateOmittedAsInternal = Boolean(object.generateOmittedAsInternal); + return message; + }; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.SelectiveGapicGeneration} message SelectiveGapicGeneration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectiveGapicGeneration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.methods = []; + if (options.defaults) + object.generateOmittedAsInternal = false; + if (message.methods && message.methods.length) { + object.methods = []; + for (var j = 0; j < message.methods.length; ++j) + object.methods[j] = message.methods[j]; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + object.generateOmittedAsInternal = message.generateOmittedAsInternal; + return object; + }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @function toJSON + * @memberof google.api.SelectiveGapicGeneration + * @instance + * @returns {Object.} JSON object + */ + SelectiveGapicGeneration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @function getTypeUrl + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectiveGapicGeneration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.SelectiveGapicGeneration"; + }; + + return SelectiveGapicGeneration; + })(); + + /** + * LaunchStage enum. + * @name google.api.LaunchStage + * @enum {number} + * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value + * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value + * @property {number} PRELAUNCH=7 PRELAUNCH value + * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + */ + api.LaunchStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; + values[valuesById[6] = "UNIMPLEMENTED"] = 6; + values[valuesById[7] = "PRELAUNCH"] = 7; + values[valuesById[1] = "EARLY_ACCESS"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + return values; })(); /** @@ -16996,6 +17610,7 @@ * @name google.protobuf.Edition * @enum {number} * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_LEGACY=900 EDITION_LEGACY value * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value * @property {number} EDITION_2023=1000 EDITION_2023 value @@ -17010,6 +17625,7 @@ protobuf.Edition = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[900] = "EDITION_LEGACY"] = 900; values[valuesById[998] = "EDITION_PROTO2"] = 998; values[valuesById[999] = "EDITION_PROTO3"] = 999; values[valuesById[1000] = "EDITION_2023"] = 1000; @@ -17034,6 +17650,7 @@ * @property {Array.|null} [dependency] FileDescriptorProto dependency * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [optionDependency] FileDescriptorProto optionDependency * @property {Array.|null} [messageType] FileDescriptorProto messageType * @property {Array.|null} [enumType] FileDescriptorProto enumType * @property {Array.|null} [service] FileDescriptorProto service @@ -17056,6 +17673,7 @@ this.dependency = []; this.publicDependency = []; this.weakDependency = []; + this.optionDependency = []; this.messageType = []; this.enumType = []; this.service = []; @@ -17106,6 +17724,14 @@ */ FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + /** + * FileDescriptorProto optionDependency. + * @member {Array.} optionDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.optionDependency = $util.emptyArray; + /** * FileDescriptorProto messageType. * @member {Array.} messageType @@ -17227,6 +17853,9 @@ writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + if (message.optionDependency != null && message.optionDependency.length) + for (var i = 0; i < message.optionDependency.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.optionDependency[i]); return writer; }; @@ -17299,6 +17928,12 @@ message.weakDependency.push(reader.int32()); break; } + case 15: { + if (!(message.optionDependency && message.optionDependency.length)) + message.optionDependency = []; + message.optionDependency.push(reader.string()); + break; + } case 4: { if (!(message.messageType && message.messageType.length)) message.messageType = []; @@ -17401,6 +18036,13 @@ if (!$util.isInteger(message.weakDependency[i])) return "weakDependency: integer[] expected"; } + if (message.optionDependency != null && message.hasOwnProperty("optionDependency")) { + if (!Array.isArray(message.optionDependency)) + return "optionDependency: array expected"; + for (var i = 0; i < message.optionDependency.length; ++i) + if (!$util.isString(message.optionDependency[i])) + return "optionDependency: string[] expected"; + } if (message.messageType != null && message.hasOwnProperty("messageType")) { if (!Array.isArray(message.messageType)) return "messageType: array expected"; @@ -17455,6 +18097,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -17507,6 +18150,13 @@ for (var i = 0; i < object.weakDependency.length; ++i) message.weakDependency[i] = object.weakDependency[i] | 0; } + if (object.optionDependency) { + if (!Array.isArray(object.optionDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.optionDependency: array expected"); + message.optionDependency = []; + for (var i = 0; i < object.optionDependency.length; ++i) + message.optionDependency[i] = String(object.optionDependency[i]); + } if (object.messageType) { if (!Array.isArray(object.messageType)) throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); @@ -17570,6 +18220,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -17635,6 +18289,7 @@ object.extension = []; object.publicDependency = []; object.weakDependency = []; + object.optionDependency = []; } if (options.defaults) { object.name = ""; @@ -17691,6 +18346,11 @@ object.syntax = message.syntax; if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.optionDependency && message.optionDependency.length) { + object.optionDependency = []; + for (var j = 0; j < message.optionDependency.length; ++j) + object.optionDependency[j] = message.optionDependency[j]; + } return object; }; @@ -17739,6 +18399,7 @@ * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options * @property {Array.|null} [reservedRange] DescriptorProto reservedRange * @property {Array.|null} [reservedName] DescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] DescriptorProto visibility */ /** @@ -17844,6 +18505,14 @@ */ DescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * DescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.visibility = 0; + /** * Creates a new DescriptorProto instance using the specified properties. * @function create @@ -17896,6 +18565,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.visibility); return writer; }; @@ -17988,6 +18659,10 @@ message.reservedName.push(reader.string()); break; } + case 11: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -18101,6 +18776,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -18200,6 +18884,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -18229,6 +18933,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -18274,6 +18979,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -20318,6 +21025,7 @@ * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] EnumDescriptorProto visibility */ /** @@ -20378,6 +21086,14 @@ */ EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * EnumDescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.visibility = 0; + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @function create @@ -20415,6 +21131,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.visibility); return writer; }; @@ -20477,6 +21195,10 @@ message.reservedName.push(reader.string()); break; } + case 6: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -20545,6 +21267,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -20594,6 +21325,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -20618,6 +21369,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -20638,6 +21390,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -22956,6 +23710,7 @@ * @property {Array.|null} [targets] FieldOptions targets * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] FieldOptions featureSupport * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference @@ -23076,6 +23831,14 @@ */ FieldOptions.prototype.features = null; + /** + * FieldOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.featureSupport = null; + /** * FieldOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -23150,6 +23913,8 @@ $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); if (message.features != null && Object.hasOwnProperty.call(message, "features")) $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -23251,6 +24016,10 @@ message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } + case 22: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -23386,6 +24155,11 @@ if (error) return "features." + error; } + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -23574,6 +24348,11 @@ throw TypeError(".google.protobuf.FieldOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); } + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); @@ -23671,6 +24450,7 @@ object.debugRedact = false; object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; object.features = null; + object.featureSupport = null; object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) @@ -23703,6 +24483,8 @@ } if (message.features != null && message.hasOwnProperty("features")) object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -23975,6 +24757,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -24016,103 +24799,589 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; break; case "EDITION_PROTO3": case 999: - message.edition = 999; + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EditionDefault.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + return object; + }; + + /** + * Converts this EditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + * @returns {Object.} JSON object + */ + EditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + }; + + return EditionDefault; + })(); + + FieldOptions.FeatureSupport = (function() { + + /** + * Properties of a FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @interface IFeatureSupport + * @property {google.protobuf.Edition|null} [editionIntroduced] FeatureSupport editionIntroduced + * @property {google.protobuf.Edition|null} [editionDeprecated] FeatureSupport editionDeprecated + * @property {string|null} [deprecationWarning] FeatureSupport deprecationWarning + * @property {google.protobuf.Edition|null} [editionRemoved] FeatureSupport editionRemoved + */ + + /** + * Constructs a new FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents a FeatureSupport. + * @implements IFeatureSupport + * @constructor + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + */ + function FeatureSupport(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]]; + } + + /** + * FeatureSupport editionIntroduced. + * @member {google.protobuf.Edition} editionIntroduced + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionIntroduced = 0; + + /** + * FeatureSupport editionDeprecated. + * @member {google.protobuf.Edition} editionDeprecated + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionDeprecated = 0; + + /** + * FeatureSupport deprecationWarning. + * @member {string} deprecationWarning + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.deprecationWarning = ""; + + /** + * FeatureSupport editionRemoved. + * @member {google.protobuf.Edition} editionRemoved + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionRemoved = 0; + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport instance + */ + FeatureSupport.create = function create(properties) { + return new FeatureSupport(properties); + }; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editionDeprecated); + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.deprecationWarning); + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.editionRemoved); + return writer; + }; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.editionIntroduced = reader.int32(); + break; + } + case 2: { + message.editionDeprecated = reader.int32(); + break; + } + case 3: { + message.deprecationWarning = reader.string(); + break; + } + case 4: { + message.editionRemoved = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSupport message. + * @function verify + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSupport.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + switch (message.editionIntroduced) { + default: + return "editionIntroduced: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + switch (message.editionDeprecated) { + default: + return "editionDeprecated: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + if (!$util.isString(message.deprecationWarning)) + return "deprecationWarning: string expected"; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + switch (message.editionRemoved) { + default: + return "editionRemoved: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + */ + FeatureSupport.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) + return object; + var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + switch (object.editionIntroduced) { + default: + if (typeof object.editionIntroduced === "number") { + message.editionIntroduced = object.editionIntroduced; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionIntroduced = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionIntroduced = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionIntroduced = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionIntroduced = 999; + break; + case "EDITION_2023": + case 1000: + message.editionIntroduced = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionIntroduced = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionIntroduced = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionIntroduced = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionIntroduced = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionIntroduced = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionIntroduced = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionIntroduced = 2147483647; + break; + } + switch (object.editionDeprecated) { + default: + if (typeof object.editionDeprecated === "number") { + message.editionDeprecated = object.editionDeprecated; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionDeprecated = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionDeprecated = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionDeprecated = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionDeprecated = 999; + break; + case "EDITION_2023": + case 1000: + message.editionDeprecated = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionDeprecated = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionDeprecated = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionDeprecated = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionDeprecated = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionDeprecated = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionDeprecated = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionDeprecated = 2147483647; + break; + } + if (object.deprecationWarning != null) + message.deprecationWarning = String(object.deprecationWarning); + switch (object.editionRemoved) { + default: + if (typeof object.editionRemoved === "number") { + message.editionRemoved = object.editionRemoved; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionRemoved = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionRemoved = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionRemoved = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionRemoved = 999; break; case "EDITION_2023": case 1000: - message.edition = 1000; + message.editionRemoved = 1000; break; case "EDITION_2024": case 1001: - message.edition = 1001; + message.editionRemoved = 1001; break; case "EDITION_1_TEST_ONLY": case 1: - message.edition = 1; + message.editionRemoved = 1; break; case "EDITION_2_TEST_ONLY": case 2: - message.edition = 2; + message.editionRemoved = 2; break; case "EDITION_99997_TEST_ONLY": case 99997: - message.edition = 99997; + message.editionRemoved = 99997; break; case "EDITION_99998_TEST_ONLY": case 99998: - message.edition = 99998; + message.editionRemoved = 99998; break; case "EDITION_99999_TEST_ONLY": case 99999: - message.edition = 99999; + message.editionRemoved = 99999; break; case "EDITION_MAX": case 2147483647: - message.edition = 2147483647; + message.editionRemoved = 2147483647; break; } - if (object.value != null) - message.value = String(object.value); return message; }; /** - * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {google.protobuf.FieldOptions.FeatureSupport} message FeatureSupport * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EditionDefault.toObject = function toObject(message, options) { + FeatureSupport.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.value = ""; - object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; - } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionDeprecated = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.deprecationWarning = ""; + object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + object.deprecationWarning = message.deprecationWarning; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; return object; }; /** - * Converts this EditionDefault to JSON. + * Converts this FeatureSupport to JSON. * @function toJSON - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @instance * @returns {Object.} JSON object */ - EditionDefault.prototype.toJSON = function toJSON() { + FeatureSupport.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for EditionDefault + * Gets the default type url for FeatureSupport * @function getTypeUrl - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FeatureSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + return typeUrlPrefix + "/google.protobuf.FieldOptions.FeatureSupport"; }; - return EditionDefault; + return FeatureSupport; })(); return FieldOptions; @@ -24707,6 +25976,7 @@ * @property {boolean|null} [deprecated] EnumValueOptions deprecated * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] EnumValueOptions featureSupport * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption */ @@ -24750,6 +26020,14 @@ */ EnumValueOptions.prototype.debugRedact = false; + /** + * EnumValueOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.featureSupport = null; + /** * EnumValueOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -24788,6 +26066,8 @@ $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -24839,6 +26119,10 @@ message.debugRedact = reader.bool(); break; } + case 4: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -24891,6 +26175,11 @@ if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) if (typeof message.debugRedact !== "boolean") return "debugRedact: boolean expected"; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -24924,6 +26213,11 @@ } if (object.debugRedact != null) message.debugRedact = Boolean(object.debugRedact); + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); @@ -24956,6 +26250,7 @@ object.deprecated = false; object.features = null; object.debugRedact = false; + object.featureSupport = null; } if (message.deprecated != null && message.hasOwnProperty("deprecated")) object.deprecated = message.deprecated; @@ -24963,6 +26258,8 @@ object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) object.debugRedact = message.debugRedact; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -26430,6 +27727,8 @@ * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + * @property {google.protobuf.FeatureSet.EnforceNamingStyle|null} [enforceNamingStyle] FeatureSet enforceNamingStyle + * @property {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null} [defaultSymbolVisibility] FeatureSet defaultSymbolVisibility */ /** @@ -26495,6 +27794,22 @@ */ FeatureSet.prototype.jsonFormat = 0; + /** + * FeatureSet enforceNamingStyle. + * @member {google.protobuf.FeatureSet.EnforceNamingStyle} enforceNamingStyle + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enforceNamingStyle = 0; + + /** + * FeatureSet defaultSymbolVisibility. + * @member {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility} defaultSymbolVisibility + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.defaultSymbolVisibility = 0; + /** * Creates a new FeatureSet instance using the specified properties. * @function create @@ -26531,6 +27846,10 @@ writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enforceNamingStyle); + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.defaultSymbolVisibility); return writer; }; @@ -26591,6 +27910,14 @@ message.jsonFormat = reader.int32(); break; } + case 7: { + message.enforceNamingStyle = reader.int32(); + break; + } + case 8: { + message.defaultSymbolVisibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -26681,6 +28008,26 @@ case 2: break; } + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + switch (message.enforceNamingStyle) { + default: + return "enforceNamingStyle: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + switch (message.defaultSymbolVisibility) { + default: + return "defaultSymbolVisibility: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } return null; }; @@ -26820,6 +28167,54 @@ message.jsonFormat = 2; break; } + switch (object.enforceNamingStyle) { + default: + if (typeof object.enforceNamingStyle === "number") { + message.enforceNamingStyle = object.enforceNamingStyle; + break; + } + break; + case "ENFORCE_NAMING_STYLE_UNKNOWN": + case 0: + message.enforceNamingStyle = 0; + break; + case "STYLE2024": + case 1: + message.enforceNamingStyle = 1; + break; + case "STYLE_LEGACY": + case 2: + message.enforceNamingStyle = 2; + break; + } + switch (object.defaultSymbolVisibility) { + default: + if (typeof object.defaultSymbolVisibility === "number") { + message.defaultSymbolVisibility = object.defaultSymbolVisibility; + break; + } + break; + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + case 0: + message.defaultSymbolVisibility = 0; + break; + case "EXPORT_ALL": + case 1: + message.defaultSymbolVisibility = 1; + break; + case "EXPORT_TOP_LEVEL": + case 2: + message.defaultSymbolVisibility = 2; + break; + case "LOCAL_ALL": + case 3: + message.defaultSymbolVisibility = 3; + break; + case "STRICT": + case 4: + message.defaultSymbolVisibility = 4; + break; + } return message; }; @@ -26843,6 +28238,8 @@ object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; + object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; } if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; @@ -26856,6 +28253,10 @@ object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; return object; }; @@ -26983,6 +28384,219 @@ return values; })(); + /** + * EnforceNamingStyle enum. + * @name google.protobuf.FeatureSet.EnforceNamingStyle + * @enum {number} + * @property {number} ENFORCE_NAMING_STYLE_UNKNOWN=0 ENFORCE_NAMING_STYLE_UNKNOWN value + * @property {number} STYLE2024=1 STYLE2024 value + * @property {number} STYLE_LEGACY=2 STYLE_LEGACY value + */ + FeatureSet.EnforceNamingStyle = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENFORCE_NAMING_STYLE_UNKNOWN"] = 0; + values[valuesById[1] = "STYLE2024"] = 1; + values[valuesById[2] = "STYLE_LEGACY"] = 2; + return values; + })(); + + FeatureSet.VisibilityFeature = (function() { + + /** + * Properties of a VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @interface IVisibilityFeature + */ + + /** + * Constructs a new VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @classdesc Represents a VisibilityFeature. + * @implements IVisibilityFeature + * @constructor + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + */ + function VisibilityFeature(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]]; + } + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature instance + */ + VisibilityFeature.create = function create(properties) { + return new VisibilityFeature(properties); + }; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisibilityFeature message. + * @function verify + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisibilityFeature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + */ + VisibilityFeature.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) + return object; + return new $root.google.protobuf.FeatureSet.VisibilityFeature(); + }; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.VisibilityFeature} message VisibilityFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisibilityFeature.toObject = function toObject() { + return {}; + }; + + /** + * Converts this VisibilityFeature to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @instance + * @returns {Object.} JSON object + */ + VisibilityFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VisibilityFeature + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisibilityFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet.VisibilityFeature"; + }; + + /** + * DefaultSymbolVisibility enum. + * @name google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + * @enum {number} + * @property {number} DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN value + * @property {number} EXPORT_ALL=1 EXPORT_ALL value + * @property {number} EXPORT_TOP_LEVEL=2 EXPORT_TOP_LEVEL value + * @property {number} LOCAL_ALL=3 LOCAL_ALL value + * @property {number} STRICT=4 STRICT value + */ + VisibilityFeature.DefaultSymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0; + values[valuesById[1] = "EXPORT_ALL"] = 1; + values[valuesById[2] = "EXPORT_TOP_LEVEL"] = 2; + values[valuesById[3] = "LOCAL_ALL"] = 3; + values[valuesById[4] = "STRICT"] = 4; + return values; + })(); + + return VisibilityFeature; + })(); + return FeatureSet; })(); @@ -27167,6 +28781,7 @@ default: return "minimumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -27184,6 +28799,7 @@ default: return "maximumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -27232,6 +28848,10 @@ case 0: message.minimumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.minimumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.minimumEdition = 998; @@ -27284,6 +28904,10 @@ case 0: message.maximumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.maximumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.maximumEdition = 998; @@ -27392,7 +29016,8 @@ * @memberof google.protobuf.FeatureSetDefaults * @interface IFeatureSetEditionDefault * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition - * @property {google.protobuf.IFeatureSet|null} [features] FeatureSetEditionDefault features + * @property {google.protobuf.IFeatureSet|null} [overridableFeatures] FeatureSetEditionDefault overridableFeatures + * @property {google.protobuf.IFeatureSet|null} [fixedFeatures] FeatureSetEditionDefault fixedFeatures */ /** @@ -27419,12 +29044,20 @@ FeatureSetEditionDefault.prototype.edition = 0; /** - * FeatureSetEditionDefault features. - * @member {google.protobuf.IFeatureSet|null|undefined} features + * FeatureSetEditionDefault overridableFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} overridableFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.overridableFeatures = null; + + /** + * FeatureSetEditionDefault fixedFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} fixedFeatures * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @instance */ - FeatureSetEditionDefault.prototype.features = null; + FeatureSetEditionDefault.prototype.fixedFeatures = null; /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -27450,10 +29083,12 @@ FeatureSetEditionDefault.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -27494,8 +29129,12 @@ message.edition = reader.int32(); break; } - case 2: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + case 4: { + message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 5: { + message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } default: @@ -27538,6 +29177,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -27550,10 +29190,15 @@ case 2147483647: break; } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures); + if (error) + return "overridableFeatures." + error; + } + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures); if (error) - return "features." + error; + return "fixedFeatures." + error; } return null; }; @@ -27581,6 +29226,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -27622,10 +29271,15 @@ message.edition = 2147483647; break; } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + if (object.overridableFeatures != null) { + if (typeof object.overridableFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); + message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures); + } + if (object.fixedFeatures != null) { + if (typeof object.fixedFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); + message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures); } return message; }; @@ -27644,13 +29298,16 @@ options = {}; var object = {}; if (options.defaults) { - object.features = null; object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.overridableFeatures = null; + object.fixedFeatures = null; } - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) + object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options); + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) + object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options); return object; }; @@ -28865,6 +30522,22 @@ return GeneratedCodeInfo; })(); + /** + * SymbolVisibility enum. + * @name google.protobuf.SymbolVisibility + * @enum {number} + * @property {number} VISIBILITY_UNSET=0 VISIBILITY_UNSET value + * @property {number} VISIBILITY_LOCAL=1 VISIBILITY_LOCAL value + * @property {number} VISIBILITY_EXPORT=2 VISIBILITY_EXPORT value + */ + protobuf.SymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VISIBILITY_UNSET"] = 0; + values[valuesById[1] = "VISIBILITY_LOCAL"] = 1; + values[valuesById[2] = "VISIBILITY_EXPORT"] = 2; + return values; + })(); + protobuf.Duration = (function() { /** diff --git a/packages/google-cloud-webrisk/protos/protos.json b/packages/google-cloud-webrisk/protos/protos.json index 971a70bb3897..e1563d784b63 100644 --- a/packages/google-cloud-webrisk/protos/protos.json +++ b/packages/google-cloud-webrisk/protos/protos.json @@ -928,8 +928,7 @@ "java_multiple_files": true, "java_outer_classname": "ResourceProto", "java_package": "com.google.api", - "objc_class_prefix": "GAPI", - "cc_enable_arenas": true + "objc_class_prefix": "GAPI" }, "nested": { "http": { @@ -1053,6 +1052,10 @@ "rule": "repeated", "type": "ClientLibraryDestination", "id": 2 + }, + "selectiveGapicGeneration": { + "type": "SelectiveGapicGeneration", + "id": 3 } } }, @@ -1193,6 +1196,28 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "experimentalFeatures": { + "type": "ExperimentalFeatures", + "id": 2 + } + }, + "nested": { + "ExperimentalFeatures": { + "fields": { + "restAsyncIoEnabled": { + "type": "bool", + "id": 1 + }, + "protobufPythonicTypesEnabled": { + "type": "bool", + "id": 2 + }, + "unversionedPackageDisabled": { + "type": "bool", + "id": 3 + } + } } } }, @@ -1250,6 +1275,11 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 } } }, @@ -1311,6 +1341,19 @@ "PACKAGE_MANAGER": 20 } }, + "SelectiveGapicGeneration": { + "fields": { + "methods": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "generateOmittedAsInternal": { + "type": "bool", + "id": 2 + } + } + }, "LaunchStage": { "values": { "LAUNCH_STAGE_UNSPECIFIED": 0, @@ -1443,12 +1486,19 @@ "type": "FileDescriptorProto", "id": 1 } - } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ] }, "Edition": { "edition": "proto2", "values": { "EDITION_UNKNOWN": 0, + "EDITION_LEGACY": 900, "EDITION_PROTO2": 998, "EDITION_PROTO3": 999, "EDITION_2023": 1000, @@ -1487,6 +1537,11 @@ "type": "int32", "id": 11 }, + "optionDependency": { + "rule": "repeated", + "type": "string", + "id": 15 + }, "messageType": { "rule": "repeated", "type": "DescriptorProto", @@ -1575,6 +1630,10 @@ "rule": "repeated", "type": "string", "id": 10 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 11 } }, "nested": { @@ -1800,6 +1859,10 @@ "rule": "repeated", "type": "string", "id": 5 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 6 } }, "nested": { @@ -1850,7 +1913,14 @@ "type": "ServiceOptions", "id": 3 } - } + }, + "reserved": [ + [ + 4, + 4 + ], + "stream" + ] }, "MethodDescriptorProto": { "edition": "proto2", @@ -2014,6 +2084,7 @@ 42, 42 ], + "php_generic_services", [ 38, 38 @@ -2149,7 +2220,8 @@ "type": "bool", "id": 10, "options": { - "default": false + "default": false, + "deprecated": true } }, "debugRedact": { @@ -2177,6 +2249,10 @@ "type": "FeatureSet", "id": 21 }, + "featureSupport": { + "type": "FeatureSupport", + "id": 22 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -2246,6 +2322,26 @@ "id": 2 } } + }, + "FeatureSupport": { + "fields": { + "editionIntroduced": { + "type": "Edition", + "id": 1 + }, + "editionDeprecated": { + "type": "Edition", + "id": 2 + }, + "deprecationWarning": { + "type": "string", + "id": 3 + }, + "editionRemoved": { + "type": "Edition", + "id": 4 + } + } } } }, @@ -2334,6 +2430,10 @@ "default": false } }, + "featureSupport": { + "type": "FieldOptions.FeatureSupport", + "id": 4 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -2476,6 +2576,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_2023", "edition_defaults.value": "EXPLICIT" } @@ -2486,6 +2587,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "OPEN" } @@ -2496,6 +2598,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "PACKED" } @@ -2506,6 +2609,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "VERIFY" } @@ -2516,7 +2620,8 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "EDITION_PROTO2", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_LEGACY", "edition_defaults.value": "LENGTH_PREFIXED" } }, @@ -2526,27 +2631,38 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "ALLOW" } + }, + "enforceNamingStyle": { + "type": "EnforceNamingStyle", + "id": 7, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_METHOD", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "STYLE2024" + } + }, + "defaultSymbolVisibility": { + "type": "VisibilityFeature.DefaultSymbolVisibility", + "id": 8, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "EXPORT_TOP_LEVEL" + } } }, "extensions": [ [ 1000, - 1000 - ], - [ - 1001, - 1001 - ], - [ - 1002, - 1002 - ], - [ - 9990, - 9990 + 9994 ], [ 9995, @@ -2591,7 +2707,13 @@ "UTF8_VALIDATION_UNKNOWN": 0, "VERIFY": 2, "NONE": 3 - } + }, + "reserved": [ + [ + 1, + 1 + ] + ] }, "MessageEncoding": { "values": { @@ -2606,6 +2728,33 @@ "ALLOW": 1, "LEGACY_BEST_EFFORT": 2 } + }, + "EnforceNamingStyle": { + "values": { + "ENFORCE_NAMING_STYLE_UNKNOWN": 0, + "STYLE2024": 1, + "STYLE_LEGACY": 2 + } + }, + "VisibilityFeature": { + "fields": {}, + "reserved": [ + [ + 1, + 536870911 + ] + ], + "nested": { + "DefaultSymbolVisibility": { + "values": { + "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, + "EXPORT_ALL": 1, + "EXPORT_TOP_LEVEL": 2, + "LOCAL_ALL": 3, + "STRICT": 4 + } + } + } } } }, @@ -2633,11 +2782,26 @@ "type": "Edition", "id": 3 }, - "features": { + "overridableFeatures": { "type": "FeatureSet", - "id": 2 + "id": 4 + }, + "fixedFeatures": { + "type": "FeatureSet", + "id": 5 } - } + }, + "reserved": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + "features" + ] } } }, @@ -2650,6 +2814,12 @@ "id": 1 } }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ], "nested": { "Location": { "fields": { @@ -2735,6 +2905,14 @@ } } }, + "SymbolVisibility": { + "edition": "proto2", + "values": { + "VISIBILITY_UNSET": 0, + "VISIBILITY_LOCAL": 1, + "VISIBILITY_EXPORT": 2 + } + }, "Duration": { "fields": { "seconds": { @@ -2784,6 +2962,7 @@ "java_multiple_files": true, "java_outer_classname": "OperationsProto", "java_package": "com.google.longrunning", + "objc_class_prefix": "GLRUN", "php_namespace": "Google\\LongRunning" }, "nested": { diff --git a/packages/google-cloud-webrisk/samples/generated/v1/snippet_metadata_google.cloud.webrisk.v1.json b/packages/google-cloud-webrisk/samples/generated/v1/snippet_metadata_google.cloud.webrisk.v1.json index bb1cd2aa2374..8c24e94fdab0 100644 --- a/packages/google-cloud-webrisk/samples/generated/v1/snippet_metadata_google.cloud.webrisk.v1.json +++ b/packages/google-cloud-webrisk/samples/generated/v1/snippet_metadata_google.cloud.webrisk.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-webrisk", - "version": "5.3.1", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-webrisk/samples/generated/v1beta1/snippet_metadata_google.cloud.webrisk.v1beta1.json b/packages/google-cloud-webrisk/samples/generated/v1beta1/snippet_metadata_google.cloud.webrisk.v1beta1.json index 09378c1e5fb9..50a7a60596fe 100644 --- a/packages/google-cloud-webrisk/samples/generated/v1beta1/snippet_metadata_google.cloud.webrisk.v1beta1.json +++ b/packages/google-cloud-webrisk/samples/generated/v1beta1/snippet_metadata_google.cloud.webrisk.v1beta1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-webrisk", - "version": "5.3.1", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-webrisk/src/v1/index.ts b/packages/google-cloud-webrisk/src/v1/index.ts index ce3e1affcfdc..a120f19f607f 100644 --- a/packages/google-cloud-webrisk/src/v1/index.ts +++ b/packages/google-cloud-webrisk/src/v1/index.ts @@ -16,4 +16,4 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {WebRiskServiceClient} from './web_risk_service_client'; +export { WebRiskServiceClient } from './web_risk_service_client'; diff --git a/packages/google-cloud-webrisk/src/v1/web_risk_service_client.ts b/packages/google-cloud-webrisk/src/v1/web_risk_service_client.ts index 3681e0bbce1e..c0795b1fde2b 100644 --- a/packages/google-cloud-webrisk/src/v1/web_risk_service_client.ts +++ b/packages/google-cloud-webrisk/src/v1/web_risk_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -45,7 +52,7 @@ export class WebRiskServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('web-risk'); @@ -58,10 +65,10 @@ export class WebRiskServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - webRiskServiceStub?: Promise<{[name: string]: Function}>; + webRiskServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of WebRiskServiceClient. @@ -102,21 +109,42 @@ export class WebRiskServiceClient { * const client = new WebRiskServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof WebRiskServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'webrisk.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -141,7 +169,7 @@ export class WebRiskServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,10 +183,7 @@ export class WebRiskServiceClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -180,7 +205,7 @@ export class WebRiskServiceClient { // Create useful helper objects for these. this.pathTemplates = { projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), }; @@ -190,29 +215,55 @@ export class WebRiskServiceClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*}/operations',}]; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*}/operations', + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const submitUriResponse = protoFilesRoot.lookup( - '.google.cloud.webrisk.v1.Submission') as gax.protobuf.Type; + '.google.cloud.webrisk.v1.Submission', + ) as gax.protobuf.Type; const submitUriMetadata = protoFilesRoot.lookup( - '.google.cloud.webrisk.v1.SubmitUriMetadata') as gax.protobuf.Type; + '.google.cloud.webrisk.v1.SubmitUriMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { submitUri: new this._gaxModule.LongrunningDescriptor( this.operationsClient, submitUriResponse.decode.bind(submitUriResponse), - submitUriMetadata.decode.bind(submitUriMetadata)) + submitUriMetadata.decode.bind(submitUriMetadata), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.webrisk.v1.WebRiskService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.webrisk.v1.WebRiskService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -243,37 +294,46 @@ export class WebRiskServiceClient { // Put together the "service stub" for // google.cloud.webrisk.v1.WebRiskService. this.webRiskServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.webrisk.v1.WebRiskService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.webrisk.v1.WebRiskService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.webrisk.v1.WebRiskService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const webRiskServiceStubMethods = - ['computeThreatListDiff', 'searchUris', 'searchHashes', 'createSubmission', 'submitUri']; + const webRiskServiceStubMethods = [ + 'computeThreatListDiff', + 'searchUris', + 'searchHashes', + 'createSubmission', + 'submitUri', + ]; for (const methodName of webRiskServiceStubMethods) { const callPromise = this.webRiskServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; + const descriptor = this.descriptors.longrunning[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -288,8 +348,14 @@ export class WebRiskServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'webrisk.googleapis.com'; } @@ -300,8 +366,14 @@ export class WebRiskServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'webrisk.googleapis.com'; } @@ -332,9 +404,7 @@ export class WebRiskServiceClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -343,8 +413,9 @@ export class WebRiskServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -355,533 +426,745 @@ export class WebRiskServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets the most recent threat list diffs. These diffs should be applied to - * a local database of hashes to keep it up-to-date. If the local database is - * empty or excessively out-of-date, a complete snapshot of the database will - * be returned. This Method only updates a single ThreatList at a time. To - * update multiple ThreatList databases, this method needs to be called once - * for each list. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.webrisk.v1.ThreatType} request.threatType - * Required. The threat list to update. Only a single ThreatType should be - * specified per request. If you want to handle multiple ThreatTypes, you must - * make one request per ThreatType. - * @param {Buffer} request.versionToken - * The current version token of the client for the requested list (the - * client version that was received from the last successful diff). - * If the client does not have a version token (this is the first time calling - * ComputeThreatListDiff), this may be left empty and a full database - * snapshot will be returned. - * @param {google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints} request.constraints - * Required. The constraints associated with this request. - * @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 protos.google.cloud.webrisk.v1.ComputeThreatListDiffResponse|ComputeThreatListDiffResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_risk_service.compute_threat_list_diff.js - * region_tag:webrisk_v1_generated_WebRiskService_ComputeThreatListDiff_async - */ + /** + * Gets the most recent threat list diffs. These diffs should be applied to + * a local database of hashes to keep it up-to-date. If the local database is + * empty or excessively out-of-date, a complete snapshot of the database will + * be returned. This Method only updates a single ThreatList at a time. To + * update multiple ThreatList databases, this method needs to be called once + * for each list. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.webrisk.v1.ThreatType} request.threatType + * Required. The threat list to update. Only a single ThreatType should be + * specified per request. If you want to handle multiple ThreatTypes, you must + * make one request per ThreatType. + * @param {Buffer} request.versionToken + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * If the client does not have a version token (this is the first time calling + * ComputeThreatListDiff), this may be left empty and a full database + * snapshot will be returned. + * @param {google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints} request.constraints + * Required. The constraints associated with this request. + * @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 protos.google.cloud.webrisk.v1.ComputeThreatListDiffResponse|ComputeThreatListDiffResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_risk_service.compute_threat_list_diff.js + * region_tag:webrisk_v1_generated_WebRiskService_ComputeThreatListDiff_async + */ computeThreatListDiff( - request?: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, + protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest | undefined, + {} | undefined, + ] + >; computeThreatListDiff( - request: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, + | protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest + | null + | undefined, + {} | null | undefined + >, + ): void; computeThreatListDiff( - request: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, - callback: Callback< - protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, + callback: Callback< + protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, + | protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest + | null + | undefined, + {} | null | undefined + >, + ): void; computeThreatListDiff( - request?: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, + | protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, + protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('computeThreatListDiff request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, + | protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('computeThreatListDiff response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.computeThreatListDiff(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest|undefined, - {}|undefined - ]) => { - this._log.info('computeThreatListDiff response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .computeThreatListDiff(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse, + ( + | protos.google.cloud.webrisk.v1.IComputeThreatListDiffRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('computeThreatListDiff response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * This method is used to check whether a URI is on a given threatList. - * Multiple threatLists may be searched in a single query. - * The response will list all requested threatLists the URI was found to - * match. If the URI is not found on any of the requested ThreatList an - * empty response will be returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.uri - * Required. The URI to be checked for matches. - * @param {number[]} request.threatTypes - * Required. The ThreatLists to search in. Multiple ThreatLists may be - * specified. - * @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 protos.google.cloud.webrisk.v1.SearchUrisResponse|SearchUrisResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_risk_service.search_uris.js - * region_tag:webrisk_v1_generated_WebRiskService_SearchUris_async - */ + /** + * This method is used to check whether a URI is on a given threatList. + * Multiple threatLists may be searched in a single query. + * The response will list all requested threatLists the URI was found to + * match. If the URI is not found on any of the requested ThreatList an + * empty response will be returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.uri + * Required. The URI to be checked for matches. + * @param {number[]} request.threatTypes + * Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * @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 protos.google.cloud.webrisk.v1.SearchUrisResponse|SearchUrisResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_risk_service.search_uris.js + * region_tag:webrisk_v1_generated_WebRiskService_SearchUris_async + */ searchUris( - request?: protos.google.cloud.webrisk.v1.ISearchUrisRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.webrisk.v1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1.ISearchUrisRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.webrisk.v1.ISearchUrisRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.webrisk.v1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1.ISearchUrisRequest | undefined, + {} | undefined, + ] + >; searchUris( - request: protos.google.cloud.webrisk.v1.ISearchUrisRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.webrisk.v1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1.ISearchUrisRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1.ISearchUrisRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.webrisk.v1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1.ISearchUrisRequest | null | undefined, + {} | null | undefined + >, + ): void; searchUris( - request: protos.google.cloud.webrisk.v1.ISearchUrisRequest, - callback: Callback< - protos.google.cloud.webrisk.v1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1.ISearchUrisRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1.ISearchUrisRequest, + callback: Callback< + protos.google.cloud.webrisk.v1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1.ISearchUrisRequest | null | undefined, + {} | null | undefined + >, + ): void; searchUris( - request?: protos.google.cloud.webrisk.v1.ISearchUrisRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.webrisk.v1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1.ISearchUrisRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.webrisk.v1.ISearchUrisRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.webrisk.v1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1.ISearchUrisRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.webrisk.v1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1.ISearchUrisRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.webrisk.v1.ISearchUrisRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.webrisk.v1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1.ISearchUrisRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.webrisk.v1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1.ISearchUrisRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('searchUris request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.webrisk.v1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1.ISearchUrisRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.webrisk.v1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1.ISearchUrisRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('searchUris response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.searchUris(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.webrisk.v1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1.ISearchUrisRequest|undefined, - {}|undefined - ]) => { - this._log.info('searchUris response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .searchUris(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.webrisk.v1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1.ISearchUrisRequest | undefined, + {} | undefined, + ]) => { + this._log.info('searchUris response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets the full hashes that match the requested hash prefix. - * This is used after a hash prefix is looked up in a threatList - * and there is a match. The client side threatList only holds partial hashes - * so the client must query this method to determine if there is a full - * hash match of a threat. - * - * @param {Object} request - * The request object that will be sent. - * @param {Buffer} request.hashPrefix - * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 - * hash. For JSON requests, this field is base64-encoded. - * Note that if this parameter is provided by a URI, it must be encoded using - * the web safe base64 variant (RFC 4648). - * @param {number[]} request.threatTypes - * Required. The ThreatLists to search in. Multiple ThreatLists may be - * specified. - * @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 protos.google.cloud.webrisk.v1.SearchHashesResponse|SearchHashesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_risk_service.search_hashes.js - * region_tag:webrisk_v1_generated_WebRiskService_SearchHashes_async - */ + /** + * Gets the full hashes that match the requested hash prefix. + * This is used after a hash prefix is looked up in a threatList + * and there is a match. The client side threatList only holds partial hashes + * so the client must query this method to determine if there is a full + * hash match of a threat. + * + * @param {Object} request + * The request object that will be sent. + * @param {Buffer} request.hashPrefix + * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * Note that if this parameter is provided by a URI, it must be encoded using + * the web safe base64 variant (RFC 4648). + * @param {number[]} request.threatTypes + * Required. The ThreatLists to search in. Multiple ThreatLists may be + * specified. + * @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 protos.google.cloud.webrisk.v1.SearchHashesResponse|SearchHashesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_risk_service.search_hashes.js + * region_tag:webrisk_v1_generated_WebRiskService_SearchHashes_async + */ searchHashes( - request?: protos.google.cloud.webrisk.v1.ISearchHashesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.webrisk.v1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1.ISearchHashesRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.webrisk.v1.ISearchHashesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.webrisk.v1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1.ISearchHashesRequest | undefined, + {} | undefined, + ] + >; searchHashes( - request: protos.google.cloud.webrisk.v1.ISearchHashesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.webrisk.v1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1.ISearchHashesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1.ISearchHashesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.webrisk.v1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1.ISearchHashesRequest | null | undefined, + {} | null | undefined + >, + ): void; searchHashes( - request: protos.google.cloud.webrisk.v1.ISearchHashesRequest, - callback: Callback< - protos.google.cloud.webrisk.v1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1.ISearchHashesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1.ISearchHashesRequest, + callback: Callback< + protos.google.cloud.webrisk.v1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1.ISearchHashesRequest | null | undefined, + {} | null | undefined + >, + ): void; searchHashes( - request?: protos.google.cloud.webrisk.v1.ISearchHashesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.webrisk.v1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1.ISearchHashesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.webrisk.v1.ISearchHashesRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.webrisk.v1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1.ISearchHashesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.webrisk.v1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1.ISearchHashesRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.webrisk.v1.ISearchHashesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.webrisk.v1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1.ISearchHashesRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.webrisk.v1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1.ISearchHashesRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('searchHashes request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.webrisk.v1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1.ISearchHashesRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.webrisk.v1.ISearchHashesResponse, + | protos.google.cloud.webrisk.v1.ISearchHashesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('searchHashes response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.searchHashes(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.webrisk.v1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1.ISearchHashesRequest|undefined, - {}|undefined - ]) => { - this._log.info('searchHashes response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .searchHashes(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.webrisk.v1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1.ISearchHashesRequest | undefined, + {} | undefined, + ]) => { + this._log.info('searchHashes response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a Submission of a URI suspected of containing phishing content to - * be reviewed. If the result verifies the existence of malicious phishing - * content, the site will be added to the [Google's Social Engineering - * lists](https://support.google.com/webmasters/answer/6350487/) in order to - * protect users that could get exposed to this threat in the future. Only - * allowlisted projects can use this method during Early Access. Please reach - * out to Sales or your customer engineer to obtain access. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project that is making the submission. This - * string is in the format "projects/{project_number}". - * @param {google.cloud.webrisk.v1.Submission} request.submission - * Required. The submission that contains the content of the phishing report. - * @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 protos.google.cloud.webrisk.v1.Submission|Submission}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_risk_service.create_submission.js - * region_tag:webrisk_v1_generated_WebRiskService_CreateSubmission_async - */ + /** + * Creates a Submission of a URI suspected of containing phishing content to + * be reviewed. If the result verifies the existence of malicious phishing + * content, the site will be added to the [Google's Social Engineering + * lists](https://support.google.com/webmasters/answer/6350487/) in order to + * protect users that could get exposed to this threat in the future. Only + * allowlisted projects can use this method during Early Access. Please reach + * out to Sales or your customer engineer to obtain access. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". + * @param {google.cloud.webrisk.v1.Submission} request.submission + * Required. The submission that contains the content of the phishing report. + * @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 protos.google.cloud.webrisk.v1.Submission|Submission}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_risk_service.create_submission.js + * region_tag:webrisk_v1_generated_WebRiskService_CreateSubmission_async + */ createSubmission( - request?: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.webrisk.v1.ISubmission, - protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ICreateSubmissionRequest | undefined, + {} | undefined, + ] + >; createSubmission( - request: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.webrisk.v1.ISubmission, - protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.webrisk.v1.ISubmission, + | protos.google.cloud.webrisk.v1.ICreateSubmissionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createSubmission( - request: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, - callback: Callback< - protos.google.cloud.webrisk.v1.ISubmission, - protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, + callback: Callback< + protos.google.cloud.webrisk.v1.ISubmission, + | protos.google.cloud.webrisk.v1.ICreateSubmissionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createSubmission( - request?: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.webrisk.v1.ISubmission, - protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.webrisk.v1.ICreateSubmissionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.webrisk.v1.ISubmission, - protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.webrisk.v1.ISubmission, - protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.webrisk.v1.ICreateSubmissionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.webrisk.v1.ISubmission, + | protos.google.cloud.webrisk.v1.ICreateSubmissionRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ICreateSubmissionRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createSubmission request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.webrisk.v1.ISubmission, - protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.webrisk.v1.ISubmission, + | protos.google.cloud.webrisk.v1.ICreateSubmissionRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createSubmission response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createSubmission(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.webrisk.v1.ISubmission, - protos.google.cloud.webrisk.v1.ICreateSubmissionRequest|undefined, - {}|undefined - ]) => { - this._log.info('createSubmission response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createSubmission(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ICreateSubmissionRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createSubmission response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Submits a URI suspected of containing malicious content to be reviewed. - * Returns a google.longrunning.Operation which, once the review is complete, - * is updated with its result. You can use the [Pub/Sub API] - * (https://cloud.google.com/pubsub) to receive notifications for the returned - * Operation. If the result verifies the existence of malicious content, the - * site will be added to the [Google's Social Engineering lists] - * (https://support.google.com/webmasters/answer/6350487/) in order to - * protect users that could get exposed to this threat in the future. Only - * allowlisted projects can use this method during Early Access. Please reach - * out to Sales or your customer engineer to obtain access. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project that is making the submission. This - * string is in the format "projects/{project_number}". - * @param {google.cloud.webrisk.v1.Submission} request.submission - * Required. The submission that contains the URI to be scanned. - * @param {google.cloud.webrisk.v1.ThreatInfo} request.threatInfo - * Provides additional information about the submission. - * @param {google.cloud.webrisk.v1.ThreatDiscovery} request.threatDiscovery - * Provides additional information about how the submission was discovered. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_risk_service.submit_uri.js - * region_tag:webrisk_v1_generated_WebRiskService_SubmitUri_async - */ + /** + * Submits a URI suspected of containing malicious content to be reviewed. + * Returns a google.longrunning.Operation which, once the review is complete, + * is updated with its result. You can use the [Pub/Sub API] + * (https://cloud.google.com/pubsub) to receive notifications for the returned + * Operation. If the result verifies the existence of malicious content, the + * site will be added to the [Google's Social Engineering lists] + * (https://support.google.com/webmasters/answer/6350487/) in order to + * protect users that could get exposed to this threat in the future. Only + * allowlisted projects can use this method during Early Access. Please reach + * out to Sales or your customer engineer to obtain access. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project that is making the submission. This + * string is in the format "projects/{project_number}". + * @param {google.cloud.webrisk.v1.Submission} request.submission + * Required. The submission that contains the URI to be scanned. + * @param {google.cloud.webrisk.v1.ThreatInfo} request.threatInfo + * Provides additional information about the submission. + * @param {google.cloud.webrisk.v1.ThreatDiscovery} request.threatDiscovery + * Provides additional information about how the submission was discovered. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_risk_service.submit_uri.js + * region_tag:webrisk_v1_generated_WebRiskService_SubmitUri_async + */ submitUri( - request?: protos.google.cloud.webrisk.v1.ISubmitUriRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.webrisk.v1.ISubmitUriRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ISubmitUriMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; submitUri( - request: protos.google.cloud.webrisk.v1.ISubmitUriRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1.ISubmitUriRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ISubmitUriMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; submitUri( - request: protos.google.cloud.webrisk.v1.ISubmitUriRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1.ISubmitUriRequest, + callback: Callback< + LROperation< + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ISubmitUriMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; submitUri( - request?: protos.google.cloud.webrisk.v1.ISubmitUriRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.webrisk.v1.ISubmitUriRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ISubmitUriMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ISubmitUriMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ISubmitUriMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ISubmitUriMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('submitUri response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('submitUri request %j', request); - return this.innerApiCalls.submitUri(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('submitUri response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .submitUri(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ISubmitUriMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('submitUri response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `submitUri()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_risk_service.submit_uri.js - * region_tag:webrisk_v1_generated_WebRiskService_SubmitUri_async - */ - async checkSubmitUriProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `submitUri()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_risk_service.submit_uri.js + * region_tag:webrisk_v1_generated_WebRiskService_SubmitUri_async + */ + async checkSubmitUriProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.webrisk.v1.Submission, + protos.google.cloud.webrisk.v1.SubmitUriMetadata + > + > { this._log.info('submitUri long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.submitUri, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.submitUri, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.webrisk.v1.Submission, + protos.google.cloud.webrisk.v1.SubmitUriMetadata + >; } -/** + /** * Gets the latest state of a long-running operation. Clients can use this * method to poll the operation result at intervals as recommended by the API * service. @@ -924,22 +1207,22 @@ export class WebRiskServiceClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -974,15 +1257,15 @@ export class WebRiskServiceClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -1016,7 +1299,7 @@ export class WebRiskServiceClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -1029,25 +1312,24 @@ export class WebRiskServiceClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.cancelOperation(request, options, callback); } - /** * Deletes a long-running operation. This method indicates that the client is * no longer interested in the operation result. It does not cancel the @@ -1086,22 +1368,22 @@ export class WebRiskServiceClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -1115,7 +1397,7 @@ export class WebRiskServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -1140,7 +1422,7 @@ export class WebRiskServiceClient { */ close(): Promise { if (this.webRiskServiceStub && !this._terminated) { - return this.webRiskServiceStub.then(stub => { + return this.webRiskServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -1149,4 +1431,4 @@ export class WebRiskServiceClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-webrisk/src/v1beta1/index.ts b/packages/google-cloud-webrisk/src/v1beta1/index.ts index 617583cdc0fb..60880abd02ee 100644 --- a/packages/google-cloud-webrisk/src/v1beta1/index.ts +++ b/packages/google-cloud-webrisk/src/v1beta1/index.ts @@ -16,4 +16,4 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {WebRiskServiceV1Beta1Client} from './web_risk_service_v1_beta1_client'; +export { WebRiskServiceV1Beta1Client } from './web_risk_service_v1_beta1_client'; diff --git a/packages/google-cloud-webrisk/src/v1beta1/web_risk_service_v1_beta1_client.ts b/packages/google-cloud-webrisk/src/v1beta1/web_risk_service_v1_beta1_client.ts index 96ac56e76a4b..0c4d5d70772d 100644 --- a/packages/google-cloud-webrisk/src/v1beta1/web_risk_service_v1_beta1_client.ts +++ b/packages/google-cloud-webrisk/src/v1beta1/web_risk_service_v1_beta1_client.ts @@ -18,11 +18,16 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -45,7 +50,7 @@ export class WebRiskServiceV1Beta1Client { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('web-risk'); @@ -58,8 +63,8 @@ export class WebRiskServiceV1Beta1Client { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - webRiskServiceV1Beta1Stub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + webRiskServiceV1Beta1Stub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of WebRiskServiceV1Beta1Client. @@ -100,21 +105,43 @@ export class WebRiskServiceV1Beta1Client { * const client = new WebRiskServiceV1Beta1Client({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof WebRiskServiceV1Beta1Client; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + const staticMembers = this + .constructor as typeof WebRiskServiceV1Beta1Client; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'webrisk.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -139,7 +166,7 @@ export class WebRiskServiceV1Beta1Client { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -153,10 +180,7 @@ export class WebRiskServiceV1Beta1Client { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -175,8 +199,11 @@ export class WebRiskServiceV1Beta1Client { // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -207,36 +234,45 @@ export class WebRiskServiceV1Beta1Client { // Put together the "service stub" for // google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1. this.webRiskServiceV1Beta1Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.webrisk.v1beta1 + .WebRiskServiceV1Beta1, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const webRiskServiceV1Beta1StubMethods = - ['computeThreatListDiff', 'searchUris', 'searchHashes']; + const webRiskServiceV1Beta1StubMethods = [ + 'computeThreatListDiff', + 'searchUris', + 'searchHashes', + ]; for (const methodName of webRiskServiceV1Beta1StubMethods) { const callPromise = this.webRiskServiceV1Beta1Stub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -251,8 +287,14 @@ export class WebRiskServiceV1Beta1Client { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'webrisk.googleapis.com'; } @@ -263,8 +305,14 @@ export class WebRiskServiceV1Beta1Client { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'webrisk.googleapis.com'; } @@ -295,9 +343,7 @@ export class WebRiskServiceV1Beta1Client { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -306,8 +352,9 @@ export class WebRiskServiceV1Beta1Client { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -318,289 +365,414 @@ export class WebRiskServiceV1Beta1Client { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets the most recent threat list diffs. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.webrisk.v1beta1.ThreatType} request.threatType - * The ThreatList to update. - * @param {Buffer} request.versionToken - * The current version token of the client for the requested list (the - * client version that was received from the last successful diff). - * @param {google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest.Constraints} request.constraints - * Required. The constraints associated with this request. - * @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 protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse|ComputeThreatListDiffResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/web_risk_service_v1_beta1.compute_threat_list_diff.js - * region_tag:webrisk_v1beta1_generated_WebRiskServiceV1Beta1_ComputeThreatListDiff_async - */ + /** + * Gets the most recent threat list diffs. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.webrisk.v1beta1.ThreatType} request.threatType + * The ThreatList to update. + * @param {Buffer} request.versionToken + * The current version token of the client for the requested list (the + * client version that was received from the last successful diff). + * @param {google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest.Constraints} request.constraints + * Required. The constraints associated with this request. + * @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 protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse|ComputeThreatListDiffResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/web_risk_service_v1_beta1.compute_threat_list_diff.js + * region_tag:webrisk_v1beta1_generated_WebRiskServiceV1Beta1_ComputeThreatListDiff_async + */ computeThreatListDiff( - request?: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, + ( + | protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest + | undefined + ), + {} | undefined, + ] + >; computeThreatListDiff( - request: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, + | protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest + | null + | undefined, + {} | null | undefined + >, + ): void; computeThreatListDiff( - request: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, - callback: Callback< - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, + callback: Callback< + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, + | protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest + | null + | undefined, + {} | null | undefined + >, + ): void; computeThreatListDiff( - request?: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, + | protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, + ( + | protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('computeThreatListDiff request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, + | protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('computeThreatListDiff response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.computeThreatListDiff(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, - protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest|undefined, - {}|undefined - ]) => { - this._log.info('computeThreatListDiff response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .computeThreatListDiff(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, + ( + | protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('computeThreatListDiff response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * This method is used to check whether a URI is on a given threatList. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.uri - * Required. The URI to be checked for matches. - * @param {number[]} request.threatTypes - * Required. The ThreatLists to search in. - * @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 protos.google.cloud.webrisk.v1beta1.SearchUrisResponse|SearchUrisResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/web_risk_service_v1_beta1.search_uris.js - * region_tag:webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchUris_async - */ + /** + * This method is used to check whether a URI is on a given threatList. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.uri + * Required. The URI to be checked for matches. + * @param {number[]} request.threatTypes + * Required. The ThreatLists to search in. + * @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 protos.google.cloud.webrisk.v1beta1.SearchUrisResponse|SearchUrisResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/web_risk_service_v1_beta1.search_uris.js + * region_tag:webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchUris_async + */ searchUris( - request?: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest | undefined, + {} | undefined, + ] + >; searchUris( - request: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest | null | undefined, + {} | null | undefined + >, + ): void; searchUris( - request: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, - callback: Callback< - protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, + callback: Callback< + protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest | null | undefined, + {} | null | undefined + >, + ): void; searchUris( - request?: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('searchUris request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, + | protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('searchUris response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.searchUris(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, - protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest|undefined, - {}|undefined - ]) => { - this._log.info('searchUris response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .searchUris(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, + protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest | undefined, + {} | undefined, + ]) => { + this._log.info('searchUris response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets the full hashes that match the requested hash prefix. - * This is used after a hash prefix is looked up in a threatList - * and there is a match. The client side threatList only holds partial hashes - * so the client must query this method to determine if there is a full - * hash match of a threat. - * - * @param {Object} request - * The request object that will be sent. - * @param {Buffer} request.hashPrefix - * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 - * hash. For JSON requests, this field is base64-encoded. - * @param {number[]} request.threatTypes - * Required. The ThreatLists to search in. - * @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 protos.google.cloud.webrisk.v1beta1.SearchHashesResponse|SearchHashesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/web_risk_service_v1_beta1.search_hashes.js - * region_tag:webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchHashes_async - */ + /** + * Gets the full hashes that match the requested hash prefix. + * This is used after a hash prefix is looked up in a threatList + * and there is a match. The client side threatList only holds partial hashes + * so the client must query this method to determine if there is a full + * hash match of a threat. + * + * @param {Object} request + * The request object that will be sent. + * @param {Buffer} request.hashPrefix + * A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 + * hash. For JSON requests, this field is base64-encoded. + * @param {number[]} request.threatTypes + * Required. The ThreatLists to search in. + * @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 protos.google.cloud.webrisk.v1beta1.SearchHashesResponse|SearchHashesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/web_risk_service_v1_beta1.search_hashes.js + * region_tag:webrisk_v1beta1_generated_WebRiskServiceV1Beta1_SearchHashes_async + */ searchHashes( - request?: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest | undefined, + {} | undefined, + ] + >; searchHashes( - request: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, + | protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; searchHashes( - request: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, - callback: Callback< - protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, + callback: Callback< + protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, + | protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; searchHashes( - request?: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, + | protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('searchHashes request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, + | protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('searchHashes response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.searchHashes(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, - protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest|undefined, - {}|undefined - ]) => { - this._log.info('searchHashes response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .searchHashes(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, + protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest | undefined, + {} | undefined, + ]) => { + this._log.info('searchHashes response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } - /** * Terminate the gRPC channel and close the client. * @@ -609,7 +781,7 @@ export class WebRiskServiceV1Beta1Client { */ close(): Promise { if (this.webRiskServiceV1Beta1Stub && !this._terminated) { - return this.webRiskServiceV1Beta1Stub.then(stub => { + return this.webRiskServiceV1Beta1Stub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -617,4 +789,4 @@ export class WebRiskServiceV1Beta1Client { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-webrisk/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-webrisk/system-test/fixtures/sample/src/index.ts index d351f429186a..879bbd6bd896 100644 --- a/packages/google-cloud-webrisk/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-webrisk/system-test/fixtures/sample/src/index.ts @@ -16,7 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {WebRiskServiceClient} from '@google-cloud/web-risk'; +import { WebRiskServiceClient } from '@google-cloud/web-risk'; // check that the client class type name can be used function doStuffWithWebRiskServiceClient(client: WebRiskServiceClient) { diff --git a/packages/google-cloud-webrisk/system-test/install.ts b/packages/google-cloud-webrisk/system-test/install.ts index 394f3362d203..ccf167042d2e 100644 --- a/packages/google-cloud-webrisk/system-test/install.ts +++ b/packages/google-cloud-webrisk/system-test/install.ts @@ -16,34 +16,36 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { + it('TypeScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts', + ).toString(), + }, }; await packNTest(options); }); - it('JavaScript code', async function() { + it('JavaScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } + cjs: readFileSync( + './system-test/fixtures/sample/src/index.js', + ).toString(), + }, }; await packNTest(options); }); - }); diff --git a/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1.ts b/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1.ts index 498721e0ed13..0615d64f2d2c 100644 --- a/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1.ts +++ b/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1.ts @@ -19,1007 +19,1232 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as webriskserviceModule from '../src'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import { protobuf, LROperation, operationsProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); } -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.WebRiskServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'webrisk.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'webrisk.googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = webriskserviceModule.v1.WebRiskServiceClient.servicePath; - assert.strictEqual(servicePath, 'webrisk.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + it('has universeDomain', () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = webriskserviceModule.v1.WebRiskServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'webrisk.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'webrisk.example.com'); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + webriskserviceModule.v1.WebRiskServiceClient.servicePath; + assert.strictEqual(servicePath, 'webrisk.googleapis.com'); + assert(stub.called); + stub.restore(); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'webrisk.example.com'); - }); + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + webriskserviceModule.v1.WebRiskServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'webrisk.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'webrisk.example.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new webriskserviceModule.v1.WebRiskServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'webrisk.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'webrisk.example.com'); + }); - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new webriskserviceModule.v1.WebRiskServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'webrisk.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new webriskserviceModule.v1.WebRiskServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new webriskserviceModule.v1.WebRiskServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'webrisk.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('has port', () => { - const port = webriskserviceModule.v1.WebRiskServiceClient.port; - assert(port); - assert(typeof port === 'number'); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'webrisk.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('should create a client with no option', () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient(); - assert(client); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new webriskserviceModule.v1.WebRiskServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with gRPC fallback', () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - fallback: true, - }); - assert(client); - }); + it('has port', () => { + const port = webriskserviceModule.v1.WebRiskServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webRiskServiceStub, undefined); - await client.initialize(); - assert(client.webRiskServiceStub); - }); + it('should create a client with no option', () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient(); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.webRiskServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with gRPC fallback', () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webRiskServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.webRiskServiceStub, undefined); + await client.initialize(); + assert(client.webRiskServiceStub); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the initialized client', (done) => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.webRiskServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has close method for the non-initialized client', (done) => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.webRiskServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('computeThreatListDiff', () => { - it('invokes computeThreatListDiff without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.ComputeThreatListDiffResponse() - ); - client.innerApiCalls.computeThreatListDiff = stubSimpleCall(expectedResponse); - const [response] = await client.computeThreatListDiff(request); - assert.deepStrictEqual(response, expectedResponse); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes computeThreatListDiff without error using callback', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.ComputeThreatListDiffResponse() - ); - client.innerApiCalls.computeThreatListDiff = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.computeThreatListDiff( - request, - (err?: Error|null, result?: protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); - it('invokes computeThreatListDiff with error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.computeThreatListDiff = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.computeThreatListDiff(request), expectedError); - }); + describe('computeThreatListDiff', () => { + it('invokes computeThreatListDiff without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.ComputeThreatListDiffResponse(), + ); + client.innerApiCalls.computeThreatListDiff = + stubSimpleCall(expectedResponse); + const [response] = await client.computeThreatListDiff(request); + assert.deepStrictEqual(response, expectedResponse); + }); - it('invokes computeThreatListDiff with closed client', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.computeThreatListDiff(request), expectedError); - }); + it('invokes computeThreatListDiff without error using callback', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.ComputeThreatListDiffResponse(), + ); + client.innerApiCalls.computeThreatListDiff = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.computeThreatListDiff( + request, + ( + err?: Error | null, + result?: protos.google.cloud.webrisk.v1.IComputeThreatListDiffResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); }); - describe('searchUris', () => { - it('invokes searchUris without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchUrisRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchUrisResponse() - ); - client.innerApiCalls.searchUris = stubSimpleCall(expectedResponse); - const [response] = await client.searchUris(request); - assert.deepStrictEqual(response, expectedResponse); - }); + it('invokes computeThreatListDiff with error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.computeThreatListDiff = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.computeThreatListDiff(request), + expectedError, + ); + }); - it('invokes searchUris without error using callback', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchUrisRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchUrisResponse() - ); - client.innerApiCalls.searchUris = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchUris( - request, - (err?: Error|null, result?: protos.google.cloud.webrisk.v1.ISearchUrisResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); + it('invokes computeThreatListDiff with closed client', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.ComputeThreatListDiffRequest(), + ); + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.computeThreatListDiff(request), + expectedError, + ); + }); + }); - it('invokes searchUris with error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchUrisRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.searchUris = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchUris(request), expectedError); - }); + describe('searchUris', () => { + it('invokes searchUris without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchUrisRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchUrisResponse(), + ); + client.innerApiCalls.searchUris = stubSimpleCall(expectedResponse); + const [response] = await client.searchUris(request); + assert.deepStrictEqual(response, expectedResponse); + }); - it('invokes searchUris with closed client', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchUrisRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.searchUris(request), expectedError); - }); + it('invokes searchUris without error using callback', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchUrisRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchUrisResponse(), + ); + client.innerApiCalls.searchUris = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchUris( + request, + ( + err?: Error | null, + result?: protos.google.cloud.webrisk.v1.ISearchUrisResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); }); - describe('searchHashes', () => { - it('invokes searchHashes without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchHashesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchHashesResponse() - ); - client.innerApiCalls.searchHashes = stubSimpleCall(expectedResponse); - const [response] = await client.searchHashes(request); - assert.deepStrictEqual(response, expectedResponse); - }); + it('invokes searchUris with error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchUrisRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.searchUris = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.searchUris(request), expectedError); + }); - it('invokes searchHashes without error using callback', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchHashesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchHashesResponse() - ); - client.innerApiCalls.searchHashes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchHashes( - request, - (err?: Error|null, result?: protos.google.cloud.webrisk.v1.ISearchHashesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); + it('invokes searchUris with closed client', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchUrisRequest(), + ); + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.searchUris(request), expectedError); + }); + }); - it('invokes searchHashes with error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchHashesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.searchHashes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchHashes(request), expectedError); - }); + describe('searchHashes', () => { + it('invokes searchHashes without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchHashesRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchHashesResponse(), + ); + client.innerApiCalls.searchHashes = stubSimpleCall(expectedResponse); + const [response] = await client.searchHashes(request); + assert.deepStrictEqual(response, expectedResponse); + }); - it('invokes searchHashes with closed client', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SearchHashesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.searchHashes(request), expectedError); - }); + it('invokes searchHashes without error using callback', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchHashesRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchHashesResponse(), + ); + client.innerApiCalls.searchHashes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchHashes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.webrisk.v1.ISearchHashesResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); }); - describe('createSubmission', () => { - it('invokes createSubmission without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.CreateSubmissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.CreateSubmissionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.Submission() - ); - client.innerApiCalls.createSubmission = stubSimpleCall(expectedResponse); - const [response] = await client.createSubmission(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSubmission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSubmission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes searchHashes with error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchHashesRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.searchHashes = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.searchHashes(request), expectedError); + }); - it('invokes createSubmission without error using callback', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.CreateSubmissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.CreateSubmissionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1.Submission() - ); - client.innerApiCalls.createSubmission = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSubmission( - request, - (err?: Error|null, result?: protos.google.cloud.webrisk.v1.ISubmission|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSubmission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSubmission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes searchHashes with closed client', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SearchHashesRequest(), + ); + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.searchHashes(request), expectedError); + }); + }); - it('invokes createSubmission with error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.CreateSubmissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.CreateSubmissionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSubmission = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSubmission(request), expectedError); - const actualRequest = (client.innerApiCalls.createSubmission as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSubmission as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('createSubmission', () => { + it('invokes createSubmission without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.CreateSubmissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.webrisk.v1.CreateSubmissionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.Submission(), + ); + client.innerApiCalls.createSubmission = stubSimpleCall(expectedResponse); + const [response] = await client.createSubmission(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSubmission as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSubmission as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createSubmission with closed client', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.CreateSubmissionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.CreateSubmissionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createSubmission(request), expectedError); - }); + it('invokes createSubmission without error using callback', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.CreateSubmissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.webrisk.v1.CreateSubmissionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1.Submission(), + ); + client.innerApiCalls.createSubmission = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSubmission( + request, + ( + err?: Error | null, + result?: protos.google.cloud.webrisk.v1.ISubmission | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSubmission as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSubmission as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('submitUri', () => { - it('invokes submitUri without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SubmitUriRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.SubmitUriRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.submitUri = stubLongRunningCall(expectedResponse); - const [operation] = await client.submitUri(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSubmission with error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.CreateSubmissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.webrisk.v1.CreateSubmissionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSubmission = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createSubmission(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createSubmission as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSubmission as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes submitUri without error using callback', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SubmitUriRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.SubmitUriRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.submitUri = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.submitUri( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createSubmission with closed client', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.CreateSubmissionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.webrisk.v1.CreateSubmissionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createSubmission(request), expectedError); + }); + }); - it('invokes submitUri with call error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SubmitUriRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.SubmitUriRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.submitUri = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.submitUri(request), expectedError); - const actualRequest = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('submitUri', () => { + it('invokes submitUri without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SubmitUriRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.webrisk.v1.SubmitUriRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.submitUri = stubLongRunningCall(expectedResponse); + const [operation] = await client.submitUri(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.submitUri as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.submitUri as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes submitUri with LRO error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1.SubmitUriRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.webrisk.v1.SubmitUriRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.submitUri = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.submitUri(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.submitUri as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes submitUri without error using callback', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SubmitUriRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.webrisk.v1.SubmitUriRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.submitUri = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.submitUri( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ISubmitUriMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.webrisk.v1.ISubmission, + protos.google.cloud.webrisk.v1.ISubmitUriMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.submitUri as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.submitUri as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkSubmitUriProgress without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} + it('invokes submitUri with call error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SubmitUriRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.webrisk.v1.SubmitUriRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.submitUri = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.submitUri(request), expectedError); + const actualRequest = ( + client.innerApiCalls.submitUri as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.submitUri as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkSubmitUriProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes submitUri with LRO error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1.SubmitUriRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.webrisk.v1.SubmitUriRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.submitUri = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.submitUri(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.submitUri as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.submitUri as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkSubmitUriProgress with error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); + it('invokes checkSubmitUriProgress without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkSubmitUriProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkSubmitUriProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + + it('invokes checkSubmitUriProgress with error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.checkSubmitUriProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('invokes getOperation without error using callback', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + it('invokes getOperation with error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.IOperation[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.IOperation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + }); - describe('Path templates', () => { - - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new webriskserviceModule.v1.WebRiskServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); + describe('Path templates', () => { + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new webriskserviceModule.v1.WebRiskServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1_beta1_v1beta1.ts b/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1_beta1_v1beta1.ts index 0bb2adb6490b..2c3d42af97d4 100644 --- a/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1_beta1_v1beta1.ts +++ b/packages/google-cloud-webrisk/test/gapic_web_risk_service_v1_beta1_v1beta1.ts @@ -19,421 +19,528 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as webriskservicev1beta1Module from '../src'; -import {protobuf} from 'google-gax'; +import { protobuf } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } describe('v1beta1.WebRiskServiceV1Beta1Client', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'webrisk.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'webrisk.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client.servicePath; - assert.strictEqual(servicePath, 'webrisk.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'webrisk.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'webrisk.example.com'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client + .servicePath; + assert.strictEqual(servicePath, 'webrisk.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'webrisk.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'webrisk.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'webrisk.example.com'); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'webrisk.example.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'webrisk.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'webrisk.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'webrisk.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('has port', () => { - const port = webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client.port; - assert(port); - assert(typeof port === 'number'); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'webrisk.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('should create a client with no option', () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client(); - assert(client); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with gRPC fallback', () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - fallback: true, - }); - assert(client); - }); + it('has port', () => { + const port = + webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webRiskServiceV1Beta1Stub, undefined); - await client.initialize(); - assert(client.webRiskServiceV1Beta1Stub); - }); + it('should create a client with no option', () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client(); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.webRiskServiceV1Beta1Stub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('should create a client with gRPC fallback', () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + fallback: true, }); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webRiskServiceV1Beta1Stub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has initialize method and supports deferred initialization', async () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.webRiskServiceV1Beta1Stub, undefined); + await client.initialize(); + assert(client.webRiskServiceV1Beta1Stub); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the initialized client', (done) => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + client.initialize().catch((err) => { + throw err; + }); + assert(client.webRiskServiceV1Beta1Stub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('computeThreatListDiff', () => { - it('invokes computeThreatListDiff without error', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse() - ); - client.innerApiCalls.computeThreatListDiff = stubSimpleCall(expectedResponse); - const [response] = await client.computeThreatListDiff(request); - assert.deepStrictEqual(response, expectedResponse); + it('has close method for the non-initialized client', (done) => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.webRiskServiceV1Beta1Stub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); - it('invokes computeThreatListDiff without error using callback', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse() - ); - client.innerApiCalls.computeThreatListDiff = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.computeThreatListDiff( - request, - (err?: Error|null, result?: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes computeThreatListDiff with error', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.computeThreatListDiff = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.computeThreatListDiff(request), expectedError); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('computeThreatListDiff', () => { + it('invokes computeThreatListDiff without error', async () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse(), + ); + client.innerApiCalls.computeThreatListDiff = + stubSimpleCall(expectedResponse); + const [response] = await client.computeThreatListDiff(request); + assert.deepStrictEqual(response, expectedResponse); + }); - it('invokes computeThreatListDiff with closed client', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.computeThreatListDiff(request), expectedError); + it('invokes computeThreatListDiff without error using callback', async () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffResponse(), + ); + client.innerApiCalls.computeThreatListDiff = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.computeThreatListDiff( + request, + ( + err?: Error | null, + result?: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); }); - describe('searchUris', () => { - it('invokes searchUris without error', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchUrisResponse() - ); - client.innerApiCalls.searchUris = stubSimpleCall(expectedResponse); - const [response] = await client.searchUris(request); - assert.deepStrictEqual(response, expectedResponse); + it('invokes computeThreatListDiff with error', async () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.computeThreatListDiff = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.computeThreatListDiff(request), + expectedError, + ); + }); - it('invokes searchUris without error using callback', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchUrisResponse() - ); - client.innerApiCalls.searchUris = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchUris( - request, - (err?: Error|null, result?: protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); + it('invokes computeThreatListDiff with closed client', async () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.ComputeThreatListDiffRequest(), + ); + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.computeThreatListDiff(request), + expectedError, + ); + }); + }); + + describe('searchUris', () => { + it('invokes searchUris without error', async () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchUrisResponse(), + ); + client.innerApiCalls.searchUris = stubSimpleCall(expectedResponse); + const [response] = await client.searchUris(request); + assert.deepStrictEqual(response, expectedResponse); + }); - it('invokes searchUris with error', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.searchUris = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchUris(request), expectedError); + it('invokes searchUris without error using callback', async () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchUrisResponse(), + ); + client.innerApiCalls.searchUris = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchUris( + request, + ( + err?: Error | null, + result?: protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); - it('invokes searchUris with closed client', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.searchUris(request), expectedError); + it('invokes searchUris with error', async () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.searchUris = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.searchUris(request), expectedError); }); - describe('searchHashes', () => { - it('invokes searchHashes without error', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchHashesResponse() - ); - client.innerApiCalls.searchHashes = stubSimpleCall(expectedResponse); - const [response] = await client.searchHashes(request); - assert.deepStrictEqual(response, expectedResponse); + it('invokes searchUris with closed client', async () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchUrisRequest(), + ); + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.searchUris(request), expectedError); + }); + }); + + describe('searchHashes', () => { + it('invokes searchHashes without error', async () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchHashesResponse(), + ); + client.innerApiCalls.searchHashes = stubSimpleCall(expectedResponse); + const [response] = await client.searchHashes(request); + assert.deepStrictEqual(response, expectedResponse); + }); - it('invokes searchHashes without error using callback', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchHashesResponse() - ); - client.innerApiCalls.searchHashes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchHashes( - request, - (err?: Error|null, result?: protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); + it('invokes searchHashes without error using callback', async () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchHashesResponse(), + ); + client.innerApiCalls.searchHashes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchHashes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); - it('invokes searchHashes with error', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.searchHashes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.searchHashes(request), expectedError); + it('invokes searchHashes with error', async () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.searchHashes = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.searchHashes(request), expectedError); + }); - it('invokes searchHashes with closed client', async () => { - const client = new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.searchHashes(request), expectedError); + it('invokes searchHashes with closed client', async () => { + const client = + new webriskservicev1beta1Module.v1beta1.WebRiskServiceV1Beta1Client({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.webrisk.v1beta1.SearchHashesRequest(), + ); + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.searchHashes(request), expectedError); }); + }); }); diff --git a/packages/google-cloud-webrisk/webpack.config.js b/packages/google-cloud-webrisk/webpack.config.js index 99dbba5a896d..c45917670d0f 100644 --- a/packages/google-cloud-webrisk/webpack.config.js +++ b/packages/google-cloud-webrisk/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2026 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. diff --git a/packages/google-cloud-websecurityscanner/.eslintignore b/packages/google-cloud-websecurityscanner/.eslintignore new file mode 100644 index 000000000000..cfc348ec4d11 --- /dev/null +++ b/packages/google-cloud-websecurityscanner/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/packages/google-cloud-websecurityscanner/.eslintrc.json b/packages/google-cloud-websecurityscanner/.eslintrc.json new file mode 100644 index 000000000000..3e8d97ccb390 --- /dev/null +++ b/packages/google-cloud-websecurityscanner/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "./node_modules/gts", + "root": true +} diff --git a/packages/google-cloud-websecurityscanner/README.md b/packages/google-cloud-websecurityscanner/README.md index 74bdcbfb345c..828ca39d9edf 100644 --- a/packages/google-cloud-websecurityscanner/README.md +++ b/packages/google-cloud-websecurityscanner/README.md @@ -133,7 +133,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-websecurityscanner/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). Please note that this `README.md` and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) @@ -143,7 +143,7 @@ are generated from a central template. Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-websecurityscanner/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project diff --git a/packages/google-cloud-websecurityscanner/protos/protos.d.ts b/packages/google-cloud-websecurityscanner/protos/protos.d.ts index 466e409d85aa..aef3554ffcfc 100644 --- a/packages/google-cloud-websecurityscanner/protos/protos.d.ts +++ b/packages/google-cloud-websecurityscanner/protos/protos.d.ts @@ -13982,6 +13982,9 @@ export namespace google { /** CommonLanguageSettings destinations */ destinations?: (google.api.ClientLibraryDestination[]|null); + + /** CommonLanguageSettings selectiveGapicGeneration */ + selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); } /** Represents a CommonLanguageSettings. */ @@ -13999,6 +14002,9 @@ export namespace google { /** CommonLanguageSettings destinations. */ public destinations: google.api.ClientLibraryDestination[]; + /** CommonLanguageSettings selectiveGapicGeneration. */ + public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @param [properties] Properties to set @@ -14699,6 +14705,9 @@ export namespace google { /** PythonSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures */ + experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); } /** Represents a PythonSettings. */ @@ -14713,6 +14722,9 @@ export namespace google { /** PythonSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** PythonSettings experimentalFeatures. */ + public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + /** * Creates a new PythonSettings instance using the specified properties. * @param [properties] Properties to set @@ -14791,6 +14803,118 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace PythonSettings { + + /** Properties of an ExperimentalFeatures. */ + interface IExperimentalFeatures { + + /** ExperimentalFeatures restAsyncIoEnabled */ + restAsyncIoEnabled?: (boolean|null); + + /** ExperimentalFeatures protobufPythonicTypesEnabled */ + protobufPythonicTypesEnabled?: (boolean|null); + + /** ExperimentalFeatures unversionedPackageDisabled */ + unversionedPackageDisabled?: (boolean|null); + } + + /** Represents an ExperimentalFeatures. */ + class ExperimentalFeatures implements IExperimentalFeatures { + + /** + * Constructs a new ExperimentalFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); + + /** ExperimentalFeatures restAsyncIoEnabled. */ + public restAsyncIoEnabled: boolean; + + /** ExperimentalFeatures protobufPythonicTypesEnabled. */ + public protobufPythonicTypesEnabled: boolean; + + /** ExperimentalFeatures unversionedPackageDisabled. */ + public unversionedPackageDisabled: boolean; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns ExperimentalFeatures instance + */ + public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Verifies an ExperimentalFeatures 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 an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExperimentalFeatures + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @param message ExperimentalFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExperimentalFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Properties of a NodeSettings. */ interface INodeSettings { @@ -15117,6 +15241,9 @@ export namespace google { /** GoSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); } /** Represents a GoSettings. */ @@ -15131,6 +15258,9 @@ export namespace google { /** GoSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** GoSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + /** * Creates a new GoSettings instance using the specified properties. * @param [properties] Properties to set @@ -15455,6 +15585,109 @@ export namespace google { PACKAGE_MANAGER = 20 } + /** Properties of a SelectiveGapicGeneration. */ + interface ISelectiveGapicGeneration { + + /** SelectiveGapicGeneration methods */ + methods?: (string[]|null); + + /** SelectiveGapicGeneration generateOmittedAsInternal */ + generateOmittedAsInternal?: (boolean|null); + } + + /** Represents a SelectiveGapicGeneration. */ + class SelectiveGapicGeneration implements ISelectiveGapicGeneration { + + /** + * Constructs a new SelectiveGapicGeneration. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ISelectiveGapicGeneration); + + /** SelectiveGapicGeneration methods. */ + public methods: string[]; + + /** SelectiveGapicGeneration generateOmittedAsInternal. */ + public generateOmittedAsInternal: boolean; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectiveGapicGeneration instance + */ + public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Verifies a SelectiveGapicGeneration 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 SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectiveGapicGeneration + */ + public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @param message SelectiveGapicGeneration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** LaunchStage enum. */ enum LaunchStage { LAUNCH_STAGE_UNSPECIFIED = 0, @@ -15571,6 +15804,7 @@ export namespace google { /** Edition enum. */ enum Edition { EDITION_UNKNOWN = 0, + EDITION_LEGACY = 900, EDITION_PROTO2 = 998, EDITION_PROTO3 = 999, EDITION_2023 = 1000, @@ -15601,6 +15835,9 @@ export namespace google { /** FileDescriptorProto weakDependency */ weakDependency?: (number[]|null); + /** FileDescriptorProto optionDependency */ + optionDependency?: (string[]|null); + /** FileDescriptorProto messageType */ messageType?: (google.protobuf.IDescriptorProto[]|null); @@ -15650,6 +15887,9 @@ export namespace google { /** FileDescriptorProto weakDependency. */ public weakDependency: number[]; + /** FileDescriptorProto optionDependency. */ + public optionDependency: string[]; + /** FileDescriptorProto messageType. */ public messageType: google.protobuf.IDescriptorProto[]; @@ -15784,6 +16024,9 @@ export namespace google { /** DescriptorProto reservedName */ reservedName?: (string[]|null); + + /** DescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents a DescriptorProto. */ @@ -15825,6 +16068,9 @@ export namespace google { /** DescriptorProto reservedName. */ public reservedName: string[]; + /** DescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new DescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -16672,6 +16918,9 @@ export namespace google { /** EnumDescriptorProto reservedName */ reservedName?: (string[]|null); + + /** EnumDescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents an EnumDescriptorProto. */ @@ -16698,6 +16947,9 @@ export namespace google { /** EnumDescriptorProto reservedName. */ public reservedName: string[]; + /** EnumDescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -17632,6 +17884,9 @@ export namespace google { /** FieldOptions features */ features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); @@ -17687,6 +17942,9 @@ export namespace google { /** FieldOptions features. */ public features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -17907,6 +18165,121 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a FeatureSupport. */ + interface IFeatureSupport { + + /** FeatureSupport editionIntroduced */ + editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport editionDeprecated */ + editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport deprecationWarning */ + deprecationWarning?: (string|null); + + /** FeatureSupport editionRemoved */ + editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSupport. */ + class FeatureSupport implements IFeatureSupport { + + /** + * Constructs a new FeatureSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); + + /** FeatureSupport editionIntroduced. */ + public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport editionDeprecated. */ + public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport deprecationWarning. */ + public deprecationWarning: string; + + /** FeatureSupport editionRemoved. */ + public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSupport instance + */ + public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Verifies a FeatureSupport 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 FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSupport + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @param message FeatureSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of an OneofOptions. */ @@ -18145,6 +18518,9 @@ export namespace google { /** EnumValueOptions debugRedact */ debugRedact?: (boolean|null); + /** EnumValueOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); } @@ -18167,6 +18543,9 @@ export namespace google { /** EnumValueOptions debugRedact. */ public debugRedact: boolean; + /** EnumValueOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -18756,6 +19135,12 @@ export namespace google { /** FeatureSet jsonFormat */ jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); + + /** FeatureSet enforceNamingStyle */ + enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); + + /** FeatureSet defaultSymbolVisibility */ + defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); } /** Represents a FeatureSet. */ @@ -18785,6 +19170,12 @@ export namespace google { /** FeatureSet jsonFormat. */ public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); + /** FeatureSet enforceNamingStyle. */ + public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); + + /** FeatureSet defaultSymbolVisibility. */ + public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); + /** * Creates a new FeatureSet instance using the specified properties. * @param [properties] Properties to set @@ -18907,6 +19298,116 @@ export namespace google { ALLOW = 1, LEGACY_BEST_EFFORT = 2 } + + /** EnforceNamingStyle enum. */ + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2 + } + + /** Properties of a VisibilityFeature. */ + interface IVisibilityFeature { + } + + /** Represents a VisibilityFeature. */ + class VisibilityFeature implements IVisibilityFeature { + + /** + * Constructs a new VisibilityFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns VisibilityFeature instance + */ + public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Verifies a VisibilityFeature 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 VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisibilityFeature + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @param message VisibilityFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisibilityFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisibilityFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VisibilityFeature { + + /** DefaultSymbolVisibility enum. */ + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + EXPORT_ALL = 1, + EXPORT_TOP_LEVEL = 2, + LOCAL_ALL = 3, + STRICT = 4 + } + } } /** Properties of a FeatureSetDefaults. */ @@ -19026,8 +19527,11 @@ export namespace google { /** FeatureSetEditionDefault edition */ edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - /** FeatureSetEditionDefault features */ - features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures */ + overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures */ + fixedFeatures?: (google.protobuf.IFeatureSet|null); } /** Represents a FeatureSetEditionDefault. */ @@ -19042,8 +19546,11 @@ export namespace google { /** FeatureSetEditionDefault edition. */ public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - /** FeatureSetEditionDefault features. */ - public features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures. */ + public overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures. */ + public fixedFeatures?: (google.protobuf.IFeatureSet|null); /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -19576,6 +20083,13 @@ export namespace google { } } + /** SymbolVisibility enum. */ + enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2 + } + /** Properties of a Timestamp. */ interface ITimestamp { diff --git a/packages/google-cloud-websecurityscanner/protos/protos.js b/packages/google-cloud-websecurityscanner/protos/protos.js index 516fe4844ce7..c9772764e60a 100644 --- a/packages/google-cloud-websecurityscanner/protos/protos.js +++ b/packages/google-cloud-websecurityscanner/protos/protos.js @@ -34205,6 +34205,7 @@ * @interface ICommonLanguageSettings * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri * @property {Array.|null} [destinations] CommonLanguageSettings destinations + * @property {google.api.ISelectiveGapicGeneration|null} [selectiveGapicGeneration] CommonLanguageSettings selectiveGapicGeneration */ /** @@ -34239,6 +34240,14 @@ */ CommonLanguageSettings.prototype.destinations = $util.emptyArray; + /** + * CommonLanguageSettings selectiveGapicGeneration. + * @member {google.api.ISelectiveGapicGeneration|null|undefined} selectiveGapicGeneration + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.selectiveGapicGeneration = null; + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @function create @@ -34271,6 +34280,8 @@ writer.int32(message.destinations[i]); writer.ldelim(); } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -34322,6 +34333,10 @@ message.destinations.push(reader.int32()); break; } + case 3: { + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -34373,6 +34388,11 @@ break; } } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { + var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration); + if (error) + return "selectiveGapicGeneration." + error; + } return null; }; @@ -34415,6 +34435,11 @@ break; } } + if (object.selectiveGapicGeneration != null) { + if (typeof object.selectiveGapicGeneration !== "object") + throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration); + } return message; }; @@ -34433,8 +34458,10 @@ var object = {}; if (options.arrays || options.defaults) object.destinations = []; - if (options.defaults) + if (options.defaults) { object.referenceDocsUri = ""; + object.selectiveGapicGeneration = null; + } if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) object.referenceDocsUri = message.referenceDocsUri; if (message.destinations && message.destinations.length) { @@ -34442,6 +34469,8 @@ for (var j = 0; j < message.destinations.length; ++j) object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) + object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options); return object; }; @@ -36264,6 +36293,7 @@ * @memberof google.api * @interface IPythonSettings * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common + * @property {google.api.PythonSettings.IExperimentalFeatures|null} [experimentalFeatures] PythonSettings experimentalFeatures */ /** @@ -36289,6 +36319,14 @@ */ PythonSettings.prototype.common = null; + /** + * PythonSettings experimentalFeatures. + * @member {google.api.PythonSettings.IExperimentalFeatures|null|undefined} experimentalFeatures + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.experimentalFeatures = null; + /** * Creates a new PythonSettings instance using the specified properties. * @function create @@ -36315,6 +36353,8 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -36355,6 +36395,10 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -36395,6 +36439,11 @@ if (error) return "common." + error; } + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { + var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures); + if (error) + return "experimentalFeatures." + error; + } return null; }; @@ -36415,6 +36464,11 @@ throw TypeError(".google.api.PythonSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.experimentalFeatures != null) { + if (typeof object.experimentalFeatures !== "object") + throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures); + } return message; }; @@ -36431,10 +36485,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.common = null; + object.experimentalFeatures = null; + } if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) + object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options); return object; }; @@ -36464,6 +36522,258 @@ return typeUrlPrefix + "/google.api.PythonSettings"; }; + PythonSettings.ExperimentalFeatures = (function() { + + /** + * Properties of an ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @interface IExperimentalFeatures + * @property {boolean|null} [restAsyncIoEnabled] ExperimentalFeatures restAsyncIoEnabled + * @property {boolean|null} [protobufPythonicTypesEnabled] ExperimentalFeatures protobufPythonicTypesEnabled + * @property {boolean|null} [unversionedPackageDisabled] ExperimentalFeatures unversionedPackageDisabled + */ + + /** + * Constructs a new ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @classdesc Represents an ExperimentalFeatures. + * @implements IExperimentalFeatures + * @constructor + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + */ + function ExperimentalFeatures(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]]; + } + + /** + * ExperimentalFeatures restAsyncIoEnabled. + * @member {boolean} restAsyncIoEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.restAsyncIoEnabled = false; + + /** + * ExperimentalFeatures protobufPythonicTypesEnabled. + * @member {boolean} protobufPythonicTypesEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.protobufPythonicTypesEnabled = false; + + /** + * ExperimentalFeatures unversionedPackageDisabled. + * @member {boolean} unversionedPackageDisabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.unversionedPackageDisabled = false; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures instance + */ + ExperimentalFeatures.create = function create(properties) { + return new ExperimentalFeatures(properties); + }; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.protobufPythonicTypesEnabled); + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unversionedPackageDisabled); + return writer; + }; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restAsyncIoEnabled = reader.bool(); + break; + } + case 2: { + message.protobufPythonicTypesEnabled = reader.bool(); + break; + } + case 3: { + message.unversionedPackageDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExperimentalFeatures message. + * @function verify + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExperimentalFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + if (typeof message.restAsyncIoEnabled !== "boolean") + return "restAsyncIoEnabled: boolean expected"; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + if (typeof message.protobufPythonicTypesEnabled !== "boolean") + return "protobufPythonicTypesEnabled: boolean expected"; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + if (typeof message.unversionedPackageDisabled !== "boolean") + return "unversionedPackageDisabled: boolean expected"; + return null; + }; + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + */ + ExperimentalFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) + return object; + var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + if (object.restAsyncIoEnabled != null) + message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); + if (object.protobufPythonicTypesEnabled != null) + message.protobufPythonicTypesEnabled = Boolean(object.protobufPythonicTypesEnabled); + if (object.unversionedPackageDisabled != null) + message.unversionedPackageDisabled = Boolean(object.unversionedPackageDisabled); + return message; + }; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.ExperimentalFeatures} message ExperimentalFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExperimentalFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.restAsyncIoEnabled = false; + object.protobufPythonicTypesEnabled = false; + object.unversionedPackageDisabled = false; + } + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + object.restAsyncIoEnabled = message.restAsyncIoEnabled; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + object.unversionedPackageDisabled = message.unversionedPackageDisabled; + return object; + }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @function toJSON + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + * @returns {Object.} JSON object + */ + ExperimentalFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExperimentalFeatures + * @function getTypeUrl + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExperimentalFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings.ExperimentalFeatures"; + }; + + return ExperimentalFeatures; + })(); + return PythonSettings; })(); @@ -37340,6 +37650,7 @@ * @memberof google.api * @interface IGoSettings * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common + * @property {Object.|null} [renamedServices] GoSettings renamedServices */ /** @@ -37351,6 +37662,7 @@ * @param {google.api.IGoSettings=} [properties] Properties to set */ function GoSettings(properties) { + this.renamedServices = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -37365,6 +37677,14 @@ */ GoSettings.prototype.common = null; + /** + * GoSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.renamedServices = $util.emptyObject; + /** * Creates a new GoSettings instance using the specified properties. * @function create @@ -37391,6 +37711,9 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); return writer; }; @@ -37421,7 +37744,7 @@ GoSettings.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) @@ -37431,6 +37754,29 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedServices[key] = value; + break; + } default: reader.skipType(tag & 7); break; @@ -37471,6 +37817,14 @@ if (error) return "common." + error; } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } return null; }; @@ -37491,6 +37845,13 @@ throw TypeError(".google.api.GoSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.GoSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } return message; }; @@ -37507,10 +37868,18 @@ if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) + object.renamedServices = {}; if (options.defaults) object.common = null; if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } return object; }; @@ -38149,30 +38518,275 @@ return values; })(); - /** - * LaunchStage enum. - * @name google.api.LaunchStage - * @enum {number} - * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value - * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value - * @property {number} PRELAUNCH=7 PRELAUNCH value - * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value - * @property {number} ALPHA=2 ALPHA value - * @property {number} BETA=3 BETA value - * @property {number} GA=4 GA value - * @property {number} DEPRECATED=5 DEPRECATED value - */ - api.LaunchStage = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; - values[valuesById[6] = "UNIMPLEMENTED"] = 6; - values[valuesById[7] = "PRELAUNCH"] = 7; - values[valuesById[1] = "EARLY_ACCESS"] = 1; - values[valuesById[2] = "ALPHA"] = 2; - values[valuesById[3] = "BETA"] = 3; - values[valuesById[4] = "GA"] = 4; - values[valuesById[5] = "DEPRECATED"] = 5; - return values; + api.SelectiveGapicGeneration = (function() { + + /** + * Properties of a SelectiveGapicGeneration. + * @memberof google.api + * @interface ISelectiveGapicGeneration + * @property {Array.|null} [methods] SelectiveGapicGeneration methods + * @property {boolean|null} [generateOmittedAsInternal] SelectiveGapicGeneration generateOmittedAsInternal + */ + + /** + * Constructs a new SelectiveGapicGeneration. + * @memberof google.api + * @classdesc Represents a SelectiveGapicGeneration. + * @implements ISelectiveGapicGeneration + * @constructor + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + */ + function SelectiveGapicGeneration(properties) { + this.methods = []; + 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]]; + } + + /** + * SelectiveGapicGeneration methods. + * @member {Array.} methods + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.methods = $util.emptyArray; + + /** + * SelectiveGapicGeneration generateOmittedAsInternal. + * @member {boolean} generateOmittedAsInternal + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.generateOmittedAsInternal = false; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @function create + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration instance + */ + SelectiveGapicGeneration.create = function create(properties) { + return new SelectiveGapicGeneration(properties); + }; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methods != null && message.methods.length) + for (var i = 0; i < message.methods.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.generateOmittedAsInternal); + return writer; + }; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @function decode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.methods && message.methods.length)) + message.methods = []; + message.methods.push(reader.string()); + break; + } + case 2: { + message.generateOmittedAsInternal = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectiveGapicGeneration message. + * @function verify + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectiveGapicGeneration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methods != null && message.hasOwnProperty("methods")) { + if (!Array.isArray(message.methods)) + return "methods: array expected"; + for (var i = 0; i < message.methods.length; ++i) + if (!$util.isString(message.methods[i])) + return "methods: string[] expected"; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + if (typeof message.generateOmittedAsInternal !== "boolean") + return "generateOmittedAsInternal: boolean expected"; + return null; + }; + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} object Plain object + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + */ + SelectiveGapicGeneration.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.SelectiveGapicGeneration) + return object; + var message = new $root.google.api.SelectiveGapicGeneration(); + if (object.methods) { + if (!Array.isArray(object.methods)) + throw TypeError(".google.api.SelectiveGapicGeneration.methods: array expected"); + message.methods = []; + for (var i = 0; i < object.methods.length; ++i) + message.methods[i] = String(object.methods[i]); + } + if (object.generateOmittedAsInternal != null) + message.generateOmittedAsInternal = Boolean(object.generateOmittedAsInternal); + return message; + }; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.SelectiveGapicGeneration} message SelectiveGapicGeneration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectiveGapicGeneration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.methods = []; + if (options.defaults) + object.generateOmittedAsInternal = false; + if (message.methods && message.methods.length) { + object.methods = []; + for (var j = 0; j < message.methods.length; ++j) + object.methods[j] = message.methods[j]; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + object.generateOmittedAsInternal = message.generateOmittedAsInternal; + return object; + }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @function toJSON + * @memberof google.api.SelectiveGapicGeneration + * @instance + * @returns {Object.} JSON object + */ + SelectiveGapicGeneration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @function getTypeUrl + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectiveGapicGeneration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.SelectiveGapicGeneration"; + }; + + return SelectiveGapicGeneration; + })(); + + /** + * LaunchStage enum. + * @name google.api.LaunchStage + * @enum {number} + * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value + * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value + * @property {number} PRELAUNCH=7 PRELAUNCH value + * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + */ + api.LaunchStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; + values[valuesById[6] = "UNIMPLEMENTED"] = 6; + values[valuesById[7] = "PRELAUNCH"] = 7; + values[valuesById[1] = "EARLY_ACCESS"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + return values; })(); return api; @@ -38418,6 +39032,7 @@ * @name google.protobuf.Edition * @enum {number} * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_LEGACY=900 EDITION_LEGACY value * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value * @property {number} EDITION_2023=1000 EDITION_2023 value @@ -38432,6 +39047,7 @@ protobuf.Edition = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[900] = "EDITION_LEGACY"] = 900; values[valuesById[998] = "EDITION_PROTO2"] = 998; values[valuesById[999] = "EDITION_PROTO3"] = 999; values[valuesById[1000] = "EDITION_2023"] = 1000; @@ -38456,6 +39072,7 @@ * @property {Array.|null} [dependency] FileDescriptorProto dependency * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [optionDependency] FileDescriptorProto optionDependency * @property {Array.|null} [messageType] FileDescriptorProto messageType * @property {Array.|null} [enumType] FileDescriptorProto enumType * @property {Array.|null} [service] FileDescriptorProto service @@ -38478,6 +39095,7 @@ this.dependency = []; this.publicDependency = []; this.weakDependency = []; + this.optionDependency = []; this.messageType = []; this.enumType = []; this.service = []; @@ -38528,6 +39146,14 @@ */ FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + /** + * FileDescriptorProto optionDependency. + * @member {Array.} optionDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.optionDependency = $util.emptyArray; + /** * FileDescriptorProto messageType. * @member {Array.} messageType @@ -38649,6 +39275,9 @@ writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + if (message.optionDependency != null && message.optionDependency.length) + for (var i = 0; i < message.optionDependency.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.optionDependency[i]); return writer; }; @@ -38721,6 +39350,12 @@ message.weakDependency.push(reader.int32()); break; } + case 15: { + if (!(message.optionDependency && message.optionDependency.length)) + message.optionDependency = []; + message.optionDependency.push(reader.string()); + break; + } case 4: { if (!(message.messageType && message.messageType.length)) message.messageType = []; @@ -38823,6 +39458,13 @@ if (!$util.isInteger(message.weakDependency[i])) return "weakDependency: integer[] expected"; } + if (message.optionDependency != null && message.hasOwnProperty("optionDependency")) { + if (!Array.isArray(message.optionDependency)) + return "optionDependency: array expected"; + for (var i = 0; i < message.optionDependency.length; ++i) + if (!$util.isString(message.optionDependency[i])) + return "optionDependency: string[] expected"; + } if (message.messageType != null && message.hasOwnProperty("messageType")) { if (!Array.isArray(message.messageType)) return "messageType: array expected"; @@ -38877,6 +39519,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -38929,6 +39572,13 @@ for (var i = 0; i < object.weakDependency.length; ++i) message.weakDependency[i] = object.weakDependency[i] | 0; } + if (object.optionDependency) { + if (!Array.isArray(object.optionDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.optionDependency: array expected"); + message.optionDependency = []; + for (var i = 0; i < object.optionDependency.length; ++i) + message.optionDependency[i] = String(object.optionDependency[i]); + } if (object.messageType) { if (!Array.isArray(object.messageType)) throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); @@ -38992,6 +39642,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -39057,6 +39711,7 @@ object.extension = []; object.publicDependency = []; object.weakDependency = []; + object.optionDependency = []; } if (options.defaults) { object.name = ""; @@ -39113,6 +39768,11 @@ object.syntax = message.syntax; if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.optionDependency && message.optionDependency.length) { + object.optionDependency = []; + for (var j = 0; j < message.optionDependency.length; ++j) + object.optionDependency[j] = message.optionDependency[j]; + } return object; }; @@ -39161,6 +39821,7 @@ * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options * @property {Array.|null} [reservedRange] DescriptorProto reservedRange * @property {Array.|null} [reservedName] DescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] DescriptorProto visibility */ /** @@ -39266,6 +39927,14 @@ */ DescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * DescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.visibility = 0; + /** * Creates a new DescriptorProto instance using the specified properties. * @function create @@ -39318,6 +39987,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.visibility); return writer; }; @@ -39410,6 +40081,10 @@ message.reservedName.push(reader.string()); break; } + case 11: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -39523,6 +40198,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -39622,6 +40306,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -39651,6 +40355,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -39696,6 +40401,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -41740,6 +42447,7 @@ * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] EnumDescriptorProto visibility */ /** @@ -41800,6 +42508,14 @@ */ EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * EnumDescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.visibility = 0; + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @function create @@ -41837,6 +42553,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.visibility); return writer; }; @@ -41899,6 +42617,10 @@ message.reservedName.push(reader.string()); break; } + case 6: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -41967,6 +42689,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -42016,6 +42747,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -42040,6 +42791,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -42060,6 +42812,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -44378,6 +45132,7 @@ * @property {Array.|null} [targets] FieldOptions targets * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] FieldOptions featureSupport * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference @@ -44498,6 +45253,14 @@ */ FieldOptions.prototype.features = null; + /** + * FieldOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.featureSupport = null; + /** * FieldOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -44572,6 +45335,8 @@ $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); if (message.features != null && Object.hasOwnProperty.call(message, "features")) $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -44673,6 +45438,10 @@ message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } + case 22: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -44808,6 +45577,11 @@ if (error) return "features." + error; } + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -44996,6 +45770,11 @@ throw TypeError(".google.protobuf.FieldOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); } + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); @@ -45093,6 +45872,7 @@ object.debugRedact = false; object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; object.features = null; + object.featureSupport = null; object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) @@ -45125,6 +45905,8 @@ } if (message.features != null && message.hasOwnProperty("features")) object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -45397,6 +46179,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -45438,103 +46221,589 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; break; case "EDITION_PROTO3": case 999: - message.edition = 999; + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EditionDefault.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + return object; + }; + + /** + * Converts this EditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + * @returns {Object.} JSON object + */ + EditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + }; + + return EditionDefault; + })(); + + FieldOptions.FeatureSupport = (function() { + + /** + * Properties of a FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @interface IFeatureSupport + * @property {google.protobuf.Edition|null} [editionIntroduced] FeatureSupport editionIntroduced + * @property {google.protobuf.Edition|null} [editionDeprecated] FeatureSupport editionDeprecated + * @property {string|null} [deprecationWarning] FeatureSupport deprecationWarning + * @property {google.protobuf.Edition|null} [editionRemoved] FeatureSupport editionRemoved + */ + + /** + * Constructs a new FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents a FeatureSupport. + * @implements IFeatureSupport + * @constructor + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + */ + function FeatureSupport(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]]; + } + + /** + * FeatureSupport editionIntroduced. + * @member {google.protobuf.Edition} editionIntroduced + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionIntroduced = 0; + + /** + * FeatureSupport editionDeprecated. + * @member {google.protobuf.Edition} editionDeprecated + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionDeprecated = 0; + + /** + * FeatureSupport deprecationWarning. + * @member {string} deprecationWarning + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.deprecationWarning = ""; + + /** + * FeatureSupport editionRemoved. + * @member {google.protobuf.Edition} editionRemoved + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionRemoved = 0; + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport instance + */ + FeatureSupport.create = function create(properties) { + return new FeatureSupport(properties); + }; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editionDeprecated); + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.deprecationWarning); + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.editionRemoved); + return writer; + }; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.editionIntroduced = reader.int32(); + break; + } + case 2: { + message.editionDeprecated = reader.int32(); + break; + } + case 3: { + message.deprecationWarning = reader.string(); + break; + } + case 4: { + message.editionRemoved = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSupport message. + * @function verify + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSupport.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + switch (message.editionIntroduced) { + default: + return "editionIntroduced: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + switch (message.editionDeprecated) { + default: + return "editionDeprecated: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + if (!$util.isString(message.deprecationWarning)) + return "deprecationWarning: string expected"; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + switch (message.editionRemoved) { + default: + return "editionRemoved: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + */ + FeatureSupport.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) + return object; + var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + switch (object.editionIntroduced) { + default: + if (typeof object.editionIntroduced === "number") { + message.editionIntroduced = object.editionIntroduced; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionIntroduced = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionIntroduced = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionIntroduced = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionIntroduced = 999; + break; + case "EDITION_2023": + case 1000: + message.editionIntroduced = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionIntroduced = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionIntroduced = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionIntroduced = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionIntroduced = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionIntroduced = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionIntroduced = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionIntroduced = 2147483647; + break; + } + switch (object.editionDeprecated) { + default: + if (typeof object.editionDeprecated === "number") { + message.editionDeprecated = object.editionDeprecated; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionDeprecated = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionDeprecated = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionDeprecated = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionDeprecated = 999; + break; + case "EDITION_2023": + case 1000: + message.editionDeprecated = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionDeprecated = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionDeprecated = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionDeprecated = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionDeprecated = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionDeprecated = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionDeprecated = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionDeprecated = 2147483647; + break; + } + if (object.deprecationWarning != null) + message.deprecationWarning = String(object.deprecationWarning); + switch (object.editionRemoved) { + default: + if (typeof object.editionRemoved === "number") { + message.editionRemoved = object.editionRemoved; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionRemoved = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionRemoved = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionRemoved = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionRemoved = 999; break; case "EDITION_2023": case 1000: - message.edition = 1000; + message.editionRemoved = 1000; break; case "EDITION_2024": case 1001: - message.edition = 1001; + message.editionRemoved = 1001; break; case "EDITION_1_TEST_ONLY": case 1: - message.edition = 1; + message.editionRemoved = 1; break; case "EDITION_2_TEST_ONLY": case 2: - message.edition = 2; + message.editionRemoved = 2; break; case "EDITION_99997_TEST_ONLY": case 99997: - message.edition = 99997; + message.editionRemoved = 99997; break; case "EDITION_99998_TEST_ONLY": case 99998: - message.edition = 99998; + message.editionRemoved = 99998; break; case "EDITION_99999_TEST_ONLY": case 99999: - message.edition = 99999; + message.editionRemoved = 99999; break; case "EDITION_MAX": case 2147483647: - message.edition = 2147483647; + message.editionRemoved = 2147483647; break; } - if (object.value != null) - message.value = String(object.value); return message; }; /** - * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {google.protobuf.FieldOptions.FeatureSupport} message FeatureSupport * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EditionDefault.toObject = function toObject(message, options) { + FeatureSupport.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.value = ""; - object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; - } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionDeprecated = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.deprecationWarning = ""; + object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + object.deprecationWarning = message.deprecationWarning; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; return object; }; /** - * Converts this EditionDefault to JSON. + * Converts this FeatureSupport to JSON. * @function toJSON - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @instance * @returns {Object.} JSON object */ - EditionDefault.prototype.toJSON = function toJSON() { + FeatureSupport.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for EditionDefault + * Gets the default type url for FeatureSupport * @function getTypeUrl - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FeatureSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + return typeUrlPrefix + "/google.protobuf.FieldOptions.FeatureSupport"; }; - return EditionDefault; + return FeatureSupport; })(); return FieldOptions; @@ -46129,6 +47398,7 @@ * @property {boolean|null} [deprecated] EnumValueOptions deprecated * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] EnumValueOptions featureSupport * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption */ @@ -46172,6 +47442,14 @@ */ EnumValueOptions.prototype.debugRedact = false; + /** + * EnumValueOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.featureSupport = null; + /** * EnumValueOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -46210,6 +47488,8 @@ $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -46261,6 +47541,10 @@ message.debugRedact = reader.bool(); break; } + case 4: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -46313,6 +47597,11 @@ if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) if (typeof message.debugRedact !== "boolean") return "debugRedact: boolean expected"; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -46346,6 +47635,11 @@ } if (object.debugRedact != null) message.debugRedact = Boolean(object.debugRedact); + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); @@ -46378,6 +47672,7 @@ object.deprecated = false; object.features = null; object.debugRedact = false; + object.featureSupport = null; } if (message.deprecated != null && message.hasOwnProperty("deprecated")) object.deprecated = message.deprecated; @@ -46385,6 +47680,8 @@ object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) object.debugRedact = message.debugRedact; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -47824,6 +49121,8 @@ * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + * @property {google.protobuf.FeatureSet.EnforceNamingStyle|null} [enforceNamingStyle] FeatureSet enforceNamingStyle + * @property {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null} [defaultSymbolVisibility] FeatureSet defaultSymbolVisibility */ /** @@ -47889,6 +49188,22 @@ */ FeatureSet.prototype.jsonFormat = 0; + /** + * FeatureSet enforceNamingStyle. + * @member {google.protobuf.FeatureSet.EnforceNamingStyle} enforceNamingStyle + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enforceNamingStyle = 0; + + /** + * FeatureSet defaultSymbolVisibility. + * @member {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility} defaultSymbolVisibility + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.defaultSymbolVisibility = 0; + /** * Creates a new FeatureSet instance using the specified properties. * @function create @@ -47925,6 +49240,10 @@ writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enforceNamingStyle); + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.defaultSymbolVisibility); return writer; }; @@ -47985,6 +49304,14 @@ message.jsonFormat = reader.int32(); break; } + case 7: { + message.enforceNamingStyle = reader.int32(); + break; + } + case 8: { + message.defaultSymbolVisibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -48075,6 +49402,26 @@ case 2: break; } + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + switch (message.enforceNamingStyle) { + default: + return "enforceNamingStyle: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + switch (message.defaultSymbolVisibility) { + default: + return "defaultSymbolVisibility: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } return null; }; @@ -48214,6 +49561,54 @@ message.jsonFormat = 2; break; } + switch (object.enforceNamingStyle) { + default: + if (typeof object.enforceNamingStyle === "number") { + message.enforceNamingStyle = object.enforceNamingStyle; + break; + } + break; + case "ENFORCE_NAMING_STYLE_UNKNOWN": + case 0: + message.enforceNamingStyle = 0; + break; + case "STYLE2024": + case 1: + message.enforceNamingStyle = 1; + break; + case "STYLE_LEGACY": + case 2: + message.enforceNamingStyle = 2; + break; + } + switch (object.defaultSymbolVisibility) { + default: + if (typeof object.defaultSymbolVisibility === "number") { + message.defaultSymbolVisibility = object.defaultSymbolVisibility; + break; + } + break; + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + case 0: + message.defaultSymbolVisibility = 0; + break; + case "EXPORT_ALL": + case 1: + message.defaultSymbolVisibility = 1; + break; + case "EXPORT_TOP_LEVEL": + case 2: + message.defaultSymbolVisibility = 2; + break; + case "LOCAL_ALL": + case 3: + message.defaultSymbolVisibility = 3; + break; + case "STRICT": + case 4: + message.defaultSymbolVisibility = 4; + break; + } return message; }; @@ -48237,6 +49632,8 @@ object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; + object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; } if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; @@ -48250,6 +49647,10 @@ object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; return object; }; @@ -48377,6 +49778,219 @@ return values; })(); + /** + * EnforceNamingStyle enum. + * @name google.protobuf.FeatureSet.EnforceNamingStyle + * @enum {number} + * @property {number} ENFORCE_NAMING_STYLE_UNKNOWN=0 ENFORCE_NAMING_STYLE_UNKNOWN value + * @property {number} STYLE2024=1 STYLE2024 value + * @property {number} STYLE_LEGACY=2 STYLE_LEGACY value + */ + FeatureSet.EnforceNamingStyle = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENFORCE_NAMING_STYLE_UNKNOWN"] = 0; + values[valuesById[1] = "STYLE2024"] = 1; + values[valuesById[2] = "STYLE_LEGACY"] = 2; + return values; + })(); + + FeatureSet.VisibilityFeature = (function() { + + /** + * Properties of a VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @interface IVisibilityFeature + */ + + /** + * Constructs a new VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @classdesc Represents a VisibilityFeature. + * @implements IVisibilityFeature + * @constructor + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + */ + function VisibilityFeature(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]]; + } + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature instance + */ + VisibilityFeature.create = function create(properties) { + return new VisibilityFeature(properties); + }; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisibilityFeature message. + * @function verify + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisibilityFeature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + */ + VisibilityFeature.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) + return object; + return new $root.google.protobuf.FeatureSet.VisibilityFeature(); + }; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.VisibilityFeature} message VisibilityFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisibilityFeature.toObject = function toObject() { + return {}; + }; + + /** + * Converts this VisibilityFeature to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @instance + * @returns {Object.} JSON object + */ + VisibilityFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VisibilityFeature + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisibilityFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet.VisibilityFeature"; + }; + + /** + * DefaultSymbolVisibility enum. + * @name google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + * @enum {number} + * @property {number} DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN value + * @property {number} EXPORT_ALL=1 EXPORT_ALL value + * @property {number} EXPORT_TOP_LEVEL=2 EXPORT_TOP_LEVEL value + * @property {number} LOCAL_ALL=3 LOCAL_ALL value + * @property {number} STRICT=4 STRICT value + */ + VisibilityFeature.DefaultSymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0; + values[valuesById[1] = "EXPORT_ALL"] = 1; + values[valuesById[2] = "EXPORT_TOP_LEVEL"] = 2; + values[valuesById[3] = "LOCAL_ALL"] = 3; + values[valuesById[4] = "STRICT"] = 4; + return values; + })(); + + return VisibilityFeature; + })(); + return FeatureSet; })(); @@ -48561,6 +50175,7 @@ default: return "minimumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -48578,6 +50193,7 @@ default: return "maximumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -48626,6 +50242,10 @@ case 0: message.minimumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.minimumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.minimumEdition = 998; @@ -48678,6 +50298,10 @@ case 0: message.maximumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.maximumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.maximumEdition = 998; @@ -48786,7 +50410,8 @@ * @memberof google.protobuf.FeatureSetDefaults * @interface IFeatureSetEditionDefault * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition - * @property {google.protobuf.IFeatureSet|null} [features] FeatureSetEditionDefault features + * @property {google.protobuf.IFeatureSet|null} [overridableFeatures] FeatureSetEditionDefault overridableFeatures + * @property {google.protobuf.IFeatureSet|null} [fixedFeatures] FeatureSetEditionDefault fixedFeatures */ /** @@ -48813,12 +50438,20 @@ FeatureSetEditionDefault.prototype.edition = 0; /** - * FeatureSetEditionDefault features. - * @member {google.protobuf.IFeatureSet|null|undefined} features + * FeatureSetEditionDefault overridableFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} overridableFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.overridableFeatures = null; + + /** + * FeatureSetEditionDefault fixedFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} fixedFeatures * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @instance */ - FeatureSetEditionDefault.prototype.features = null; + FeatureSetEditionDefault.prototype.fixedFeatures = null; /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -48844,10 +50477,12 @@ FeatureSetEditionDefault.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -48888,8 +50523,12 @@ message.edition = reader.int32(); break; } - case 2: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + case 4: { + message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 5: { + message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } default: @@ -48932,6 +50571,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -48944,10 +50584,15 @@ case 2147483647: break; } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures); + if (error) + return "overridableFeatures." + error; + } + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures); if (error) - return "features." + error; + return "fixedFeatures." + error; } return null; }; @@ -48975,6 +50620,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -49016,10 +50665,15 @@ message.edition = 2147483647; break; } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + if (object.overridableFeatures != null) { + if (typeof object.overridableFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); + message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures); + } + if (object.fixedFeatures != null) { + if (typeof object.fixedFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); + message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures); } return message; }; @@ -49038,13 +50692,16 @@ options = {}; var object = {}; if (options.defaults) { - object.features = null; object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.overridableFeatures = null; + object.fixedFeatures = null; } - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) + object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options); + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) + object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options); return object; }; @@ -50259,6 +51916,22 @@ return GeneratedCodeInfo; })(); + /** + * SymbolVisibility enum. + * @name google.protobuf.SymbolVisibility + * @enum {number} + * @property {number} VISIBILITY_UNSET=0 VISIBILITY_UNSET value + * @property {number} VISIBILITY_LOCAL=1 VISIBILITY_LOCAL value + * @property {number} VISIBILITY_EXPORT=2 VISIBILITY_EXPORT value + */ + protobuf.SymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VISIBILITY_UNSET"] = 0; + values[valuesById[1] = "VISIBILITY_LOCAL"] = 1; + values[valuesById[2] = "VISIBILITY_EXPORT"] = 2; + return values; + })(); + protobuf.Timestamp = (function() { /** diff --git a/packages/google-cloud-websecurityscanner/protos/protos.json b/packages/google-cloud-websecurityscanner/protos/protos.json index 77d76a1584ec..e331d428f505 100644 --- a/packages/google-cloud-websecurityscanner/protos/protos.json +++ b/packages/google-cloud-websecurityscanner/protos/protos.json @@ -3121,8 +3121,7 @@ "java_multiple_files": true, "java_outer_classname": "LaunchStageProto", "java_package": "com.google.api", - "objc_class_prefix": "GAPI", - "cc_enable_arenas": true + "objc_class_prefix": "GAPI" }, "nested": { "fieldBehavior": { @@ -3345,6 +3344,10 @@ "rule": "repeated", "type": "ClientLibraryDestination", "id": 2 + }, + "selectiveGapicGeneration": { + "type": "SelectiveGapicGeneration", + "id": 3 } } }, @@ -3485,6 +3488,28 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "experimentalFeatures": { + "type": "ExperimentalFeatures", + "id": 2 + } + }, + "nested": { + "ExperimentalFeatures": { + "fields": { + "restAsyncIoEnabled": { + "type": "bool", + "id": 1 + }, + "protobufPythonicTypesEnabled": { + "type": "bool", + "id": 2 + }, + "unversionedPackageDisabled": { + "type": "bool", + "id": 3 + } + } } } }, @@ -3542,6 +3567,11 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 } } }, @@ -3603,6 +3633,19 @@ "PACKAGE_MANAGER": 20 } }, + "SelectiveGapicGeneration": { + "fields": { + "methods": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "generateOmittedAsInternal": { + "type": "bool", + "id": 2 + } + } + }, "LaunchStage": { "values": { "LAUNCH_STAGE_UNSPECIFIED": 0, @@ -3636,12 +3679,19 @@ "type": "FileDescriptorProto", "id": 1 } - } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ] }, "Edition": { "edition": "proto2", "values": { "EDITION_UNKNOWN": 0, + "EDITION_LEGACY": 900, "EDITION_PROTO2": 998, "EDITION_PROTO3": 999, "EDITION_2023": 1000, @@ -3680,6 +3730,11 @@ "type": "int32", "id": 11 }, + "optionDependency": { + "rule": "repeated", + "type": "string", + "id": 15 + }, "messageType": { "rule": "repeated", "type": "DescriptorProto", @@ -3768,6 +3823,10 @@ "rule": "repeated", "type": "string", "id": 10 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 11 } }, "nested": { @@ -3993,6 +4052,10 @@ "rule": "repeated", "type": "string", "id": 5 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 6 } }, "nested": { @@ -4043,7 +4106,14 @@ "type": "ServiceOptions", "id": 3 } - } + }, + "reserved": [ + [ + 4, + 4 + ], + "stream" + ] }, "MethodDescriptorProto": { "edition": "proto2", @@ -4207,6 +4277,7 @@ 42, 42 ], + "php_generic_services", [ 38, 38 @@ -4342,7 +4413,8 @@ "type": "bool", "id": 10, "options": { - "default": false + "default": false, + "deprecated": true } }, "debugRedact": { @@ -4370,6 +4442,10 @@ "type": "FeatureSet", "id": 21 }, + "featureSupport": { + "type": "FeatureSupport", + "id": 22 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -4439,6 +4515,26 @@ "id": 2 } } + }, + "FeatureSupport": { + "fields": { + "editionIntroduced": { + "type": "Edition", + "id": 1 + }, + "editionDeprecated": { + "type": "Edition", + "id": 2 + }, + "deprecationWarning": { + "type": "string", + "id": 3 + }, + "editionRemoved": { + "type": "Edition", + "id": 4 + } + } } } }, @@ -4527,6 +4623,10 @@ "default": false } }, + "featureSupport": { + "type": "FieldOptions.FeatureSupport", + "id": 4 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -4669,6 +4769,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_2023", "edition_defaults.value": "EXPLICIT" } @@ -4679,6 +4780,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "OPEN" } @@ -4689,6 +4791,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "PACKED" } @@ -4699,6 +4802,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "VERIFY" } @@ -4709,7 +4813,8 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "EDITION_PROTO2", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_LEGACY", "edition_defaults.value": "LENGTH_PREFIXED" } }, @@ -4719,27 +4824,38 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "ALLOW" } + }, + "enforceNamingStyle": { + "type": "EnforceNamingStyle", + "id": 7, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_METHOD", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "STYLE2024" + } + }, + "defaultSymbolVisibility": { + "type": "VisibilityFeature.DefaultSymbolVisibility", + "id": 8, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "EXPORT_TOP_LEVEL" + } } }, "extensions": [ [ 1000, - 1000 - ], - [ - 1001, - 1001 - ], - [ - 1002, - 1002 - ], - [ - 9990, - 9990 + 9994 ], [ 9995, @@ -4784,7 +4900,13 @@ "UTF8_VALIDATION_UNKNOWN": 0, "VERIFY": 2, "NONE": 3 - } + }, + "reserved": [ + [ + 1, + 1 + ] + ] }, "MessageEncoding": { "values": { @@ -4799,6 +4921,33 @@ "ALLOW": 1, "LEGACY_BEST_EFFORT": 2 } + }, + "EnforceNamingStyle": { + "values": { + "ENFORCE_NAMING_STYLE_UNKNOWN": 0, + "STYLE2024": 1, + "STYLE_LEGACY": 2 + } + }, + "VisibilityFeature": { + "fields": {}, + "reserved": [ + [ + 1, + 536870911 + ] + ], + "nested": { + "DefaultSymbolVisibility": { + "values": { + "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, + "EXPORT_ALL": 1, + "EXPORT_TOP_LEVEL": 2, + "LOCAL_ALL": 3, + "STRICT": 4 + } + } + } } } }, @@ -4826,11 +4975,26 @@ "type": "Edition", "id": 3 }, - "features": { + "overridableFeatures": { "type": "FeatureSet", - "id": 2 + "id": 4 + }, + "fixedFeatures": { + "type": "FeatureSet", + "id": 5 } - } + }, + "reserved": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + "features" + ] } } }, @@ -4843,6 +5007,12 @@ "id": 1 } }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ], "nested": { "Location": { "fields": { @@ -4928,6 +5098,14 @@ } } }, + "SymbolVisibility": { + "edition": "proto2", + "values": { + "VISIBILITY_UNSET": 0, + "VISIBILITY_LOCAL": 1, + "VISIBILITY_EXPORT": 2 + } + }, "Timestamp": { "fields": { "seconds": { diff --git a/packages/google-cloud-websecurityscanner/samples/generated/v1/snippet_metadata_google.cloud.websecurityscanner.v1.json b/packages/google-cloud-websecurityscanner/samples/generated/v1/snippet_metadata_google.cloud.websecurityscanner.v1.json index 1847fa05be49..340564e435cd 100644 --- a/packages/google-cloud-websecurityscanner/samples/generated/v1/snippet_metadata_google.cloud.websecurityscanner.v1.json +++ b/packages/google-cloud-websecurityscanner/samples/generated/v1/snippet_metadata_google.cloud.websecurityscanner.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-websecurityscanner", - "version": "4.2.1", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-websecurityscanner/samples/generated/v1alpha/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json b/packages/google-cloud-websecurityscanner/samples/generated/v1alpha/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json index 515f00836ef7..c0c051282bed 100644 --- a/packages/google-cloud-websecurityscanner/samples/generated/v1alpha/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json +++ b/packages/google-cloud-websecurityscanner/samples/generated/v1alpha/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-websecurityscanner", - "version": "4.2.1", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-websecurityscanner/samples/generated/v1beta/snippet_metadata_google.cloud.websecurityscanner.v1beta.json b/packages/google-cloud-websecurityscanner/samples/generated/v1beta/snippet_metadata_google.cloud.websecurityscanner.v1beta.json index b9bfa8dad6ca..88fc2b3b4de4 100644 --- a/packages/google-cloud-websecurityscanner/samples/generated/v1beta/snippet_metadata_google.cloud.websecurityscanner.v1beta.json +++ b/packages/google-cloud-websecurityscanner/samples/generated/v1beta/snippet_metadata_google.cloud.websecurityscanner.v1beta.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-websecurityscanner", - "version": "4.2.1", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-websecurityscanner/src/v1/index.ts b/packages/google-cloud-websecurityscanner/src/v1/index.ts index 6adb55d6a1d4..0dd68252ab0d 100644 --- a/packages/google-cloud-websecurityscanner/src/v1/index.ts +++ b/packages/google-cloud-websecurityscanner/src/v1/index.ts @@ -16,4 +16,4 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {WebSecurityScannerClient} from './web_security_scanner_client'; +export { WebSecurityScannerClient } from './web_security_scanner_client'; diff --git a/packages/google-cloud-websecurityscanner/src/v1/web_security_scanner_client.ts b/packages/google-cloud-websecurityscanner/src/v1/web_security_scanner_client.ts index 3052e247efdd..7691cb925352 100644 --- a/packages/google-cloud-websecurityscanner/src/v1/web_security_scanner_client.ts +++ b/packages/google-cloud-websecurityscanner/src/v1/web_security_scanner_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -46,7 +53,7 @@ export class WebSecurityScannerClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('web-security-scanner'); @@ -59,9 +66,9 @@ export class WebSecurityScannerClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - webSecurityScannerStub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + webSecurityScannerStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of WebSecurityScannerClient. @@ -102,21 +109,42 @@ export class WebSecurityScannerClient { * const client = new WebSecurityScannerClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof WebSecurityScannerClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'websecurityscanner.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -141,7 +169,7 @@ export class WebSecurityScannerClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,10 +183,7 @@ export class WebSecurityScannerClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -180,7 +205,7 @@ export class WebSecurityScannerClient { // Create useful helper objects for these. this.pathTemplates = { findingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}', ), }; @@ -188,20 +213,35 @@ export class WebSecurityScannerClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listScanConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), - listScanRuns: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), - listCrawledUrls: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') + listScanConfigs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'scanConfigs', + ), + listScanRuns: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'scanRuns', + ), + listCrawledUrls: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'crawledUrls', + ), + listFindings: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'findings', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.websecurityscanner.v1.WebSecurityScanner', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.websecurityscanner.v1.WebSecurityScanner', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -232,37 +272,55 @@ export class WebSecurityScannerClient { // Put together the "service stub" for // google.cloud.websecurityscanner.v1.WebSecurityScanner. this.webSecurityScannerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1.WebSecurityScanner') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.websecurityscanner.v1.WebSecurityScanner, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.websecurityscanner.v1.WebSecurityScanner', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.websecurityscanner.v1 + .WebSecurityScanner, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const webSecurityScannerStubMethods = - ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; + const webSecurityScannerStubMethods = [ + 'createScanConfig', + 'deleteScanConfig', + 'getScanConfig', + 'listScanConfigs', + 'updateScanConfig', + 'startScanRun', + 'getScanRun', + 'listScanRuns', + 'stopScanRun', + 'listCrawledUrls', + 'getFinding', + 'listFindings', + 'listFindingTypeStats', + ]; for (const methodName of webSecurityScannerStubMethods) { const callPromise = this.webSecurityScannerStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -277,8 +335,14 @@ export class WebSecurityScannerClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'websecurityscanner.googleapis.com'; } @@ -289,8 +353,14 @@ export class WebSecurityScannerClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'websecurityscanner.googleapis.com'; } @@ -321,9 +391,7 @@ export class WebSecurityScannerClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -332,8 +400,9 @@ export class WebSecurityScannerClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -344,959 +413,1407 @@ export class WebSecurityScannerClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Creates a new ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - * @param {google.cloud.websecurityscanner.v1.ScanConfig} request.scanConfig - * Required. The ScanConfig to be created. - * @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 protos.google.cloud.websecurityscanner.v1.ScanConfig|ScanConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.create_scan_config.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async - */ + /** + * Creates a new ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * @param {google.cloud.websecurityscanner.v1.ScanConfig} request.scanConfig + * Required. The ScanConfig to be created. + * @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 protos.google.cloud.websecurityscanner.v1.ScanConfig|ScanConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.create_scan_config.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_CreateScanConfig_async + */ createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest + | undefined + ), + {} | undefined, + ] + >; createScanConfig( - request: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + | protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createScanConfig( - request: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + | protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + | protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createScanConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + | protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createScanConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createScanConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('createScanConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createScanConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1.ICreateScanConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createScanConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes an existing ScanConfig and its child resources. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.delete_scan_config.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async - */ + /** + * Deletes an existing ScanConfig and its child resources. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.delete_scan_config.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_DeleteScanConfig_async + */ deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest + | undefined + ), + {} | undefined, + ] + >; deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteScanConfig request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteScanConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteScanConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteScanConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .deleteScanConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.websecurityscanner.v1.IDeleteScanConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deleteScanConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 protos.google.cloud.websecurityscanner.v1.ScanConfig|ScanConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.get_scan_config.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async - */ + /** + * Gets a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 protos.google.cloud.websecurityscanner.v1.ScanConfig|ScanConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.get_scan_config.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetScanConfig_async + */ getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest + | undefined + ), + {} | undefined, + ] + >; getScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + | protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + | protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + | protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getScanConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + | protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getScanConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getScanConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getScanConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getScanConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1.IGetScanConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getScanConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates a ScanConfig. This method support partial update of a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.websecurityscanner.v1.ScanConfig} request.scanConfig - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - * @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 protos.google.cloud.websecurityscanner.v1.ScanConfig|ScanConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.update_scan_config.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async - */ + /** + * Updates a ScanConfig. This method support partial update of a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.websecurityscanner.v1.ScanConfig} request.scanConfig + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * @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 protos.google.cloud.websecurityscanner.v1.ScanConfig|ScanConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.update_scan_config.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_UpdateScanConfig_async + */ updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest + | undefined + ), + {} | undefined, + ] + >; updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + | protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + | protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + | protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scan_config.name': request.scanConfig!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'scan_config.name': request.scanConfig!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateScanConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1.IScanConfig, + | protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateScanConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateScanConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1.IScanConfig, - protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateScanConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateScanConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1.IUpdateScanConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateScanConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Start a ScanRun according to the given ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.start_scan_run.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async - */ + /** + * Start a ScanRun according to the given ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.start_scan_run.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_StartScanRun_async + */ startScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest + | undefined + ), + {} | undefined, + ] + >; startScanRun( - request: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + | protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; startScanRun( - request: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + | protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; startScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + | protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('startScanRun request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + | protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('startScanRun response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.startScanRun(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest|undefined, - {}|undefined - ]) => { - this._log.info('startScanRun response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .startScanRun(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1.IStartScanRunRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('startScanRun response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.get_scan_run.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async - */ + /** + * Gets a ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.get_scan_run.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetScanRun_async + */ getScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest | undefined, + {} | undefined, + ] + >; getScanRun( - request: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + | protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getScanRun( - request: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + | protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + | protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getScanRun request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + | protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getScanRun response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getScanRun(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest|undefined, - {}|undefined - ]) => { - this._log.info('getScanRun response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getScanRun(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1.IGetScanRunRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getScanRun response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Stops a ScanRun. The stopped ScanRun is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.stop_scan_run.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async - */ + /** + * Stops a ScanRun. The stopped ScanRun is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.stop_scan_run.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_StopScanRun_async + */ stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest | undefined, + {} | undefined, + ] + >; stopScanRun( - request: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + | protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; stopScanRun( - request: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + | protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + | protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanRun, + protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('stopScanRun request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1.IScanRun, + | protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('stopScanRun response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.stopScanRun(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1.IScanRun, - protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest|undefined, - {}|undefined - ]) => { - this._log.info('stopScanRun response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .stopScanRun(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1.IStopScanRunRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('stopScanRun response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a Finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - * @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 protos.google.cloud.websecurityscanner.v1.Finding|Finding}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.get_finding.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async - */ + /** + * Gets a Finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * @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 protos.google.cloud.websecurityscanner.v1.Finding|Finding}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.get_finding.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_GetFinding_async + */ getFinding( - request?: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IFinding, + protos.google.cloud.websecurityscanner.v1.IGetFindingRequest | undefined, + {} | undefined, + ] + >; getFinding( - request: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IFinding, + | protos.google.cloud.websecurityscanner.v1.IGetFindingRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getFinding( - request: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IFinding, + | protos.google.cloud.websecurityscanner.v1.IGetFindingRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getFinding( - request?: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1.IGetFindingRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1.IGetFindingRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IFinding, + | protos.google.cloud.websecurityscanner.v1.IGetFindingRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IFinding, + protos.google.cloud.websecurityscanner.v1.IGetFindingRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getFinding request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1.IFinding, + | protos.google.cloud.websecurityscanner.v1.IGetFindingRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getFinding response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getFinding(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1.IFinding, - protos.google.cloud.websecurityscanner.v1.IGetFindingRequest|undefined, - {}|undefined - ]) => { - this._log.info('getFinding response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getFinding(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1.IFinding, + ( + | protos.google.cloud.websecurityscanner.v1.IGetFindingRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getFinding response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * List all FindingTypeStats under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse|ListFindingTypeStatsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.list_finding_type_stats.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async - */ + /** + * List all FindingTypeStats under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse|ListFindingTypeStatsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.list_finding_type_stats.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListFindingTypeStats_async + */ listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + ( + | protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest + | undefined + ), + {} | undefined, + ] + >; listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + | protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + | protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + | protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + ( + | protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('listFindingTypeStats request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + | protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('listFindingTypeStats response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.listFindingTypeStats(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest|undefined, - {}|undefined - ]) => { - this._log.info('listFindingTypeStats response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .listFindingTypeStats(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse, + ( + | protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listFindingTypeStats response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } - /** - * Lists ScanConfigs under a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 Array of {@link protos.google.cloud.websecurityscanner.v1.ScanConfig|ScanConfig}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listScanConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists ScanConfigs under a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 Array of {@link protos.google.cloud.websecurityscanner.v1.ScanConfig|ScanConfig}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listScanConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig[], - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse - ]>; + request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanConfig[], + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest | null, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse, + ] + >; listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanConfig>): void; + request: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + | protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IScanConfig + >, + ): void; listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanConfig>): void; + request: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + | protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IScanConfig + >, + ): void; listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< + request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanConfig>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanConfig>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanConfig[], - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse - ]>|void { + | protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IScanConfig + >, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + | protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IScanConfig + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanConfig[], + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest | null, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanConfig>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + | protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IScanConfig + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listScanConfigs values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1305,205 +1822,234 @@ export class WebSecurityScannerClient { this._log.info('listScanConfigs request %j', request); return this.innerApiCalls .listScanConfigs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.websecurityscanner.v1.IScanConfig[], - protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse - ]) => { - this._log.info('listScanConfigs values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.websecurityscanner.v1.IScanConfig[], + protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest | null, + protos.google.cloud.websecurityscanner.v1.IListScanConfigsResponse, + ]) => { + this._log.info('listScanConfigs values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listScanConfigs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1.ScanConfig|ScanConfig} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listScanConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listScanConfigs`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1.ScanConfig|ScanConfig} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listScanConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listScanConfigsStream( - request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listScanConfigs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listScanConfigs stream %j', request); return this.descriptors.page.listScanConfigs.createStream( this.innerApiCalls.listScanConfigs as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listScanConfigs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.websecurityscanner.v1.ScanConfig|ScanConfig}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.list_scan_configs.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async - */ + /** + * Equivalent to `listScanConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.websecurityscanner.v1.ScanConfig|ScanConfig}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.list_scan_configs.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListScanConfigs_async + */ listScanConfigsAsync( - request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.websecurityscanner.v1.IListScanConfigsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listScanConfigs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listScanConfigs iterate %j', request); return this.descriptors.page.listScanConfigs.asyncIterate( this.innerApiCalls['listScanConfigs'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - * stop time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 Array of {@link protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listScanRunsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + * stop time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 Array of {@link protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listScanRunsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun[], - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse - ]>; + request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanRun[], + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest | null, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse, + ] + >; listScanRuns( - request: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanRun>): void; + request: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + | protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IScanRun + >, + ): void; listScanRuns( - request: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanRun>): void; + request: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + | protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IScanRun + >, + ): void; listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< + request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanRun>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanRun>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IScanRun[], - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse - ]>|void { + | protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IScanRun + >, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + | protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IScanRun + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IScanRun[], + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest | null, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IScanRun>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + | protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IScanRun + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listScanRuns values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1512,205 +2058,234 @@ export class WebSecurityScannerClient { this._log.info('listScanRuns request %j', request); return this.innerApiCalls .listScanRuns(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.websecurityscanner.v1.IScanRun[], - protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse - ]) => { - this._log.info('listScanRuns values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.websecurityscanner.v1.IScanRun[], + protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest | null, + protos.google.cloud.websecurityscanner.v1.IListScanRunsResponse, + ]) => { + this._log.info('listScanRuns values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listScanRuns`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listScanRunsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listScanRuns`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listScanRunsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listScanRunsStream( - request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listScanRuns']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listScanRuns stream %j', request); return this.descriptors.page.listScanRuns.createStream( this.innerApiCalls.listScanRuns as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listScanRuns`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.list_scan_runs.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async - */ + /** + * Equivalent to `listScanRuns`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.websecurityscanner.v1.ScanRun|ScanRun}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.list_scan_runs.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListScanRuns_async + */ listScanRunsAsync( - request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.websecurityscanner.v1.IListScanRunsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listScanRuns']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listScanRuns iterate %j', request); return this.descriptors.page.listScanRuns.asyncIterate( this.innerApiCalls['listScanRuns'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * List CrawledUrls under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 Array of {@link protos.google.cloud.websecurityscanner.v1.CrawledUrl|CrawledUrl}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCrawledUrlsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * List CrawledUrls under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 Array of {@link protos.google.cloud.websecurityscanner.v1.CrawledUrl|CrawledUrl}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCrawledUrlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse - ]>; + request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest | null, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse, + ] + >; listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): void; + request: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + | protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.ICrawledUrl + >, + ): void; listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): void; + request: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + | protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.ICrawledUrl + >, + ): void; listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< + request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.ICrawledUrl>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.ICrawledUrl>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse - ]>|void { + | protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.ICrawledUrl + >, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + | protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.ICrawledUrl + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest | null, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.ICrawledUrl>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + | protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.ICrawledUrl + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listCrawledUrls values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1719,212 +2294,241 @@ export class WebSecurityScannerClient { this._log.info('listCrawledUrls request %j', request); return this.innerApiCalls .listCrawledUrls(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.websecurityscanner.v1.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse - ]) => { - this._log.info('listCrawledUrls values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.websecurityscanner.v1.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest | null, + protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsResponse, + ]) => { + this._log.info('listCrawledUrls values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listCrawledUrls`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1.CrawledUrl|CrawledUrl} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listCrawledUrlsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listCrawledUrls`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1.CrawledUrl|CrawledUrl} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCrawledUrlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listCrawledUrlsStream( - request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listCrawledUrls']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listCrawledUrls stream %j', request); return this.descriptors.page.listCrawledUrls.createStream( this.innerApiCalls.listCrawledUrls as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listCrawledUrls`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.websecurityscanner.v1.CrawledUrl|CrawledUrl}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.list_crawled_urls.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async - */ + /** + * Equivalent to `listCrawledUrls`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.websecurityscanner.v1.CrawledUrl|CrawledUrl}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.list_crawled_urls.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListCrawledUrls_async + */ listCrawledUrlsAsync( - request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.websecurityscanner.v1.IListCrawledUrlsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listCrawledUrls']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listCrawledUrls iterate %j', request); return this.descriptors.page.listCrawledUrls.asyncIterate( this.innerApiCalls['listCrawledUrls'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * List Findings under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 Array of {@link protos.google.cloud.websecurityscanner.v1.Finding|Finding}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * List Findings under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 Array of {@link protos.google.cloud.websecurityscanner.v1.Finding|Finding}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listFindings( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IFinding[], - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse - ]>; + request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IFinding[], + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest | null, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse, + ] + >; listFindings( - request: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IFinding>): void; + request: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + | protos.google.cloud.websecurityscanner.v1.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IFinding + >, + ): void; listFindings( - request: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IFinding>): void; + request: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + | protos.google.cloud.websecurityscanner.v1.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IFinding + >, + ): void; listFindings( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IFinding>, - callback?: PaginationCallback< + request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IFinding>): - Promise<[ - protos.google.cloud.websecurityscanner.v1.IFinding[], - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse - ]>|void { + | protos.google.cloud.websecurityscanner.v1.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IFinding + >, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + | protos.google.cloud.websecurityscanner.v1.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IFinding + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1.IFinding[], + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest | null, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1.IFinding>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + | protos.google.cloud.websecurityscanner.v1.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1.IFinding + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listFindings values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1933,128 +2537,132 @@ export class WebSecurityScannerClient { this._log.info('listFindings request %j', request); return this.innerApiCalls .listFindings(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.websecurityscanner.v1.IFinding[], - protos.google.cloud.websecurityscanner.v1.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1.IListFindingsResponse - ]) => { - this._log.info('listFindings values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.websecurityscanner.v1.IFinding[], + protos.google.cloud.websecurityscanner.v1.IListFindingsRequest | null, + protos.google.cloud.websecurityscanner.v1.IListFindingsResponse, + ]) => { + this._log.info('listFindings values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listFindings`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1.Finding|Finding} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listFindings`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1.Finding|Finding} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listFindingsStream( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listFindings']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listFindings stream %j', request); return this.descriptors.page.listFindings.createStream( this.innerApiCalls.listFindings as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listFindings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.websecurityscanner.v1.Finding|Finding}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/web_security_scanner.list_findings.js - * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async - */ + /** + * Equivalent to `listFindings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.websecurityscanner.v1.Finding|Finding}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/web_security_scanner.list_findings.js + * region_tag:websecurityscanner_v1_generated_WebSecurityScanner_ListFindings_async + */ listFindingsAsync( - request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.websecurityscanner.v1.IListFindingsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listFindings']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listFindings iterate %j', request); return this.descriptors.page.listFindings.asyncIterate( this.innerApiCalls['listFindings'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } // -------------------- @@ -2070,7 +2678,12 @@ export class WebSecurityScannerClient { * @param {string} finding * @returns {string} Resource name string. */ - findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { + findingPath( + project: string, + scanConfig: string, + scanRun: string, + finding: string, + ) { return this.pathTemplates.findingPathTemplate.render({ project: project, scan_config: scanConfig, @@ -2098,7 +2711,8 @@ export class WebSecurityScannerClient { * @returns {string} A string representing the scan_config. */ matchScanConfigFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; + return this.pathTemplates.findingPathTemplate.match(findingName) + .scan_config; } /** @@ -2131,7 +2745,7 @@ export class WebSecurityScannerClient { */ close(): Promise { if (this.webSecurityScannerStub && !this._terminated) { - return this.webSecurityScannerStub.then(stub => { + return this.webSecurityScannerStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -2139,4 +2753,4 @@ export class WebSecurityScannerClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-websecurityscanner/src/v1alpha/index.ts b/packages/google-cloud-websecurityscanner/src/v1alpha/index.ts index 6adb55d6a1d4..0dd68252ab0d 100644 --- a/packages/google-cloud-websecurityscanner/src/v1alpha/index.ts +++ b/packages/google-cloud-websecurityscanner/src/v1alpha/index.ts @@ -16,4 +16,4 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {WebSecurityScannerClient} from './web_security_scanner_client'; +export { WebSecurityScannerClient } from './web_security_scanner_client'; diff --git a/packages/google-cloud-websecurityscanner/src/v1alpha/web_security_scanner_client.ts b/packages/google-cloud-websecurityscanner/src/v1alpha/web_security_scanner_client.ts index 8d36b5fdebe7..b1cb31d84080 100644 --- a/packages/google-cloud-websecurityscanner/src/v1alpha/web_security_scanner_client.ts +++ b/packages/google-cloud-websecurityscanner/src/v1alpha/web_security_scanner_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -46,7 +53,7 @@ export class WebSecurityScannerClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('web-security-scanner'); @@ -59,9 +66,9 @@ export class WebSecurityScannerClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - webSecurityScannerStub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + webSecurityScannerStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of WebSecurityScannerClient. @@ -102,21 +109,42 @@ export class WebSecurityScannerClient { * const client = new WebSecurityScannerClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof WebSecurityScannerClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'websecurityscanner.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -141,7 +169,7 @@ export class WebSecurityScannerClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,10 +183,7 @@ export class WebSecurityScannerClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -180,16 +205,16 @@ export class WebSecurityScannerClient { // Create useful helper objects for these. this.pathTemplates = { findingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), scanConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}' + 'projects/{project}/scanConfigs/{scan_config}', ), scanRunPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}' + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}', ), }; @@ -197,20 +222,35 @@ export class WebSecurityScannerClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listScanConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), - listScanRuns: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), - listCrawledUrls: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') + listScanConfigs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'scanConfigs', + ), + listScanRuns: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'scanRuns', + ), + listCrawledUrls: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'crawledUrls', + ), + listFindings: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'findings', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.websecurityscanner.v1alpha.WebSecurityScanner', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.websecurityscanner.v1alpha.WebSecurityScanner', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -241,37 +281,55 @@ export class WebSecurityScannerClient { // Put together the "service stub" for // google.cloud.websecurityscanner.v1alpha.WebSecurityScanner. this.webSecurityScannerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1alpha.WebSecurityScanner') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.websecurityscanner.v1alpha.WebSecurityScanner, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.websecurityscanner.v1alpha.WebSecurityScanner', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.websecurityscanner.v1alpha + .WebSecurityScanner, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const webSecurityScannerStubMethods = - ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; + const webSecurityScannerStubMethods = [ + 'createScanConfig', + 'deleteScanConfig', + 'getScanConfig', + 'listScanConfigs', + 'updateScanConfig', + 'startScanRun', + 'getScanRun', + 'listScanRuns', + 'stopScanRun', + 'listCrawledUrls', + 'getFinding', + 'listFindings', + 'listFindingTypeStats', + ]; for (const methodName of webSecurityScannerStubMethods) { const callPromise = this.webSecurityScannerStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -286,8 +344,14 @@ export class WebSecurityScannerClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'websecurityscanner.googleapis.com'; } @@ -298,8 +362,14 @@ export class WebSecurityScannerClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'websecurityscanner.googleapis.com'; } @@ -330,9 +400,7 @@ export class WebSecurityScannerClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -341,8 +409,9 @@ export class WebSecurityScannerClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -353,959 +422,1425 @@ export class WebSecurityScannerClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Creates a new ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - * @param {google.cloud.websecurityscanner.v1alpha.ScanConfig} request.scanConfig - * Required. The ScanConfig to be created. - * @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 protos.google.cloud.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/web_security_scanner.create_scan_config.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async - */ + /** + * Creates a new ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * @param {google.cloud.websecurityscanner.v1alpha.ScanConfig} request.scanConfig + * Required. The ScanConfig to be created. + * @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 protos.google.cloud.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/web_security_scanner.create_scan_config.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_CreateScanConfig_async + */ createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest + | undefined + ), + {} | undefined, + ] + >; createScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + | protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + | protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + | protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createScanConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + | protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createScanConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createScanConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('createScanConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createScanConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1alpha.ICreateScanConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createScanConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes an existing ScanConfig and its child resources. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/web_security_scanner.delete_scan_config.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async - */ + /** + * Deletes an existing ScanConfig and its child resources. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/web_security_scanner.delete_scan_config.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_DeleteScanConfig_async + */ deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest + | undefined + ), + {} | undefined, + ] + >; deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteScanConfig request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteScanConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteScanConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteScanConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .deleteScanConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IDeleteScanConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deleteScanConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 protos.google.cloud.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/web_security_scanner.get_scan_config.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async - */ + /** + * Gets a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 protos.google.cloud.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/web_security_scanner.get_scan_config.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanConfig_async + */ getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest + | undefined + ), + {} | undefined, + ] + >; getScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getScanConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getScanConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getScanConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getScanConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getScanConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getScanConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates a ScanConfig. This method support partial update of a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.websecurityscanner.v1alpha.ScanConfig} request.scanConfig - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - * @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 protos.google.cloud.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/web_security_scanner.update_scan_config.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async - */ + /** + * Updates a ScanConfig. This method support partial update of a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.websecurityscanner.v1alpha.ScanConfig} request.scanConfig + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * @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 protos.google.cloud.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/web_security_scanner.update_scan_config.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_UpdateScanConfig_async + */ updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest + | undefined + ), + {} | undefined, + ] + >; updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + | protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + | protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + | protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scan_config.name': request.scanConfig!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'scan_config.name': request.scanConfig!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateScanConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + | protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateScanConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateScanConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, - protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateScanConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateScanConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IUpdateScanConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateScanConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Start a ScanRun according to the given ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/web_security_scanner.start_scan_run.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async - */ + /** + * Start a ScanRun according to the given ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/web_security_scanner.start_scan_run.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_StartScanRun_async + */ startScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest + | undefined + ), + {} | undefined, + ] + >; startScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + | protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; startScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + | protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; startScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + | protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('startScanRun request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + | protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('startScanRun response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.startScanRun(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest|undefined, - {}|undefined - ]) => { - this._log.info('startScanRun response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .startScanRun(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IStartScanRunRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('startScanRun response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/web_security_scanner.get_scan_run.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async - */ + /** + * Gets a ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/web_security_scanner.get_scan_run.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetScanRun_async + */ getScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest + | undefined + ), + {} | undefined, + ] + >; getScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getScanRun request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getScanRun response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getScanRun(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest|undefined, - {}|undefined - ]) => { - this._log.info('getScanRun response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getScanRun(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IGetScanRunRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getScanRun response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Stops a ScanRun. The stopped ScanRun is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/web_security_scanner.stop_scan_run.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async - */ + /** + * Stops a ScanRun. The stopped ScanRun is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/web_security_scanner.stop_scan_run.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_StopScanRun_async + */ stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest + | undefined + ), + {} | undefined, + ] + >; stopScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + | protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; stopScanRun( - request: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + | protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + | protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('stopScanRun request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + | protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('stopScanRun response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.stopScanRun(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun, - protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest|undefined, - {}|undefined - ]) => { - this._log.info('stopScanRun response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .stopScanRun(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IStopScanRunRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('stopScanRun response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a Finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - * @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 protos.google.cloud.websecurityscanner.v1alpha.Finding|Finding}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/web_security_scanner.get_finding.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async - */ + /** + * Gets a Finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * @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 protos.google.cloud.websecurityscanner.v1alpha.Finding|Finding}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/web_security_scanner.get_finding.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_GetFinding_async + */ getFinding( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest + | undefined + ), + {} | undefined, + ] + >; getFinding( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + | protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getFinding( - request: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + | protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getFinding( - request?: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + | protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getFinding request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + | protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getFinding response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getFinding(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1alpha.IFinding, - protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest|undefined, - {}|undefined - ]) => { - this._log.info('getFinding response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getFinding(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1alpha.IFinding, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IGetFindingRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getFinding response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * List all FindingTypeStats under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse|ListFindingTypeStatsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async - */ + /** + * List all FindingTypeStats under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse|ListFindingTypeStatsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/web_security_scanner.list_finding_type_stats.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindingTypeStats_async + */ listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest + | undefined + ), + {} | undefined, + ] + >; listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + | protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + | protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + | protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('listFindingTypeStats request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + | protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('listFindingTypeStats response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.listFindingTypeStats(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest|undefined, - {}|undefined - ]) => { - this._log.info('listFindingTypeStats response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .listFindingTypeStats(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse, + ( + | protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listFindingTypeStats response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } - /** - * Lists ScanConfigs under a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 Array of {@link protos.google.cloud.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listScanConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists ScanConfigs under a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 Array of {@link protos.google.cloud.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listScanConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[], - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse - ]>; + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[], + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest | null, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse, + ] + >; listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig + >, + ): void; listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig + >, + ): void; listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[], - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse - ]>|void { + | protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig + >, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[], + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest | null, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listScanConfigs values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1314,205 +1849,234 @@ export class WebSecurityScannerClient { this._log.info('listScanConfigs request %j', request); return this.innerApiCalls .listScanConfigs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[], - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse - ]) => { - this._log.info('listScanConfigs values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[], + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest | null, + protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsResponse, + ]) => { + this._log.info('listScanConfigs values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listScanConfigs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.ScanConfig|ScanConfig} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listScanConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listScanConfigs`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.ScanConfig|ScanConfig} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listScanConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listScanConfigsStream( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listScanConfigs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listScanConfigs stream %j', request); return this.descriptors.page.listScanConfigs.createStream( this.innerApiCalls.listScanConfigs as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listScanConfigs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/web_security_scanner.list_scan_configs.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async - */ + /** + * Equivalent to `listScanConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.websecurityscanner.v1alpha.ScanConfig|ScanConfig}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/web_security_scanner.list_scan_configs.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanConfigs_async + */ listScanConfigsAsync( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanConfigsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listScanConfigs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listScanConfigs iterate %j', request); return this.descriptors.page.listScanConfigs.asyncIterate( this.innerApiCalls['listScanConfigs'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - * stop time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 Array of {@link protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listScanRunsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + * stop time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 Array of {@link protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listScanRunsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun[], - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse - ]>; + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun[], + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest | null, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse, + ] + >; listScanRuns( - request: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanRun + >, + ): void; listScanRuns( - request: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanRun + >, + ): void; listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanRun>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanRun>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun[], - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse - ]>|void { + | protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanRun + >, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanRun + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun[], + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest | null, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IScanRun>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IScanRun + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listScanRuns values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1521,205 +2085,234 @@ export class WebSecurityScannerClient { this._log.info('listScanRuns request %j', request); return this.innerApiCalls .listScanRuns(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.websecurityscanner.v1alpha.IScanRun[], - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse - ]) => { - this._log.info('listScanRuns values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.websecurityscanner.v1alpha.IScanRun[], + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest | null, + protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsResponse, + ]) => { + this._log.info('listScanRuns values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listScanRuns`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listScanRunsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listScanRuns`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listScanRunsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listScanRunsStream( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listScanRuns']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listScanRuns stream %j', request); return this.descriptors.page.listScanRuns.createStream( this.innerApiCalls.listScanRuns as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listScanRuns`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/web_security_scanner.list_scan_runs.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async - */ + /** + * Equivalent to `listScanRuns`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.websecurityscanner.v1alpha.ScanRun|ScanRun}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/web_security_scanner.list_scan_runs.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListScanRuns_async + */ listScanRunsAsync( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.websecurityscanner.v1alpha.IListScanRunsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listScanRuns']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listScanRuns iterate %j', request); return this.descriptors.page.listScanRuns.asyncIterate( this.innerApiCalls['listScanRuns'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * List CrawledUrls under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 Array of {@link protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl|CrawledUrl}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCrawledUrlsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * List CrawledUrls under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 Array of {@link protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl|CrawledUrl}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCrawledUrlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse - ]>; + request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest | null, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse, + ] + >; listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl + >, + ): void; listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl + >, + ): void; listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>, - callback?: PaginationCallback< + request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse - ]>|void { + | protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl + >, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest | null, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listCrawledUrls values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1728,212 +2321,241 @@ export class WebSecurityScannerClient { this._log.info('listCrawledUrls request %j', request); return this.innerApiCalls .listCrawledUrls(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse - ]) => { - this._log.info('listCrawledUrls values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest | null, + protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsResponse, + ]) => { + this._log.info('listCrawledUrls values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listCrawledUrls`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl|CrawledUrl} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listCrawledUrlsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listCrawledUrls`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl|CrawledUrl} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCrawledUrlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listCrawledUrlsStream( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listCrawledUrls']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listCrawledUrls stream %j', request); return this.descriptors.page.listCrawledUrls.createStream( this.innerApiCalls.listCrawledUrls as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listCrawledUrls`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl|CrawledUrl}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async - */ + /** + * Equivalent to `listCrawledUrls`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl|CrawledUrl}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/web_security_scanner.list_crawled_urls.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListCrawledUrls_async + */ listCrawledUrlsAsync( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.websecurityscanner.v1alpha.IListCrawledUrlsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listCrawledUrls']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listCrawledUrls iterate %j', request); return this.descriptors.page.listCrawledUrls.asyncIterate( this.innerApiCalls['listCrawledUrls'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * List Findings under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 Array of {@link protos.google.cloud.websecurityscanner.v1alpha.Finding|Finding}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * List Findings under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 Array of {@link protos.google.cloud.websecurityscanner.v1alpha.Finding|Finding}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listFindings( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IFinding[], - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse - ]>; + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IFinding[], + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest | null, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse, + ] + >; listFindings( - request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IFinding>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IFinding + >, + ): void; listFindings( - request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IFinding>): void; + request: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IFinding + >, + ): void; listFindings( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IFinding>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IFinding>): - Promise<[ - protos.google.cloud.websecurityscanner.v1alpha.IFinding[], - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse - ]>|void { + | protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IFinding + >, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IFinding + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1alpha.IFinding[], + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest | null, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1alpha.IFinding>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + | protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1alpha.IFinding + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listFindings values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1942,128 +2564,132 @@ export class WebSecurityScannerClient { this._log.info('listFindings request %j', request); return this.innerApiCalls .listFindings(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.websecurityscanner.v1alpha.IFinding[], - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse - ]) => { - this._log.info('listFindings values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.websecurityscanner.v1alpha.IFinding[], + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest | null, + protos.google.cloud.websecurityscanner.v1alpha.IListFindingsResponse, + ]) => { + this._log.info('listFindings values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listFindings`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.Finding|Finding} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listFindings`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1alpha.Finding|Finding} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listFindingsStream( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listFindings']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listFindings stream %j', request); return this.descriptors.page.listFindings.createStream( this.innerApiCalls.listFindings as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listFindings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.websecurityscanner.v1alpha.Finding|Finding}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1alpha/web_security_scanner.list_findings.js - * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async - */ + /** + * Equivalent to `listFindings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.websecurityscanner.v1alpha.Finding|Finding}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1alpha/web_security_scanner.list_findings.js + * region_tag:websecurityscanner_v1alpha_generated_WebSecurityScanner_ListFindings_async + */ listFindingsAsync( - request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listFindings']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listFindings iterate %j', request); return this.descriptors.page.listFindings.asyncIterate( this.innerApiCalls['listFindings'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } // -------------------- @@ -2079,7 +2705,12 @@ export class WebSecurityScannerClient { * @param {string} finding * @returns {string} Resource name string. */ - findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { + findingPath( + project: string, + scanConfig: string, + scanRun: string, + finding: string, + ) { return this.pathTemplates.findingPathTemplate.render({ project: project, scan_config: scanConfig, @@ -2107,7 +2738,8 @@ export class WebSecurityScannerClient { * @returns {string} A string representing the scan_config. */ matchScanConfigFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; + return this.pathTemplates.findingPathTemplate.match(findingName) + .scan_config; } /** @@ -2138,7 +2770,7 @@ export class WebSecurityScannerClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -2162,7 +2794,7 @@ export class WebSecurityScannerClient { * @param {string} scan_config * @returns {string} Resource name string. */ - scanConfigPath(project:string,scanConfig:string) { + scanConfigPath(project: string, scanConfig: string) { return this.pathTemplates.scanConfigPathTemplate.render({ project: project, scan_config: scanConfig, @@ -2177,7 +2809,8 @@ export class WebSecurityScannerClient { * @returns {string} A string representing the project. */ matchProjectFromScanConfigName(scanConfigName: string) { - return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).project; + return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName) + .project; } /** @@ -2188,7 +2821,8 @@ export class WebSecurityScannerClient { * @returns {string} A string representing the scan_config. */ matchScanConfigFromScanConfigName(scanConfigName: string) { - return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).scan_config; + return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName) + .scan_config; } /** @@ -2199,7 +2833,7 @@ export class WebSecurityScannerClient { * @param {string} scan_run * @returns {string} Resource name string. */ - scanRunPath(project:string,scanConfig:string,scanRun:string) { + scanRunPath(project: string, scanConfig: string, scanRun: string) { return this.pathTemplates.scanRunPathTemplate.render({ project: project, scan_config: scanConfig, @@ -2226,7 +2860,8 @@ export class WebSecurityScannerClient { * @returns {string} A string representing the scan_config. */ matchScanConfigFromScanRunName(scanRunName: string) { - return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_config; + return this.pathTemplates.scanRunPathTemplate.match(scanRunName) + .scan_config; } /** @@ -2248,7 +2883,7 @@ export class WebSecurityScannerClient { */ close(): Promise { if (this.webSecurityScannerStub && !this._terminated) { - return this.webSecurityScannerStub.then(stub => { + return this.webSecurityScannerStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -2256,4 +2891,4 @@ export class WebSecurityScannerClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-websecurityscanner/src/v1beta/index.ts b/packages/google-cloud-websecurityscanner/src/v1beta/index.ts index 6adb55d6a1d4..0dd68252ab0d 100644 --- a/packages/google-cloud-websecurityscanner/src/v1beta/index.ts +++ b/packages/google-cloud-websecurityscanner/src/v1beta/index.ts @@ -16,4 +16,4 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {WebSecurityScannerClient} from './web_security_scanner_client'; +export { WebSecurityScannerClient } from './web_security_scanner_client'; diff --git a/packages/google-cloud-websecurityscanner/src/v1beta/web_security_scanner_client.ts b/packages/google-cloud-websecurityscanner/src/v1beta/web_security_scanner_client.ts index aa657c33f864..397736c6a3f8 100644 --- a/packages/google-cloud-websecurityscanner/src/v1beta/web_security_scanner_client.ts +++ b/packages/google-cloud-websecurityscanner/src/v1beta/web_security_scanner_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -46,7 +53,7 @@ export class WebSecurityScannerClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('web-security-scanner'); @@ -59,9 +66,9 @@ export class WebSecurityScannerClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - webSecurityScannerStub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + webSecurityScannerStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of WebSecurityScannerClient. @@ -102,21 +109,42 @@ export class WebSecurityScannerClient { * const client = new WebSecurityScannerClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof WebSecurityScannerClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'websecurityscanner.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -141,7 +169,7 @@ export class WebSecurityScannerClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,10 +183,7 @@ export class WebSecurityScannerClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -180,16 +205,16 @@ export class WebSecurityScannerClient { // Create useful helper objects for these. this.pathTemplates = { findingPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}' + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), scanConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}' + 'projects/{project}/scanConfigs/{scan_config}', ), scanRunPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}' + 'projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}', ), }; @@ -197,20 +222,35 @@ export class WebSecurityScannerClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listScanConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanConfigs'), - listScanRuns: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scanRuns'), - listCrawledUrls: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'crawledUrls'), - listFindings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'findings') + listScanConfigs: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'scanConfigs', + ), + listScanRuns: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'scanRuns', + ), + listCrawledUrls: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'crawledUrls', + ), + listFindings: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'findings', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.websecurityscanner.v1beta.WebSecurityScanner', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.websecurityscanner.v1beta.WebSecurityScanner', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -241,37 +281,55 @@ export class WebSecurityScannerClient { // Put together the "service stub" for // google.cloud.websecurityscanner.v1beta.WebSecurityScanner. this.webSecurityScannerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.websecurityscanner.v1beta.WebSecurityScanner') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.websecurityscanner.v1beta.WebSecurityScanner, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.websecurityscanner.v1beta.WebSecurityScanner', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.websecurityscanner.v1beta + .WebSecurityScanner, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const webSecurityScannerStubMethods = - ['createScanConfig', 'deleteScanConfig', 'getScanConfig', 'listScanConfigs', 'updateScanConfig', 'startScanRun', 'getScanRun', 'listScanRuns', 'stopScanRun', 'listCrawledUrls', 'getFinding', 'listFindings', 'listFindingTypeStats']; + const webSecurityScannerStubMethods = [ + 'createScanConfig', + 'deleteScanConfig', + 'getScanConfig', + 'listScanConfigs', + 'updateScanConfig', + 'startScanRun', + 'getScanRun', + 'listScanRuns', + 'stopScanRun', + 'listCrawledUrls', + 'getFinding', + 'listFindings', + 'listFindingTypeStats', + ]; for (const methodName of webSecurityScannerStubMethods) { const callPromise = this.webSecurityScannerStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -286,8 +344,14 @@ export class WebSecurityScannerClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'websecurityscanner.googleapis.com'; } @@ -298,8 +362,14 @@ export class WebSecurityScannerClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'websecurityscanner.googleapis.com'; } @@ -330,9 +400,7 @@ export class WebSecurityScannerClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -341,8 +409,9 @@ export class WebSecurityScannerClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -353,959 +422,1425 @@ export class WebSecurityScannerClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Creates a new ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name where the scan is created, which should be a - * project resource name in the format 'projects/{projectId}'. - * @param {google.cloud.websecurityscanner.v1beta.ScanConfig} request.scanConfig - * Required. The ScanConfig to be created. - * @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 protos.google.cloud.websecurityscanner.v1beta.ScanConfig|ScanConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/web_security_scanner.create_scan_config.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async - */ + /** + * Creates a new ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name where the scan is created, which should be a + * project resource name in the format 'projects/{projectId}'. + * @param {google.cloud.websecurityscanner.v1beta.ScanConfig} request.scanConfig + * Required. The ScanConfig to be created. + * @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 protos.google.cloud.websecurityscanner.v1beta.ScanConfig|ScanConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/web_security_scanner.create_scan_config.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_CreateScanConfig_async + */ createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest + | undefined + ), + {} | undefined, + ] + >; createScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + | protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + | protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + | protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createScanConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + | protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createScanConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createScanConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('createScanConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createScanConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1beta.ICreateScanConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createScanConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes an existing ScanConfig and its child resources. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be deleted. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/web_security_scanner.delete_scan_config.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async - */ + /** + * Deletes an existing ScanConfig and its child resources. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be deleted. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/web_security_scanner.delete_scan_config.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_DeleteScanConfig_async + */ deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest + | undefined + ), + {} | undefined, + ] + >; deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; deleteScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteScanConfig request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteScanConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteScanConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteScanConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .deleteScanConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.websecurityscanner.v1beta.IDeleteScanConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('deleteScanConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be returned. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 protos.google.cloud.websecurityscanner.v1beta.ScanConfig|ScanConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/web_security_scanner.get_scan_config.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async - */ + /** + * Gets a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be returned. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 protos.google.cloud.websecurityscanner.v1beta.ScanConfig|ScanConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/web_security_scanner.get_scan_config.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanConfig_async + */ getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest + | undefined + ), + {} | undefined, + ] + >; getScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + | protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + | protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + | protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getScanConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + | protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getScanConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getScanConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getScanConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getScanConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1beta.IGetScanConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getScanConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates a ScanConfig. This method support partial update of a ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.websecurityscanner.v1beta.ScanConfig} request.scanConfig - * Required. The ScanConfig to be updated. The name field must be set to identify the - * resource to be updated. The values of fields not covered by the mask - * will be ignored. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The update mask applies to the resource. For the `FieldMask` definition, - * see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask - * @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 protos.google.cloud.websecurityscanner.v1beta.ScanConfig|ScanConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/web_security_scanner.update_scan_config.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async - */ + /** + * Updates a ScanConfig. This method support partial update of a ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.websecurityscanner.v1beta.ScanConfig} request.scanConfig + * Required. The ScanConfig to be updated. The name field must be set to identify the + * resource to be updated. The values of fields not covered by the mask + * will be ignored. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The update mask applies to the resource. For the `FieldMask` definition, + * see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * @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 protos.google.cloud.websecurityscanner.v1beta.ScanConfig|ScanConfig}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/web_security_scanner.update_scan_config.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_UpdateScanConfig_async + */ updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest + | undefined + ), + {} | undefined, + ] + >; updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + | protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateScanConfig( - request: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + | protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateScanConfig( - request?: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + | protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'scan_config.name': request.scanConfig!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'scan_config.name': request.scanConfig!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateScanConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + | protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateScanConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateScanConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig, - protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateScanConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateScanConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig, + ( + | protos.google.cloud.websecurityscanner.v1beta.IUpdateScanConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateScanConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Start a ScanRun according to the given ScanConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanConfig to be used. The name follows the - * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @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 protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/web_security_scanner.start_scan_run.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async - */ + /** + * Start a ScanRun according to the given ScanConfig. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanConfig to be used. The name follows the + * format of 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @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 protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/web_security_scanner.start_scan_run.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_StartScanRun_async + */ startScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest + | undefined + ), + {} | undefined, + ] + >; startScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + | protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; startScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + | protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; startScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + | protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('startScanRun request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + | protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('startScanRun response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.startScanRun(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest|undefined, - {}|undefined - ]) => { - this._log.info('startScanRun response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .startScanRun(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1beta.IStartScanRunRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('startScanRun response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/web_security_scanner.get_scan_run.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async - */ + /** + * Gets a ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/web_security_scanner.get_scan_run.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetScanRun_async + */ getScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest + | undefined + ), + {} | undefined, + ] + >; getScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + | protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + | protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + | protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getScanRun request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + | protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getScanRun response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getScanRun(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest|undefined, - {}|undefined - ]) => { - this._log.info('getScanRun response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getScanRun(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1beta.IGetScanRunRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getScanRun response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Stops a ScanRun. The stopped ScanRun is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ScanRun to be stopped. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/web_security_scanner.stop_scan_run.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async - */ + /** + * Stops a ScanRun. The stopped ScanRun is returned. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ScanRun to be stopped. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/web_security_scanner.stop_scan_run.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_StopScanRun_async + */ stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest + | undefined + ), + {} | undefined, + ] + >; stopScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + | protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; stopScanRun( - request: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + | protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): void; stopScanRun( - request?: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + | protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('stopScanRun request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + | protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('stopScanRun response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.stopScanRun(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1beta.IScanRun, - protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest|undefined, - {}|undefined - ]) => { - this._log.info('stopScanRun response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .stopScanRun(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1beta.IScanRun, + ( + | protos.google.cloud.websecurityscanner.v1beta.IStopScanRunRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('stopScanRun response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets a Finding. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Finding to be returned. The name follows the - * format of - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. - * @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 protos.google.cloud.websecurityscanner.v1beta.Finding|Finding}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/web_security_scanner.get_finding.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async - */ + /** + * Gets a Finding. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Finding to be returned. The name follows the + * format of + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. + * @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 protos.google.cloud.websecurityscanner.v1beta.Finding|Finding}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/web_security_scanner.get_finding.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_GetFinding_async + */ getFinding( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IFinding, + ( + | protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest + | undefined + ), + {} | undefined, + ] + >; getFinding( - request: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IFinding, + | protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getFinding( - request: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IFinding, + | protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getFinding( - request?: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IFinding, + | protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IFinding, + ( + | protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getFinding request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1beta.IFinding, + | protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getFinding response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getFinding(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1beta.IFinding, - protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest|undefined, - {}|undefined - ]) => { - this._log.info('getFinding response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getFinding(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1beta.IFinding, + ( + | protos.google.cloud.websecurityscanner.v1beta.IGetFindingRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getFinding response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * List all FindingTypeStats under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @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 protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse|ListFindingTypeStatsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async - */ + /** + * List all FindingTypeStats under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @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 protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse|ListFindingTypeStatsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/web_security_scanner.list_finding_type_stats.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindingTypeStats_async + */ listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + ( + | protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest + | undefined + ), + {} | undefined, + ] + >; listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + | protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listFindingTypeStats( - request: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, - callback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, + callback: Callback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + | protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listFindingTypeStats( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + | protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + ( + | protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('listFindingTypeStats request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + | protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('listFindingTypeStats response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.listFindingTypeStats(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, - protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest|undefined, - {}|undefined - ]) => { - this._log.info('listFindingTypeStats response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .listFindingTypeStats(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse, + ( + | protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listFindingTypeStats response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } - /** - * Lists ScanConfigs under a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 Array of {@link protos.google.cloud.websecurityscanner.v1beta.ScanConfig|ScanConfig}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listScanConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists ScanConfigs under a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 Array of {@link protos.google.cloud.websecurityscanner.v1beta.ScanConfig|ScanConfig}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listScanConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig[], - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse - ]>; + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig[], + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest | null, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse, + ] + >; listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanConfig + >, + ): void; listScanConfigs( - request: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanConfig + >, + ): void; listScanConfigs( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanConfig>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanConfig>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig[], - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse - ]>|void { + | protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanConfig + >, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanConfig + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig[], + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest | null, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanConfig>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanConfig + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listScanConfigs values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1314,205 +1849,234 @@ export class WebSecurityScannerClient { this._log.info('listScanConfigs request %j', request); return this.innerApiCalls .listScanConfigs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.websecurityscanner.v1beta.IScanConfig[], - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse - ]) => { - this._log.info('listScanConfigs values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.websecurityscanner.v1beta.IScanConfig[], + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest | null, + protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsResponse, + ]) => { + this._log.info('listScanConfigs values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listScanConfigs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1beta.ScanConfig|ScanConfig} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listScanConfigsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listScanConfigs`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1beta.ScanConfig|ScanConfig} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listScanConfigsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listScanConfigsStream( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listScanConfigs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listScanConfigs stream %j', request); return this.descriptors.page.listScanConfigs.createStream( this.innerApiCalls.listScanConfigs as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listScanConfigs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a project resource name in the - * format 'projects/{projectId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanConfigs to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.websecurityscanner.v1beta.ScanConfig|ScanConfig}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/web_security_scanner.list_scan_configs.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async - */ + /** + * Equivalent to `listScanConfigs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a project resource name in the + * format 'projects/{projectId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanConfigs to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.websecurityscanner.v1beta.ScanConfig|ScanConfig}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/web_security_scanner.list_scan_configs.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanConfigs_async + */ listScanConfigsAsync( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanConfigsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listScanConfigs']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listScanConfigs iterate %j', request); return this.descriptors.page.listScanConfigs.asyncIterate( this.innerApiCalls['listScanConfigs'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun - * stop time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 Array of {@link protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listScanRunsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists ScanRuns under a given ScanConfig, in descending order of ScanRun + * stop time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 Array of {@link protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listScanRunsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun[], - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse - ]>; + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanRun[], + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest | null, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse, + ] + >; listScanRuns( - request: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanRun>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanRun + >, + ): void; listScanRuns( - request: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanRun>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanRun + >, + ): void; listScanRuns( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanRun>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanRun>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IScanRun[], - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse - ]>|void { + | protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanRun + >, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanRun + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IScanRun[], + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest | null, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IScanRun>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IScanRun + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listScanRuns values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1521,205 +2085,234 @@ export class WebSecurityScannerClient { this._log.info('listScanRuns request %j', request); return this.innerApiCalls .listScanRuns(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.websecurityscanner.v1beta.IScanRun[], - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse - ]) => { - this._log.info('listScanRuns values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.websecurityscanner.v1beta.IScanRun[], + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest | null, + protos.google.cloud.websecurityscanner.v1beta.IListScanRunsResponse, + ]) => { + this._log.info('listScanRuns values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listScanRuns`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listScanRunsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listScanRuns`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listScanRunsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listScanRunsStream( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listScanRuns']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listScanRuns stream %j', request); return this.descriptors.page.listScanRuns.createStream( this.innerApiCalls.listScanRuns as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listScanRuns`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan resource name in the - * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of ScanRuns to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/web_security_scanner.list_scan_runs.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async - */ + /** + * Equivalent to `listScanRuns`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan resource name in the + * format 'projects/{projectId}/scanConfigs/{scanConfigId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of ScanRuns to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.websecurityscanner.v1beta.ScanRun|ScanRun}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/web_security_scanner.list_scan_runs.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListScanRuns_async + */ listScanRunsAsync( - request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.websecurityscanner.v1beta.IListScanRunsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listScanRuns']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listScanRuns iterate %j', request); return this.descriptors.page.listScanRuns.asyncIterate( this.innerApiCalls['listScanRuns'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * List CrawledUrls under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 Array of {@link protos.google.cloud.websecurityscanner.v1beta.CrawledUrl|CrawledUrl}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCrawledUrlsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * List CrawledUrls under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 Array of {@link protos.google.cloud.websecurityscanner.v1beta.CrawledUrl|CrawledUrl}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listCrawledUrlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse - ]>; + request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest | null, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse, + ] + >; listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl + >, + ): void; listCrawledUrls( - request: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl + >, + ): void; listCrawledUrls( - request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>, - callback?: PaginationCallback< + request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse - ]>|void { + | protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl + >, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest | null, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listCrawledUrls values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1728,212 +2321,241 @@ export class WebSecurityScannerClient { this._log.info('listCrawledUrls request %j', request); return this.innerApiCalls .listCrawledUrls(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[], - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse - ]) => { - this._log.info('listCrawledUrls values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[], + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest | null, + protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsResponse, + ]) => { + this._log.info('listCrawledUrls values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listCrawledUrls`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1beta.CrawledUrl|CrawledUrl} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listCrawledUrlsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listCrawledUrls`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1beta.CrawledUrl|CrawledUrl} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listCrawledUrlsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listCrawledUrlsStream( - request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listCrawledUrls']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listCrawledUrls stream %j', request); return this.descriptors.page.listCrawledUrls.createStream( this.innerApiCalls.listCrawledUrls as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listCrawledUrls`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of CrawledUrls to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.websecurityscanner.v1beta.CrawledUrl|CrawledUrl}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/web_security_scanner.list_crawled_urls.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async - */ + /** + * Equivalent to `listCrawledUrls`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of CrawledUrls to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.websecurityscanner.v1beta.CrawledUrl|CrawledUrl}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/web_security_scanner.list_crawled_urls.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListCrawledUrls_async + */ listCrawledUrlsAsync( - request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.websecurityscanner.v1beta.IListCrawledUrlsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listCrawledUrls']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listCrawledUrls iterate %j', request); return this.descriptors.page.listCrawledUrls.asyncIterate( this.innerApiCalls['listCrawledUrls'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * List Findings under a given ScanRun. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @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 Array of {@link protos.google.cloud.websecurityscanner.v1beta.Finding|Finding}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * List Findings under a given ScanRun. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @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 Array of {@link protos.google.cloud.websecurityscanner.v1beta.Finding|Finding}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listFindings( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IFinding[], - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse - ]>; + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IFinding[], + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest | null, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse, + ] + >; listFindings( - request: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IFinding>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IFinding + >, + ): void; listFindings( - request: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - callback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IFinding>): void; + request: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + callback: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IFinding + >, + ): void; listFindings( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IFinding>, - callback?: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IFinding>): - Promise<[ - protos.google.cloud.websecurityscanner.v1beta.IFinding[], - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse - ]>|void { + | protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IFinding + >, + callback?: PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IFinding + >, + ): Promise< + [ + protos.google.cloud.websecurityscanner.v1beta.IFinding[], + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest | null, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse|null|undefined, - protos.google.cloud.websecurityscanner.v1beta.IFinding>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + | protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse + | null + | undefined, + protos.google.cloud.websecurityscanner.v1beta.IFinding + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listFindings values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1942,128 +2564,132 @@ export class WebSecurityScannerClient { this._log.info('listFindings request %j', request); return this.innerApiCalls .listFindings(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.websecurityscanner.v1beta.IFinding[], - protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest|null, - protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse - ]) => { - this._log.info('listFindings values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.websecurityscanner.v1beta.IFinding[], + protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest | null, + protos.google.cloud.websecurityscanner.v1beta.IListFindingsResponse, + ]) => { + this._log.info('listFindings values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listFindings`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1beta.Finding|Finding} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listFindingsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listFindings`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.websecurityscanner.v1beta.Finding|Finding} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listFindingsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listFindingsStream( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listFindings']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listFindings stream %j', request); return this.descriptors.page.listFindings.createStream( this.innerApiCalls.listFindings as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listFindings`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, which should be a scan run resource name in the - * format - * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. - * @param {string} request.filter - * Required. The filter expression. The expression must be in the format: - * . - * Supported field: 'finding_type'. - * Supported operator: '='. - * @param {string} request.pageToken - * A token identifying a page of results to be returned. This should be a - * `next_page_token` value returned from a previous List request. - * If unspecified, the first page of results is returned. - * @param {number} request.pageSize - * The maximum number of Findings to return, can be limited by server. - * If not specified or not positive, the implementation will select a - * reasonable value. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.websecurityscanner.v1beta.Finding|Finding}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/web_security_scanner.list_findings.js - * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async - */ + /** + * Equivalent to `listFindings`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name, which should be a scan run resource name in the + * format + * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. + * @param {string} request.filter + * Required. The filter expression. The expression must be in the format: + * . + * Supported field: 'finding_type'. + * Supported operator: '='. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This should be a + * `next_page_token` value returned from a previous List request. + * If unspecified, the first page of results is returned. + * @param {number} request.pageSize + * The maximum number of Findings to return, can be limited by server. + * If not specified or not positive, the implementation will select a + * reasonable value. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.websecurityscanner.v1beta.Finding|Finding}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/web_security_scanner.list_findings.js + * region_tag:websecurityscanner_v1beta_generated_WebSecurityScanner_ListFindings_async + */ listFindingsAsync( - request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.websecurityscanner.v1beta.IListFindingsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listFindings']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listFindings iterate %j', request); return this.descriptors.page.listFindings.asyncIterate( this.innerApiCalls['listFindings'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } // -------------------- @@ -2079,7 +2705,12 @@ export class WebSecurityScannerClient { * @param {string} finding * @returns {string} Resource name string. */ - findingPath(project:string,scanConfig:string,scanRun:string,finding:string) { + findingPath( + project: string, + scanConfig: string, + scanRun: string, + finding: string, + ) { return this.pathTemplates.findingPathTemplate.render({ project: project, scan_config: scanConfig, @@ -2107,7 +2738,8 @@ export class WebSecurityScannerClient { * @returns {string} A string representing the scan_config. */ matchScanConfigFromFindingName(findingName: string) { - return this.pathTemplates.findingPathTemplate.match(findingName).scan_config; + return this.pathTemplates.findingPathTemplate.match(findingName) + .scan_config; } /** @@ -2138,7 +2770,7 @@ export class WebSecurityScannerClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -2162,7 +2794,7 @@ export class WebSecurityScannerClient { * @param {string} scan_config * @returns {string} Resource name string. */ - scanConfigPath(project:string,scanConfig:string) { + scanConfigPath(project: string, scanConfig: string) { return this.pathTemplates.scanConfigPathTemplate.render({ project: project, scan_config: scanConfig, @@ -2177,7 +2809,8 @@ export class WebSecurityScannerClient { * @returns {string} A string representing the project. */ matchProjectFromScanConfigName(scanConfigName: string) { - return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).project; + return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName) + .project; } /** @@ -2188,7 +2821,8 @@ export class WebSecurityScannerClient { * @returns {string} A string representing the scan_config. */ matchScanConfigFromScanConfigName(scanConfigName: string) { - return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName).scan_config; + return this.pathTemplates.scanConfigPathTemplate.match(scanConfigName) + .scan_config; } /** @@ -2199,7 +2833,7 @@ export class WebSecurityScannerClient { * @param {string} scan_run * @returns {string} Resource name string. */ - scanRunPath(project:string,scanConfig:string,scanRun:string) { + scanRunPath(project: string, scanConfig: string, scanRun: string) { return this.pathTemplates.scanRunPathTemplate.render({ project: project, scan_config: scanConfig, @@ -2226,7 +2860,8 @@ export class WebSecurityScannerClient { * @returns {string} A string representing the scan_config. */ matchScanConfigFromScanRunName(scanRunName: string) { - return this.pathTemplates.scanRunPathTemplate.match(scanRunName).scan_config; + return this.pathTemplates.scanRunPathTemplate.match(scanRunName) + .scan_config; } /** @@ -2248,7 +2883,7 @@ export class WebSecurityScannerClient { */ close(): Promise { if (this.webSecurityScannerStub && !this._terminated) { - return this.webSecurityScannerStub.then(stub => { + return this.webSecurityScannerStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -2256,4 +2891,4 @@ export class WebSecurityScannerClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-websecurityscanner/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-websecurityscanner/system-test/fixtures/sample/src/index.ts index 82d0d68f565c..b8d6ba0840a5 100644 --- a/packages/google-cloud-websecurityscanner/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-websecurityscanner/system-test/fixtures/sample/src/index.ts @@ -16,7 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {WebSecurityScannerClient} from '@google-cloud/web-security-scanner'; +import { WebSecurityScannerClient } from '@google-cloud/web-security-scanner'; // check that the client class type name can be used function doStuffWithWebSecurityScannerClient(client: WebSecurityScannerClient) { diff --git a/packages/google-cloud-websecurityscanner/system-test/install.ts b/packages/google-cloud-websecurityscanner/system-test/install.ts index 394f3362d203..ccf167042d2e 100644 --- a/packages/google-cloud-websecurityscanner/system-test/install.ts +++ b/packages/google-cloud-websecurityscanner/system-test/install.ts @@ -16,34 +16,36 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { + it('TypeScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts', + ).toString(), + }, }; await packNTest(options); }); - it('JavaScript code', async function() { + it('JavaScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } + cjs: readFileSync( + './system-test/fixtures/sample/src/index.js', + ).toString(), + }, }; await packNTest(options); }); - }); diff --git a/packages/google-cloud-websecurityscanner/test/gapic_web_security_scanner_v1.ts b/packages/google-cloud-websecurityscanner/test/gapic_web_security_scanner_v1.ts index c068b317a9d3..e8ef0d6c3d9f 100644 --- a/packages/google-cloud-websecurityscanner/test/gapic_web_security_scanner_v1.ts +++ b/packages/google-cloud-websecurityscanner/test/gapic_web_security_scanner_v1.ts @@ -19,2256 +19,2905 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as websecurityscannerModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf} from 'google-gax'; +import { protobuf } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.WebSecurityScannerClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'websecurityscanner.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = websecurityscannerModule.v1.WebSecurityScannerClient.servicePath; - assert.strictEqual(servicePath, 'websecurityscanner.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = websecurityscannerModule.v1.WebSecurityScannerClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'websecurityscanner.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'websecurityscanner.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'websecurityscanner.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new websecurityscannerModule.v1.WebSecurityScannerClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'websecurityscanner.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'websecurityscanner.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new websecurityscannerModule.v1.WebSecurityScannerClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = websecurityscannerModule.v1.WebSecurityScannerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - await client.initialize(); - assert(client.webSecurityScannerStub); - }); - - it('has close method for the initialized client', done => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.webSecurityScannerStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'websecurityscanner.googleapis.com'); }); - describe('createScanConfig', () => { - it('invokes createScanConfig without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanConfig() - ); - client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanConfig() - ); - client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has universeDomain', () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('invokes createScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createScanConfig(request), expectedError); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + websecurityscannerModule.v1.WebSecurityScannerClient.servicePath; + assert.strictEqual(servicePath, 'websecurityscanner.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + websecurityscannerModule.v1.WebSecurityScannerClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'websecurityscanner.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'websecurityscanner.example.com'); }); - describe('deleteScanConfig', () => { - it('invokes deleteScanConfig without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'websecurityscanner.example.com'); + }); - it('invokes deleteScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteScanConfig( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new websecurityscannerModule.v1.WebSecurityScannerClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'websecurityscanner.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new websecurityscannerModule.v1.WebSecurityScannerClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'websecurityscanner.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new websecurityscannerModule.v1.WebSecurityScannerClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('invokes deleteScanConfig with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has port', () => { + const port = websecurityscannerModule.v1.WebSecurityScannerClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('invokes deleteScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteScanConfig(request), expectedError); - }); + it('should create a client with no option', () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient(); + assert(client); }); - describe('getScanConfig', () => { - it('invokes getScanConfig without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanConfig() - ); - client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + fallback: true, + }); + assert(client); + }); - it('invokes getScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanConfig() - ); - client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + await client.initialize(); + assert(client.webSecurityScannerStub); + }); - it('invokes getScanConfig with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.webSecurityScannerStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getScanConfig(request), expectedError); + it('has close method for the non-initialized client', (done) => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('updateScanConfig', () => { - it('invokes updateScanConfig without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanConfig() - ); - client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes updateScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanConfig() - ); - client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createScanConfig', () => { + it('invokes createScanConfig without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ); + client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateScanConfig with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ); + client.innerApiCalls.createScanConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createScanConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1.IScanConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateScanConfig(request), expectedError); - }); + it('invokes createScanConfig with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createScanConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createScanConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('startScanRun', () => { - it('invokes startScanRun without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanRun() - ); - client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.startScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CreateScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.CreateScanConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createScanConfig(request), expectedError); + }); + }); + + describe('deleteScanConfig', () => { + it('invokes deleteScanConfig without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes startScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanRun() - ); - client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteScanConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteScanConfig( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes startScanRun with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteScanConfig with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteScanConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteScanConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes startScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.startScanRun(request), expectedError); - }); + it('invokes deleteScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.DeleteScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteScanConfig(request), expectedError); + }); + }); + + describe('getScanConfig', () => { + it('invokes getScanConfig without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.GetScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ); + client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getScanRun', () => { - it('invokes getScanRun without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanRun() - ); - client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.getScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.GetScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ); + client.innerApiCalls.getScanConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1.IScanConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanRun() - ); - client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getScanConfig with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.GetScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getScanConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getScanRun with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.GetScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getScanConfig(request), expectedError); + }); + }); + + describe('updateScanConfig', () => { + it('invokes updateScanConfig without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest(), + ); + request.scanConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', + ['scanConfig', 'name'], + ); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ); + client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getScanRun(request), expectedError); - }); + it('invokes updateScanConfig without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest(), + ); + request.scanConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', + ['scanConfig', 'name'], + ); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ); + client.innerApiCalls.updateScanConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateScanConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1.IScanConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('stopScanRun', () => { - it('invokes stopScanRun without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanRun() - ); - client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.stopScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateScanConfig with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest(), + ); + request.scanConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', + ['scanConfig', 'name'], + ); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateScanConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateScanConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes stopScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ScanRun() - ); - client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateScanConfig with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest(), + ); + request.scanConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.UpdateScanConfigRequest', + ['scanConfig', 'name'], + ); + request.scanConfig.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateScanConfig(request), expectedError); + }); + }); + + describe('startScanRun', () => { + it('invokes startScanRun without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.StartScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ); + client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.startScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes stopScanRun with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.stopScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes startScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.StartScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ); + client.innerApiCalls.startScanRun = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startScanRun( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1.IScanRun | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes stopScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.stopScanRun(request), expectedError); - }); + it('invokes startScanRun with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.StartScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startScanRun = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.startScanRun(request), expectedError); + const actualRequest = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getFinding', () => { - it('invokes getFinding without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.Finding() - ); - client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); - const [response] = await client.getFinding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes startScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StartScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.StartScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.startScanRun(request), expectedError); + }); + }); + + describe('getScanRun', () => { + it('invokes getScanRun without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.GetScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ); + client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.getScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getFinding without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.Finding() - ); - client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFinding( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.GetScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ); + client.innerApiCalls.getScanRun = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanRun( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1.IScanRun | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getFinding with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFinding(request), expectedError); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getScanRun with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.GetScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanRun = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getScanRun(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getFinding with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getFinding(request), expectedError); - }); + it('invokes getScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.GetScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getScanRun(request), expectedError); + }); + }); + + describe('stopScanRun', () => { + it('invokes stopScanRun without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.StopScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ); + client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.stopScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listFindingTypeStats', () => { - it('invokes listFindingTypeStats without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse() - ); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); - const [response] = await client.listFindingTypeStats(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes stopScanRun without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.StopScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ); + client.innerApiCalls.stopScanRun = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopScanRun( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1.IScanRun | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listFindingTypeStats without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse() - ); - client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindingTypeStats( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes stopScanRun with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.StopScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopScanRun = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.stopScanRun(request), expectedError); + const actualRequest = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listFindingTypeStats with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes stopScanRun with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.StopScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.StopScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.stopScanRun(request), expectedError); + }); + }); + + describe('getFinding', () => { + it('invokes getFinding without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetFindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.GetFindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding(), + ); + client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); + const [response] = await client.getFinding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listFindingTypeStats with closed client', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - }); + it('invokes getFinding without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetFindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.GetFindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding(), + ); + client.innerApiCalls.getFinding = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFinding( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1.IFinding | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listScanConfigs', () => { - it('invokes listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listScanConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getFinding with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetFindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.GetFindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFinding = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getFinding(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listScanConfigs without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getFinding with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.GetFindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.GetFindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getFinding(request), expectedError); + }); + }); + + describe('listFindingTypeStats', () => { + it('invokes listFindingTypeStats without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse(), + ); + client.innerApiCalls.listFindingTypeStats = + stubSimpleCall(expectedResponse); + const [response] = await client.listFindingTypeStats(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listFindingTypeStats without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse(), + ); + client.innerApiCalls.listFindingTypeStats = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindingTypeStats( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1.IListFindingTypeStatsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listScanConfigsStream without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listFindingTypeStats with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listScanConfigsStream with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listFindingTypeStats with closed client', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + }); + }); + + describe('listScanConfigs', () => { + it('invokes listScanConfigs without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listScanConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1.IScanConfig[] = []; - const iterable = client.listScanConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listScanConfigs without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ), + ]; + client.innerApiCalls.listScanConfigs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanConfigs( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.websecurityscanner.v1.IScanConfig[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1.IScanConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listScanRuns', () => { - it('invokes listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); - const [response] = await client.listScanRuns(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listScanConfigs with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanConfigs = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listScanConfigs(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listScanRuns without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanRuns( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IScanRun[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listScanConfigsStream without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ), + ]; + client.descriptors.page.listScanConfigs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.ScanConfig[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.websecurityscanner.v1.ScanConfig) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listScanConfigs, request), + ); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanRuns(request), expectedError); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listScanConfigsStream with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.ScanConfig[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.websecurityscanner.v1.ScanConfig) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listScanConfigs, request), + ); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listScanRunsStream without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - ]; - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanRun) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listScanConfigs without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanConfig(), + ), + ]; + client.descriptors.page.listScanConfigs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1.IScanConfig[] = + []; + const iterable = client.listScanConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listScanConfigs.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listScanRunsStream with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.ScanRun) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listScanConfigs with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1.IScanConfig[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listScanConfigs.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listScanRuns', () => { + it('invokes listScanRuns without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); + const [response] = await client.listScanRuns(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.ScanRun()), - ]; - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1.IScanRun[] = []; - const iterable = client.listScanRunsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listScanRuns without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ), + ]; + client.innerApiCalls.listScanRuns = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanRuns( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.websecurityscanner.v1.IScanRun[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanRunsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1.IScanRun[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listCrawledUrls', () => { - it('invokes listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); - const [response] = await client.listCrawledUrls(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listScanRuns with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanRuns = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listScanRuns(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listCrawledUrls without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCrawledUrls( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listScanRunsStream without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ), + ]; + client.descriptors.page.listScanRuns.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.ScanRun[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.websecurityscanner.v1.ScanRun) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listScanRuns, request), + ); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCrawledUrls(request), expectedError); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listScanRunsStream with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.ScanRun[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.websecurityscanner.v1.ScanRun) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listScanRuns, request), + ); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listCrawledUrlsStream without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.CrawledUrl) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listScanRuns without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ScanRun(), + ), + ]; + client.descriptors.page.listScanRuns.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1.IScanRun[] = + []; + const iterable = client.listScanRunsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listScanRuns.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listCrawledUrlsStream with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.CrawledUrl) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listScanRuns with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanRunsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1.IScanRun[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listScanRuns.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listCrawledUrls', () => { + it('invokes listCrawledUrls without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CrawledUrl(), + ), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); + const [response] = await client.listCrawledUrls(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[] = []; - const iterable = client.listCrawledUrlsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listCrawledUrls without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CrawledUrl(), + ), + ]; + client.innerApiCalls.listCrawledUrls = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCrawledUrls( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.websecurityscanner.v1.ICrawledUrl[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCrawledUrlsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listFindings', () => { - it('invokes listFindings without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); - const [response] = await client.listFindings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listCrawledUrls with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCrawledUrls = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listCrawledUrls(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listFindings without error using callback', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1.IFinding[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listCrawledUrlsStream without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CrawledUrl(), + ), + ]; + client.descriptors.page.listCrawledUrls.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.CrawledUrl[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.websecurityscanner.v1.CrawledUrl) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCrawledUrls, request), + ); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listFindings with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindings(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listCrawledUrlsStream with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.CrawledUrl[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.websecurityscanner.v1.CrawledUrl) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCrawledUrls, request), + ); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listFindingsStream without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.Finding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listCrawledUrls without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.CrawledUrl(), + ), + ]; + client.descriptors.page.listCrawledUrls.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[] = + []; + const iterable = client.listCrawledUrlsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listFindingsStream with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1.Finding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listCrawledUrls with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCrawledUrlsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1.ICrawledUrl[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listFindings', () => { + it('invokes listFindings without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding(), + ), + ]; + client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); + const [response] = await client.listFindings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listFindings without error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1.Finding()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1.IFinding[] = []; - const iterable = client.listFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listFindings without error using callback', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding(), + ), + ]; + client.innerApiCalls.listFindings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.websecurityscanner.v1.IFinding[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings with error', async () => { - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1.IFinding[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('Path templates', () => { - - describe('finding', async () => { - const fakePath = "/rendered/path/finding"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - finding: "findingValue", - }; - const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.findingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.findingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('findingPath', () => { - const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.findingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes listFindings with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listFindings(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromFindingName', () => { - const result = client.matchProjectFromFindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listFindingsStream without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding(), + ), + ]; + client.descriptors.page.listFindings.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.Finding[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.websecurityscanner.v1.Finding) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFindings, request), + ); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('matchScanConfigFromFindingName', () => { - const result = client.matchScanConfigFromFindingName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listFindingsStream with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1.Finding[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.websecurityscanner.v1.Finding) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFindings, request), + ); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('matchScanRunFromFindingName', () => { - const result = client.matchScanRunFromFindingName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('uses async iteration with listFindings without error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.Finding(), + ), + ]; + client.descriptors.page.listFindings.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1.IFinding[] = + []; + const iterable = client.listFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listFindings.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('matchFindingFromFindingName', () => { - const result = client.matchFindingFromFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('uses async iteration with listFindings with error', async () => { + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1.IFinding[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listFindings.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('Path templates', () => { + describe('finding', async () => { + const fakePath = '/rendered/path/finding'; + const expectedParameters = { + project: 'projectValue', + scan_config: 'scanConfigValue', + scan_run: 'scanRunValue', + finding: 'findingValue', + }; + const client = new websecurityscannerModule.v1.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.findingPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.findingPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('findingPath', () => { + const result = client.findingPath( + 'projectValue', + 'scanConfigValue', + 'scanRunValue', + 'findingValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.findingPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFindingName', () => { + const result = client.matchProjectFromFindingName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchScanConfigFromFindingName', () => { + const result = client.matchScanConfigFromFindingName(fakePath); + assert.strictEqual(result, 'scanConfigValue'); + assert( + (client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchScanRunFromFindingName', () => { + const result = client.matchScanRunFromFindingName(fakePath); + assert.strictEqual(result, 'scanRunValue'); + assert( + (client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFindingFromFindingName', () => { + const result = client.matchFindingFromFindingName(fakePath); + assert.strictEqual(result, 'findingValue'); + assert( + (client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-websecurityscanner/test/gapic_web_security_scanner_v1alpha.ts b/packages/google-cloud-websecurityscanner/test/gapic_web_security_scanner_v1alpha.ts index 821707a94142..b03b364bc3c6 100644 --- a/packages/google-cloud-websecurityscanner/test/gapic_web_security_scanner_v1alpha.ts +++ b/packages/google-cloud-websecurityscanner/test/gapic_web_security_scanner_v1alpha.ts @@ -19,2370 +19,3152 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as websecurityscannerModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf} from 'google-gax'; +import { protobuf } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1alpha.WebSecurityScannerClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'websecurityscanner.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = websecurityscannerModule.v1alpha.WebSecurityScannerClient.servicePath; - assert.strictEqual(servicePath, 'websecurityscanner.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'websecurityscanner.googleapis.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = websecurityscannerModule.v1alpha.WebSecurityScannerClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'websecurityscanner.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'websecurityscanner.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'websecurityscanner.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'websecurityscanner.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'websecurityscanner.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new websecurityscannerModule.v1alpha.WebSecurityScannerClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + it('has universeDomain', () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('has port', () => { - const port = websecurityscannerModule.v1alpha.WebSecurityScannerClient.port; - assert(port); - assert(typeof port === 'number'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + websecurityscannerModule.v1alpha.WebSecurityScannerClient.servicePath; + assert.strictEqual(servicePath, 'websecurityscanner.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + websecurityscannerModule.v1alpha.WebSecurityScannerClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'websecurityscanner.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'websecurityscanner.example.com'); + }); - it('should create a client with no option', () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient(); - assert(client); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'websecurityscanner.example.com'); + }); - it('should create a client with gRPC fallback', () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - fallback: true, - }); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'websecurityscanner.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'websecurityscanner.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - await client.initialize(); - assert(client.webSecurityScannerStub); - }); + it('has port', () => { + const port = + websecurityscannerModule.v1alpha.WebSecurityScannerClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has close method for the initialized client', done => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.webSecurityScannerStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('should create a client with no option', () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + fallback: true, }); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has initialize method and supports deferred initialization', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + await client.initialize(); + assert(client.webSecurityScannerStub); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the initialized client', (done) => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.webSecurityScannerStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has close method for the non-initialized client', (done) => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('createScanConfig', () => { - it('invokes createScanConfig without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() - ); - client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() - ); - client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createScanConfig(request), expectedError); - }); - }); - - describe('deleteScanConfig', () => { - it('invokes deleteScanConfig without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteScanConfig( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteScanConfig(request), expectedError); - }); - }); - - describe('getScanConfig', () => { - it('invokes getScanConfig without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() - ); - client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() - ); - client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getScanConfig(request), expectedError); - }); - }); - - describe('updateScanConfig', () => { - it('invokes updateScanConfig without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() - ); - client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig() - ); - client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateScanConfig(request), expectedError); - }); - }); - - describe('startScanRun', () => { - it('invokes startScanRun without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() - ); - client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.startScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() - ); - client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.startScanRun(request), expectedError); - }); - }); - - describe('getScanRun', () => { - it('invokes getScanRun without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() - ); - client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.getScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() - ); - client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getScanRun(request), expectedError); - }); - }); - - describe('stopScanRun', () => { - it('invokes stopScanRun without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() - ); - client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.stopScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ScanRun() - ); - client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.stopScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.stopScanRun(request), expectedError); - }); - }); - - describe('getFinding', () => { - it('invokes getFinding without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.Finding() - ); - client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); - const [response] = await client.getFinding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.Finding() - ); - client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFinding( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFinding(request), expectedError); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getFinding(request), expectedError); - }); - }); - - describe('listFindingTypeStats', () => { - it('invokes listFindingTypeStats without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse() - ); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); - const [response] = await client.listFindingTypeStats(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse() - ); - client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindingTypeStats( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats with closed client', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - }); - }); - - describe('listScanConfigs', () => { - it('invokes listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listScanConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigs without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigsStream without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listScanConfigsStream with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[] = []; - const iterable = client.listScanConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createScanConfig', () => { + it('invokes createScanConfig without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ); + client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig without error using callback', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ); + client.innerApiCalls.createScanConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createScanConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listScanRuns', () => { - it('invokes listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); - const [response] = await client.listScanRuns(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRuns without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanRuns( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanRuns(request), expectedError); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRunsStream without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - ]; - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanRun) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listScanRunsStream with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.ScanRun) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.ScanRun()), - ]; - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[] = []; - const iterable = client.listScanRunsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createScanConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createScanConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig with closed client', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.CreateScanConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createScanConfig(request), expectedError); + }); + }); + + describe('deleteScanConfig', () => { + it('invokes deleteScanConfig without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig without error using callback', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteScanConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteScanConfig( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanRunsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listCrawledUrls', () => { - it('invokes listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); - const [response] = await client.listCrawledUrls(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrls without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCrawledUrls( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCrawledUrls(request), expectedError); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrlsStream without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCrawledUrlsStream with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[] = []; - const iterable = client.listCrawledUrlsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteScanConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteScanConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig with closed client', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.DeleteScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteScanConfig(request), expectedError); + }); + }); + + describe('getScanConfig', () => { + it('invokes getScanConfig without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ); + client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig without error using callback', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ); + client.innerApiCalls.getScanConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCrawledUrlsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listFindings', () => { - it('invokes listFindings without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); - const [response] = await client.listFindings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings without error using callback', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1alpha.IFinding[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindings(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingsStream without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.Finding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFindingsStream with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1alpha.Finding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings without error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1alpha.Finding()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1alpha.IFinding[] = []; - const iterable = client.listFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getScanConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig with closed client', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.GetScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getScanConfig(request), expectedError); + }); + }); + + describe('updateScanConfig', () => { + it('invokes updateScanConfig without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest(), + ); + request.scanConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', + ['scanConfig', 'name'], + ); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ); + client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateScanConfig without error using callback', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest(), + ); + request.scanConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', + ['scanConfig', 'name'], + ); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ); + client.innerApiCalls.updateScanConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateScanConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings with error', async () => { - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1alpha.IFinding[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('finding', async () => { - const fakePath = "/rendered/path/finding"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - finding: "findingValue", - }; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.findingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.findingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('findingPath', () => { - const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.findingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromFindingName', () => { - const result = client.matchProjectFromFindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes updateScanConfig with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest(), + ); + request.scanConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', + ['scanConfig', 'name'], + ); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateScanConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateScanConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchScanConfigFromFindingName', () => { - const result = client.matchScanConfigFromFindingName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes updateScanConfig with closed client', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest(), + ); + request.scanConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.UpdateScanConfigRequest', + ['scanConfig', 'name'], + ); + request.scanConfig.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateScanConfig(request), expectedError); + }); + }); + + describe('startScanRun', () => { + it('invokes startScanRun without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ); + client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.startScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchScanRunFromFindingName', () => { - const result = client.matchScanRunFromFindingName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes startScanRun without error using callback', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ); + client.innerApiCalls.startScanRun = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startScanRun( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchFindingFromFindingName', () => { - const result = client.matchFindingFromFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes startScanRun with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startScanRun = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.startScanRun(request), expectedError); + const actualRequest = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes startScanRun with closed client', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.StartScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.startScanRun(request), expectedError); + }); + }); + + describe('getScanRun', () => { + it('invokes getScanRun without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ); + client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.getScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes getScanRun without error using callback', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ); + client.innerApiCalls.getScanRun = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanRun( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('scanConfig', async () => { - const fakePath = "/rendered/path/scanConfig"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - }; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.scanConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.scanConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('scanConfigPath', () => { - const result = client.scanConfigPath("projectValue", "scanConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.scanConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes getScanRun with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanRun = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getScanRun(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromScanConfigName', () => { - const result = client.matchProjectFromScanConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes getScanRun with closed client', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.GetScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getScanRun(request), expectedError); + }); + }); + + describe('stopScanRun', () => { + it('invokes stopScanRun without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ); + client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.stopScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchScanConfigFromScanConfigName', () => { - const result = client.matchScanConfigFromScanConfigName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes stopScanRun without error using callback', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ); + client.innerApiCalls.stopScanRun = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopScanRun( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1alpha.IScanRun | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('scanRun', async () => { - const fakePath = "/rendered/path/scanRun"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - }; - const client = new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.scanRunPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.scanRunPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('scanRunPath', () => { - const result = client.scanRunPath("projectValue", "scanConfigValue", "scanRunValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.scanRunPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes stopScanRun with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopScanRun = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.stopScanRun(request), expectedError); + const actualRequest = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromScanRunName', () => { - const result = client.matchProjectFromScanRunName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes stopScanRun with closed client', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.StopScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.stopScanRun(request), expectedError); + }); + }); + + describe('getFinding', () => { + it('invokes getFinding without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding(), + ); + client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); + const [response] = await client.getFinding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchScanConfigFromScanRunName', () => { - const result = client.matchScanConfigFromScanRunName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes getFinding without error using callback', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding(), + ); + client.innerApiCalls.getFinding = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFinding( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1alpha.IFinding | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchScanRunFromScanRunName', () => { - const result = client.matchScanRunFromScanRunName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes getFinding with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFinding = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getFinding(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFinding with closed client', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.GetFindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.GetFindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getFinding(request), expectedError); + }); + }); + + describe('listFindingTypeStats', () => { + it('invokes listFindingTypeStats without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse(), + ); + client.innerApiCalls.listFindingTypeStats = + stubSimpleCall(expectedResponse); + const [response] = await client.listFindingTypeStats(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats without error using callback', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsResponse(), + ); + client.innerApiCalls.listFindingTypeStats = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindingTypeStats( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1alpha.IListFindingTypeStatsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats with closed client', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListFindingTypeStatsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + }); + }); + + describe('listScanConfigs', () => { + it('invokes listScanConfigs without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listScanConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigs without error using callback', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ), + ]; + client.innerApiCalls.listScanConfigs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanConfigs( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigs with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanConfigs = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listScanConfigs(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigsStream without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ), + ]; + client.descriptors.page.listScanConfigs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listScanConfigs, request), + ); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listScanConfigsStream with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.websecurityscanner.v1alpha.ScanConfig, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listScanConfigs, request), + ); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listScanConfigs without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanConfig(), + ), + ]; + client.descriptors.page.listScanConfigs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[] = + []; + const iterable = client.listScanConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listScanConfigs.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listScanConfigs with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanConfig[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listScanConfigs.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listScanRuns', () => { + it('invokes listScanRuns without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); + const [response] = await client.listScanRuns(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRuns without error using callback', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ), + ]; + client.innerApiCalls.listScanRuns = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanRuns( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.websecurityscanner.v1alpha.IScanRun[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRuns with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanRuns = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listScanRuns(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRunsStream without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ), + ]; + client.descriptors.page.listScanRuns.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanRun[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.websecurityscanner.v1alpha.ScanRun, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listScanRuns, request), + ); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listScanRunsStream with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ScanRun[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.websecurityscanner.v1alpha.ScanRun, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listScanRuns, request), + ); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listScanRuns without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ScanRun(), + ), + ]; + client.descriptors.page.listScanRuns.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[] = + []; + const iterable = client.listScanRunsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listScanRuns.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listScanRuns with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanRunsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.IScanRun[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listScanRuns.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listCrawledUrls', () => { + it('invokes listCrawledUrls without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl(), + ), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); + const [response] = await client.listCrawledUrls(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrls without error using callback', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl(), + ), + ]; + client.innerApiCalls.listCrawledUrls = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCrawledUrls( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrls with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCrawledUrls = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listCrawledUrls(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrlsStream without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl(), + ), + ]; + client.descriptors.page.listCrawledUrls.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCrawledUrls, request), + ); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listCrawledUrlsStream with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCrawledUrls, request), + ); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listCrawledUrls without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.CrawledUrl(), + ), + ]; + client.descriptors.page.listCrawledUrls.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[] = + []; + const iterable = client.listCrawledUrlsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listCrawledUrls with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCrawledUrlsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.ICrawledUrl[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listFindings', () => { + it('invokes listFindings without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding(), + ), + ]; + client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); + const [response] = await client.listFindings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings without error using callback', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding(), + ), + ]; + client.innerApiCalls.listFindings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.websecurityscanner.v1alpha.IFinding[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listFindings(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingsStream without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding(), + ), + ]; + client.descriptors.page.listFindings.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.Finding[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.websecurityscanner.v1alpha.Finding, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFindings, request), + ); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listFindingsStream with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.Finding[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.websecurityscanner.v1alpha.Finding, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFindings, request), + ); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listFindings without error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.Finding(), + ), + ]; + client.descriptors.page.listFindings.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1alpha.IFinding[] = + []; + const iterable = client.listFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listFindings.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listFindings with error', async () => { + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1alpha.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1alpha.IFinding[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listFindings.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('Path templates', () => { + describe('finding', async () => { + const fakePath = '/rendered/path/finding'; + const expectedParameters = { + project: 'projectValue', + scan_config: 'scanConfigValue', + scan_run: 'scanRunValue', + finding: 'findingValue', + }; + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.findingPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.findingPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('findingPath', () => { + const result = client.findingPath( + 'projectValue', + 'scanConfigValue', + 'scanRunValue', + 'findingValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.findingPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFindingName', () => { + const result = client.matchProjectFromFindingName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchScanConfigFromFindingName', () => { + const result = client.matchScanConfigFromFindingName(fakePath); + assert.strictEqual(result, 'scanConfigValue'); + assert( + (client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchScanRunFromFindingName', () => { + const result = client.matchScanRunFromFindingName(fakePath); + assert.strictEqual(result, 'scanRunValue'); + assert( + (client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFindingFromFindingName', () => { + const result = client.matchFindingFromFindingName(fakePath); + assert.strictEqual(result, 'findingValue'); + assert( + (client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('scanConfig', async () => { + const fakePath = '/rendered/path/scanConfig'; + const expectedParameters = { + project: 'projectValue', + scan_config: 'scanConfigValue', + }; + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.scanConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.scanConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('scanConfigPath', () => { + const result = client.scanConfigPath('projectValue', 'scanConfigValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.scanConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromScanConfigName', () => { + const result = client.matchProjectFromScanConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.scanConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchScanConfigFromScanConfigName', () => { + const result = client.matchScanConfigFromScanConfigName(fakePath); + assert.strictEqual(result, 'scanConfigValue'); + assert( + (client.pathTemplates.scanConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('scanRun', async () => { + const fakePath = '/rendered/path/scanRun'; + const expectedParameters = { + project: 'projectValue', + scan_config: 'scanConfigValue', + scan_run: 'scanRunValue', + }; + const client = + new websecurityscannerModule.v1alpha.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.scanRunPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.scanRunPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('scanRunPath', () => { + const result = client.scanRunPath( + 'projectValue', + 'scanConfigValue', + 'scanRunValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.scanRunPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromScanRunName', () => { + const result = client.matchProjectFromScanRunName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchScanConfigFromScanRunName', () => { + const result = client.matchScanConfigFromScanRunName(fakePath); + assert.strictEqual(result, 'scanConfigValue'); + assert( + (client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchScanRunFromScanRunName', () => { + const result = client.matchScanRunFromScanRunName(fakePath); + assert.strictEqual(result, 'scanRunValue'); + assert( + (client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-websecurityscanner/test/gapic_web_security_scanner_v1beta.ts b/packages/google-cloud-websecurityscanner/test/gapic_web_security_scanner_v1beta.ts index 07616d88d2c2..c400fbaa1b46 100644 --- a/packages/google-cloud-websecurityscanner/test/gapic_web_security_scanner_v1beta.ts +++ b/packages/google-cloud-websecurityscanner/test/gapic_web_security_scanner_v1beta.ts @@ -19,2370 +19,3144 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as websecurityscannerModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf} from 'google-gax'; +import { protobuf } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1beta.WebSecurityScannerClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'websecurityscanner.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = websecurityscannerModule.v1beta.WebSecurityScannerClient.servicePath; - assert.strictEqual(servicePath, 'websecurityscanner.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'websecurityscanner.googleapis.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = websecurityscannerModule.v1beta.WebSecurityScannerClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'websecurityscanner.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'websecurityscanner.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'websecurityscanner.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'websecurityscanner.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'websecurityscanner.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new websecurityscannerModule.v1beta.WebSecurityScannerClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + it('has universeDomain', () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('has port', () => { - const port = websecurityscannerModule.v1beta.WebSecurityScannerClient.port; - assert(port); - assert(typeof port === 'number'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + websecurityscannerModule.v1beta.WebSecurityScannerClient.servicePath; + assert.strictEqual(servicePath, 'websecurityscanner.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + websecurityscannerModule.v1beta.WebSecurityScannerClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'websecurityscanner.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'websecurityscanner.example.com'); + }); - it('should create a client with no option', () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient(); - assert(client); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'websecurityscanner.example.com'); + }); - it('should create a client with gRPC fallback', () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - fallback: true, - }); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'websecurityscanner.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'websecurityscanner.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - await client.initialize(); - assert(client.webSecurityScannerStub); - }); + it('has port', () => { + const port = + websecurityscannerModule.v1beta.WebSecurityScannerClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has close method for the initialized client', done => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.webSecurityScannerStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('should create a client with no option', () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + fallback: true, }); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.webSecurityScannerStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has initialize method and supports deferred initialization', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + await client.initialize(); + assert(client.webSecurityScannerStub); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the initialized client', (done) => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.webSecurityScannerStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has close method for the non-initialized client', (done) => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.webSecurityScannerStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('createScanConfig', () => { - it('invokes createScanConfig without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() - ); - client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() - ); - client.innerApiCalls.createScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createScanConfig(request), expectedError); - }); - }); - - describe('deleteScanConfig', () => { - it('invokes deleteScanConfig without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteScanConfig( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteScanConfig(request), expectedError); - }); - }); - - describe('getScanConfig', () => { - it('invokes getScanConfig without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() - ); - client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() - ); - client.innerApiCalls.getScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getScanConfig(request), expectedError); - }); - }); - - describe('updateScanConfig', () => { - it('invokes updateScanConfig without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() - ); - client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateScanConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanConfig() - ); - client.innerApiCalls.updateScanConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateScanConfig( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateScanConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateScanConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateScanConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateScanConfig with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest() - ); - request.scanConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', ['scanConfig', 'name']); - request.scanConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateScanConfig(request), expectedError); - }); - }); - - describe('startScanRun', () => { - it('invokes startScanRun without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanRun() - ); - client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.startScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanRun() - ); - client.innerApiCalls.startScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.startScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.startScanRun(request), expectedError); - }); - }); - - describe('getScanRun', () => { - it('invokes getScanRun without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanRun() - ); - client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.getScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanRun() - ); - client.innerApiCalls.getScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getScanRun(request), expectedError); - }); - }); - - describe('stopScanRun', () => { - it('invokes stopScanRun without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanRun() - ); - client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); - const [response] = await client.stopScanRun(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ScanRun() - ); - client.innerApiCalls.stopScanRun = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopScanRun( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopScanRun = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.stopScanRun(request), expectedError); - const actualRequest = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopScanRun as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopScanRun with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.stopScanRun(request), expectedError); - }); - }); - - describe('getFinding', () => { - it('invokes getFinding without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.Finding() - ); - client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); - const [response] = await client.getFinding(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.Finding() - ); - client.innerApiCalls.getFinding = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFinding( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IFinding|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFinding = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFinding(request), expectedError); - const actualRequest = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFinding as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFinding with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.GetFindingRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getFinding(request), expectedError); - }); - }); - - describe('listFindingTypeStats', () => { - it('invokes listFindingTypeStats without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse() - ); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(expectedResponse); - const [response] = await client.listFindingTypeStats(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse() - ); - client.innerApiCalls.listFindingTypeStats = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindingTypeStats( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindingTypeStats = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindingTypeStats as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingTypeStats with closed client', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listFindingTypeStats(request), expectedError); - }); - }); - - describe('listScanConfigs', () => { - it('invokes listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listScanConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigs without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - ]; - client.innerApiCalls.listScanConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanConfigsStream without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listScanConfigsStream with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ScanConfig[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanConfigs, request)); - assert( - (client.descriptors.page.listScanConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanConfigs without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanConfig()), - ]; - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[] = []; - const iterable = client.listScanConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createScanConfig', () => { + it('invokes createScanConfig without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ); + client.innerApiCalls.createScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.createScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig without error using callback', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ); + client.innerApiCalls.createScanConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createScanConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanConfigs with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listScanRuns', () => { - it('invokes listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); - const [response] = await client.listScanRuns(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRuns without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - ]; - client.innerApiCalls.listScanRuns = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScanRuns( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listScanRuns = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScanRuns(request), expectedError); - const actualRequest = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScanRuns as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScanRunsStream without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - ]; - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanRun) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listScanRunsStream with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScanRunsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ScanRun[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.ScanRun) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScanRuns, request)); - assert( - (client.descriptors.page.listScanRuns.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanRuns without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.ScanRun()), - ]; - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1beta.IScanRun[] = []; - const iterable = client.listScanRunsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createScanConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createScanConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createScanConfig with closed client', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.CreateScanConfigRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createScanConfig(request), expectedError); + }); + }); + + describe('deleteScanConfig', () => { + it('invokes deleteScanConfig without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.deleteScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig without error using callback', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.deleteScanConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteScanConfig( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listScanRuns with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listScanRuns.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScanRunsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1beta.IScanRun[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listCrawledUrls', () => { - it('invokes listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); - const [response] = await client.listCrawledUrls(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrls without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - ]; - client.innerApiCalls.listCrawledUrls = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCrawledUrls( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCrawledUrls = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCrawledUrls(request), expectedError); - const actualRequest = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCrawledUrls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCrawledUrlsStream without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCrawledUrlsStream with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCrawledUrlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCrawledUrls, request)); - assert( - (client.descriptors.page.listCrawledUrls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCrawledUrls without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl()), - ]; - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[] = []; - const iterable = client.listCrawledUrlsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteScanConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteScanConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteScanConfig with closed client', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.DeleteScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteScanConfig(request), expectedError); + }); + }); + + describe('getScanConfig', () => { + it('invokes getScanConfig without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ); + client.innerApiCalls.getScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.getScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig without error using callback', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ); + client.innerApiCalls.getScanConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCrawledUrls with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCrawledUrls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCrawledUrlsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listFindings', () => { - it('invokes listFindings without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); - const [response] = await client.listFindings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings without error using callback', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - ]; - client.innerApiCalls.listFindings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFindings( - request, - (err?: Error|null, result?: protos.google.cloud.websecurityscanner.v1beta.IFinding[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindings with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFindings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFindings(request), expectedError); - const actualRequest = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFindings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFindingsStream without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - ]; - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.Finding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listFindingsStream with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listFindingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.websecurityscanner.v1beta.Finding[] = []; - stream.on('data', (response: protos.google.cloud.websecurityscanner.v1beta.Finding) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listFindings, request)); - assert( - (client.descriptors.page.listFindings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings without error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - generateSampleMessage(new protos.google.cloud.websecurityscanner.v1beta.Finding()), - ]; - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.websecurityscanner.v1beta.IFinding[] = []; - const iterable = client.listFindingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getScanConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getScanConfig with closed client', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.GetScanConfigRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getScanConfig(request), expectedError); + }); + }); + + describe('updateScanConfig', () => { + it('invokes updateScanConfig without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest(), + ); + request.scanConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', + ['scanConfig', 'name'], + ); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ); + client.innerApiCalls.updateScanConfig = stubSimpleCall(expectedResponse); + const [response] = await client.updateScanConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateScanConfig without error using callback', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest(), + ); + request.scanConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', + ['scanConfig', 'name'], + ); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ); + client.innerApiCalls.updateScanConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateScanConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1beta.IScanConfig | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listFindings with error', async () => { - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listFindings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listFindingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.websecurityscanner.v1beta.IFinding[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listFindings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('finding', async () => { - const fakePath = "/rendered/path/finding"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - finding: "findingValue", - }; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.findingPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.findingPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('findingPath', () => { - const result = client.findingPath("projectValue", "scanConfigValue", "scanRunValue", "findingValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.findingPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromFindingName', () => { - const result = client.matchProjectFromFindingName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes updateScanConfig with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest(), + ); + request.scanConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', + ['scanConfig', 'name'], + ); + request.scanConfig.name = defaultValue1; + const expectedHeaderRequestParams = `scan_config.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateScanConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateScanConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateScanConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchScanConfigFromFindingName', () => { - const result = client.matchScanConfigFromFindingName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes updateScanConfig with closed client', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest(), + ); + request.scanConfig ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.UpdateScanConfigRequest', + ['scanConfig', 'name'], + ); + request.scanConfig.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateScanConfig(request), expectedError); + }); + }); + + describe('startScanRun', () => { + it('invokes startScanRun without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ); + client.innerApiCalls.startScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.startScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchScanRunFromFindingName', () => { - const result = client.matchScanRunFromFindingName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes startScanRun without error using callback', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ); + client.innerApiCalls.startScanRun = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startScanRun( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchFindingFromFindingName', () => { - const result = client.matchFindingFromFindingName(fakePath); - assert.strictEqual(result, "findingValue"); - assert((client.pathTemplates.findingPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes startScanRun with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startScanRun = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.startScanRun(request), expectedError); + const actualRequest = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes startScanRun with closed client', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StartScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.StartScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.startScanRun(request), expectedError); + }); + }); + + describe('getScanRun', () => { + it('invokes getScanRun without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ); + client.innerApiCalls.getScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.getScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes getScanRun without error using callback', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ); + client.innerApiCalls.getScanRun = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getScanRun( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('scanConfig', async () => { - const fakePath = "/rendered/path/scanConfig"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - }; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.scanConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.scanConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('scanConfigPath', () => { - const result = client.scanConfigPath("projectValue", "scanConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.scanConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes getScanRun with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getScanRun = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getScanRun(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromScanConfigName', () => { - const result = client.matchProjectFromScanConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes getScanRun with closed client', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.GetScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getScanRun(request), expectedError); + }); + }); + + describe('stopScanRun', () => { + it('invokes stopScanRun without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ); + client.innerApiCalls.stopScanRun = stubSimpleCall(expectedResponse); + const [response] = await client.stopScanRun(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchScanConfigFromScanConfigName', () => { - const result = client.matchScanConfigFromScanConfigName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.scanConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes stopScanRun without error using callback', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ); + client.innerApiCalls.stopScanRun = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopScanRun( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1beta.IScanRun | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('scanRun', async () => { - const fakePath = "/rendered/path/scanRun"; - const expectedParameters = { - project: "projectValue", - scan_config: "scanConfigValue", - scan_run: "scanRunValue", - }; - const client = new websecurityscannerModule.v1beta.WebSecurityScannerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.scanRunPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.scanRunPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('scanRunPath', () => { - const result = client.scanRunPath("projectValue", "scanConfigValue", "scanRunValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.scanRunPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes stopScanRun with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopScanRun = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.stopScanRun(request), expectedError); + const actualRequest = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopScanRun as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromScanRunName', () => { - const result = client.matchProjectFromScanRunName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes stopScanRun with closed client', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.StopScanRunRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.StopScanRunRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.stopScanRun(request), expectedError); + }); + }); + + describe('getFinding', () => { + it('invokes getFinding without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.GetFindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding(), + ); + client.innerApiCalls.getFinding = stubSimpleCall(expectedResponse); + const [response] = await client.getFinding(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchScanConfigFromScanRunName', () => { - const result = client.matchScanConfigFromScanRunName(fakePath); - assert.strictEqual(result, "scanConfigValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes getFinding without error using callback', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.GetFindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding(), + ); + client.innerApiCalls.getFinding = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFinding( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1beta.IFinding | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchScanRunFromScanRunName', () => { - const result = client.matchScanRunFromScanRunName(fakePath); - assert.strictEqual(result, "scanRunValue"); - assert((client.pathTemplates.scanRunPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes getFinding with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.GetFindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFinding = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getFinding(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFinding as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFinding with closed client', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.GetFindingRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.GetFindingRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getFinding(request), expectedError); + }); + }); + + describe('listFindingTypeStats', () => { + it('invokes listFindingTypeStats without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse(), + ); + client.innerApiCalls.listFindingTypeStats = + stubSimpleCall(expectedResponse); + const [response] = await client.listFindingTypeStats(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats without error using callback', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsResponse(), + ); + client.innerApiCalls.listFindingTypeStats = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindingTypeStats( + request, + ( + err?: Error | null, + result?: protos.google.cloud.websecurityscanner.v1beta.IListFindingTypeStatsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindingTypeStats = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindingTypeStats as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingTypeStats with closed client', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListFindingTypeStatsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.listFindingTypeStats(request), expectedError); + }); + }); + + describe('listScanConfigs', () => { + it('invokes listScanConfigs without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ), + ]; + client.innerApiCalls.listScanConfigs = stubSimpleCall(expectedResponse); + const [response] = await client.listScanConfigs(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigs without error using callback', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ), + ]; + client.innerApiCalls.listScanConfigs = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanConfigs( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.websecurityscanner.v1beta.IScanConfig[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigs with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanConfigs = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listScanConfigs(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanConfigs as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanConfigsStream without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ), + ]; + client.descriptors.page.listScanConfigs.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ScanConfig[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.websecurityscanner.v1beta.ScanConfig, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listScanConfigs, request), + ); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listScanConfigsStream with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listScanConfigsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ScanConfig[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.websecurityscanner.v1beta.ScanConfig, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listScanConfigs, request), + ); + assert( + (client.descriptors.page.listScanConfigs.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listScanConfigs without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanConfig(), + ), + ]; + client.descriptors.page.listScanConfigs.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[] = + []; + const iterable = client.listScanConfigsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listScanConfigs.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listScanConfigs with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListScanConfigsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanConfigs.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanConfigsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1beta.IScanConfig[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listScanConfigs.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listScanConfigs.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listScanRuns', () => { + it('invokes listScanRuns without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ), + ]; + client.innerApiCalls.listScanRuns = stubSimpleCall(expectedResponse); + const [response] = await client.listScanRuns(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRuns without error using callback', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ), + ]; + client.innerApiCalls.listScanRuns = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScanRuns( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.websecurityscanner.v1beta.IScanRun[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRuns with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listScanRuns = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listScanRuns(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScanRuns as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listScanRunsStream without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ), + ]; + client.descriptors.page.listScanRuns.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ScanRun[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.websecurityscanner.v1beta.ScanRun) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listScanRuns, request), + ); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listScanRunsStream with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listScanRunsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ScanRun[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.websecurityscanner.v1beta.ScanRun) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listScanRuns, request), + ); + assert( + (client.descriptors.page.listScanRuns.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listScanRuns without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ScanRun(), + ), + ]; + client.descriptors.page.listScanRuns.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1beta.IScanRun[] = + []; + const iterable = client.listScanRunsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listScanRuns.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listScanRuns with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListScanRunsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScanRuns.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScanRunsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1beta.IScanRun[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listScanRuns.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listScanRuns.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listCrawledUrls', () => { + it('invokes listCrawledUrls without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl(), + ), + ]; + client.innerApiCalls.listCrawledUrls = stubSimpleCall(expectedResponse); + const [response] = await client.listCrawledUrls(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrls without error using callback', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl(), + ), + ]; + client.innerApiCalls.listCrawledUrls = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listCrawledUrls( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrls with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listCrawledUrls = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listCrawledUrls(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listCrawledUrls as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listCrawledUrlsStream without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl(), + ), + ]; + client.descriptors.page.listCrawledUrls.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCrawledUrls, request), + ); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listCrawledUrlsStream with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listCrawledUrlsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.websecurityscanner.v1beta.CrawledUrl, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listCrawledUrls, request), + ); + assert( + (client.descriptors.page.listCrawledUrls.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listCrawledUrls without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.CrawledUrl(), + ), + ]; + client.descriptors.page.listCrawledUrls.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[] = + []; + const iterable = client.listCrawledUrlsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listCrawledUrls with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListCrawledUrlsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listCrawledUrls.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listCrawledUrlsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1beta.ICrawledUrl[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listCrawledUrls.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listFindings', () => { + it('invokes listFindings without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding(), + ), + ]; + client.innerApiCalls.listFindings = stubSimpleCall(expectedResponse); + const [response] = await client.listFindings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings without error using callback', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding(), + ), + ]; + client.innerApiCalls.listFindings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listFindings( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.websecurityscanner.v1beta.IFinding[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindings with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listFindings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listFindings(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listFindings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listFindingsStream without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding(), + ), + ]; + client.descriptors.page.listFindings.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.Finding[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.websecurityscanner.v1beta.Finding) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFindings, request), + ); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listFindingsStream with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listFindingsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.websecurityscanner.v1beta.Finding[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.websecurityscanner.v1beta.Finding) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listFindings, request), + ); + assert( + (client.descriptors.page.listFindings.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listFindings without error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding(), + ), + generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.Finding(), + ), + ]; + client.descriptors.page.listFindings.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.websecurityscanner.v1beta.IFinding[] = + []; + const iterable = client.listFindingsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listFindings.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listFindings with error', async () => { + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.websecurityscanner.v1beta.ListFindingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.websecurityscanner.v1beta.ListFindingsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listFindings.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listFindingsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.websecurityscanner.v1beta.IFinding[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listFindings.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listFindings.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('Path templates', () => { + describe('finding', async () => { + const fakePath = '/rendered/path/finding'; + const expectedParameters = { + project: 'projectValue', + scan_config: 'scanConfigValue', + scan_run: 'scanRunValue', + finding: 'findingValue', + }; + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.findingPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.findingPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('findingPath', () => { + const result = client.findingPath( + 'projectValue', + 'scanConfigValue', + 'scanRunValue', + 'findingValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.findingPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromFindingName', () => { + const result = client.matchProjectFromFindingName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchScanConfigFromFindingName', () => { + const result = client.matchScanConfigFromFindingName(fakePath); + assert.strictEqual(result, 'scanConfigValue'); + assert( + (client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchScanRunFromFindingName', () => { + const result = client.matchScanRunFromFindingName(fakePath); + assert.strictEqual(result, 'scanRunValue'); + assert( + (client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchFindingFromFindingName', () => { + const result = client.matchFindingFromFindingName(fakePath); + assert.strictEqual(result, 'findingValue'); + assert( + (client.pathTemplates.findingPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('scanConfig', async () => { + const fakePath = '/rendered/path/scanConfig'; + const expectedParameters = { + project: 'projectValue', + scan_config: 'scanConfigValue', + }; + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.scanConfigPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.scanConfigPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('scanConfigPath', () => { + const result = client.scanConfigPath('projectValue', 'scanConfigValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.scanConfigPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromScanConfigName', () => { + const result = client.matchProjectFromScanConfigName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.scanConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchScanConfigFromScanConfigName', () => { + const result = client.matchScanConfigFromScanConfigName(fakePath); + assert.strictEqual(result, 'scanConfigValue'); + assert( + (client.pathTemplates.scanConfigPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('scanRun', async () => { + const fakePath = '/rendered/path/scanRun'; + const expectedParameters = { + project: 'projectValue', + scan_config: 'scanConfigValue', + scan_run: 'scanRunValue', + }; + const client = + new websecurityscannerModule.v1beta.WebSecurityScannerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.scanRunPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.scanRunPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('scanRunPath', () => { + const result = client.scanRunPath( + 'projectValue', + 'scanConfigValue', + 'scanRunValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.scanRunPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromScanRunName', () => { + const result = client.matchProjectFromScanRunName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchScanConfigFromScanRunName', () => { + const result = client.matchScanConfigFromScanRunName(fakePath); + assert.strictEqual(result, 'scanConfigValue'); + assert( + (client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchScanRunFromScanRunName', () => { + const result = client.matchScanRunFromScanRunName(fakePath); + assert.strictEqual(result, 'scanRunValue'); + assert( + (client.pathTemplates.scanRunPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-websecurityscanner/webpack.config.js b/packages/google-cloud-websecurityscanner/webpack.config.js index 99546e77f88d..ad3467d60d6e 100644 --- a/packages/google-cloud-websecurityscanner/webpack.config.js +++ b/packages/google-cloud-websecurityscanner/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2026 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. diff --git a/packages/google-cloud-workflows/.eslintignore b/packages/google-cloud-workflows/.eslintignore new file mode 100644 index 000000000000..cfc348ec4d11 --- /dev/null +++ b/packages/google-cloud-workflows/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/packages/google-cloud-workflows/.eslintrc.json b/packages/google-cloud-workflows/.eslintrc.json new file mode 100644 index 000000000000..3e8d97ccb390 --- /dev/null +++ b/packages/google-cloud-workflows/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "./node_modules/gts", + "root": true +} diff --git a/packages/google-cloud-workflows/README.md b/packages/google-cloud-workflows/README.md index fe06778dd5b6..851ee565be9d 100644 --- a/packages/google-cloud-workflows/README.md +++ b/packages/google-cloud-workflows/README.md @@ -58,16 +58,29 @@ Samples are in the [`samples/`][homepage_samples] directory. Each sample's `READ | Sample | Source Code | | --------------------------- | --------------------------------- | -| cancel execution | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows-executions/samples/generated/v1/executions.cancel_execution.js) | -| create execution | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows-executions/samples/generated/v1/executions.create_execution.js) | -| get execution | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows-executions/samples/generated/v1/executions.get_execution.js) | -| list executions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows-executions/samples/generated/v1/executions.list_executions.js) | -| cloud | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows-executions/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json) | -| cancel execution | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows-executions/samples/generated/v1beta/executions.cancel_execution.js) | -| create execution | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows-executions/samples/generated/v1beta/executions.create_execution.js) | -| get execution | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows-executions/samples/generated/v1beta/executions.get_execution.js) | -| list executions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows-executions/samples/generated/v1beta/executions.list_executions.js) | -| cloud | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows-executions/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json) | +| cancel execution | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1/executions.cancel_execution.js) | +| create execution | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1/executions.create_execution.js) | +| get execution | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1/executions.get_execution.js) | +| list executions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1/executions.list_executions.js) | +| cloud | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json) | +| cloud | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1/snippet_metadata_google.cloud.workflows.v1.json) | +| create workflow | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1/workflows.create_workflow.js) | +| delete workflow | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1/workflows.delete_workflow.js) | +| get workflow | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1/workflows.get_workflow.js) | +| list workflow revisions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1/workflows.list_workflow_revisions.js) | +| list workflows | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1/workflows.list_workflows.js) | +| update workflow | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1/workflows.update_workflow.js) | +| cancel execution | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1beta/executions.cancel_execution.js) | +| create execution | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1beta/executions.create_execution.js) | +| get execution | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1beta/executions.get_execution.js) | +| list executions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1beta/executions.list_executions.js) | +| cloud | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json) | +| cloud | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.v1beta.json) | +| create workflow | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1beta/workflows.create_workflow.js) | +| delete workflow | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1beta/workflows.delete_workflow.js) | +| get workflow | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1beta/workflows.get_workflow.js) | +| list workflows | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1beta/workflows.list_workflows.js) | +| update workflow | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows/samples/generated/v1beta/workflows.update_workflow.js) | ## Supported Node.js Versions @@ -101,7 +114,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows-executions/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). Please note that this `README.md` and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) @@ -111,7 +124,7 @@ are generated from a central template. Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workflows-executions/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project diff --git a/packages/google-cloud-workflows/protos/protos.d.ts b/packages/google-cloud-workflows/protos/protos.d.ts index 5353d236f583..365e7cee9579 100644 --- a/packages/google-cloud-workflows/protos/protos.d.ts +++ b/packages/google-cloud-workflows/protos/protos.d.ts @@ -2505,6 +2505,2533 @@ export namespace google { } } } + + /** Namespace v1. */ + namespace v1 { + + /** Represents a Workflows */ + class Workflows extends $protobuf.rpc.Service { + + /** + * Constructs a new Workflows service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Workflows service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Workflows; + + /** + * Calls ListWorkflows. + * @param request ListWorkflowsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListWorkflowsResponse + */ + public listWorkflows(request: google.cloud.workflows.v1.IListWorkflowsRequest, callback: google.cloud.workflows.v1.Workflows.ListWorkflowsCallback): void; + + /** + * Calls ListWorkflows. + * @param request ListWorkflowsRequest message or plain object + * @returns Promise + */ + public listWorkflows(request: google.cloud.workflows.v1.IListWorkflowsRequest): Promise; + + /** + * Calls GetWorkflow. + * @param request GetWorkflowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Workflow + */ + public getWorkflow(request: google.cloud.workflows.v1.IGetWorkflowRequest, callback: google.cloud.workflows.v1.Workflows.GetWorkflowCallback): void; + + /** + * Calls GetWorkflow. + * @param request GetWorkflowRequest message or plain object + * @returns Promise + */ + public getWorkflow(request: google.cloud.workflows.v1.IGetWorkflowRequest): Promise; + + /** + * Calls CreateWorkflow. + * @param request CreateWorkflowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createWorkflow(request: google.cloud.workflows.v1.ICreateWorkflowRequest, callback: google.cloud.workflows.v1.Workflows.CreateWorkflowCallback): void; + + /** + * Calls CreateWorkflow. + * @param request CreateWorkflowRequest message or plain object + * @returns Promise + */ + public createWorkflow(request: google.cloud.workflows.v1.ICreateWorkflowRequest): Promise; + + /** + * Calls DeleteWorkflow. + * @param request DeleteWorkflowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteWorkflow(request: google.cloud.workflows.v1.IDeleteWorkflowRequest, callback: google.cloud.workflows.v1.Workflows.DeleteWorkflowCallback): void; + + /** + * Calls DeleteWorkflow. + * @param request DeleteWorkflowRequest message or plain object + * @returns Promise + */ + public deleteWorkflow(request: google.cloud.workflows.v1.IDeleteWorkflowRequest): Promise; + + /** + * Calls UpdateWorkflow. + * @param request UpdateWorkflowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateWorkflow(request: google.cloud.workflows.v1.IUpdateWorkflowRequest, callback: google.cloud.workflows.v1.Workflows.UpdateWorkflowCallback): void; + + /** + * Calls UpdateWorkflow. + * @param request UpdateWorkflowRequest message or plain object + * @returns Promise + */ + public updateWorkflow(request: google.cloud.workflows.v1.IUpdateWorkflowRequest): Promise; + + /** + * Calls ListWorkflowRevisions. + * @param request ListWorkflowRevisionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListWorkflowRevisionsResponse + */ + public listWorkflowRevisions(request: google.cloud.workflows.v1.IListWorkflowRevisionsRequest, callback: google.cloud.workflows.v1.Workflows.ListWorkflowRevisionsCallback): void; + + /** + * Calls ListWorkflowRevisions. + * @param request ListWorkflowRevisionsRequest message or plain object + * @returns Promise + */ + public listWorkflowRevisions(request: google.cloud.workflows.v1.IListWorkflowRevisionsRequest): Promise; + } + + namespace Workflows { + + /** + * Callback as used by {@link google.cloud.workflows.v1.Workflows|listWorkflows}. + * @param error Error, if any + * @param [response] ListWorkflowsResponse + */ + type ListWorkflowsCallback = (error: (Error|null), response?: google.cloud.workflows.v1.ListWorkflowsResponse) => void; + + /** + * Callback as used by {@link google.cloud.workflows.v1.Workflows|getWorkflow}. + * @param error Error, if any + * @param [response] Workflow + */ + type GetWorkflowCallback = (error: (Error|null), response?: google.cloud.workflows.v1.Workflow) => void; + + /** + * Callback as used by {@link google.cloud.workflows.v1.Workflows|createWorkflow}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateWorkflowCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.workflows.v1.Workflows|deleteWorkflow}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteWorkflowCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.workflows.v1.Workflows|updateWorkflow}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateWorkflowCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.workflows.v1.Workflows|listWorkflowRevisions}. + * @param error Error, if any + * @param [response] ListWorkflowRevisionsResponse + */ + type ListWorkflowRevisionsCallback = (error: (Error|null), response?: google.cloud.workflows.v1.ListWorkflowRevisionsResponse) => void; + } + + /** Properties of a Workflow. */ + interface IWorkflow { + + /** Workflow name */ + name?: (string|null); + + /** Workflow description */ + description?: (string|null); + + /** Workflow state */ + state?: (google.cloud.workflows.v1.Workflow.State|keyof typeof google.cloud.workflows.v1.Workflow.State|null); + + /** Workflow revisionId */ + revisionId?: (string|null); + + /** Workflow createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Workflow updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** Workflow revisionCreateTime */ + revisionCreateTime?: (google.protobuf.ITimestamp|null); + + /** Workflow labels */ + labels?: ({ [k: string]: string }|null); + + /** Workflow serviceAccount */ + serviceAccount?: (string|null); + + /** Workflow sourceContents */ + sourceContents?: (string|null); + + /** Workflow cryptoKeyName */ + cryptoKeyName?: (string|null); + + /** Workflow stateError */ + stateError?: (google.cloud.workflows.v1.Workflow.IStateError|null); + + /** Workflow callLogLevel */ + callLogLevel?: (google.cloud.workflows.v1.Workflow.CallLogLevel|keyof typeof google.cloud.workflows.v1.Workflow.CallLogLevel|null); + + /** Workflow userEnvVars */ + userEnvVars?: ({ [k: string]: string }|null); + + /** Workflow executionHistoryLevel */ + executionHistoryLevel?: (google.cloud.workflows.v1.ExecutionHistoryLevel|keyof typeof google.cloud.workflows.v1.ExecutionHistoryLevel|null); + + /** Workflow allKmsKeys */ + allKmsKeys?: (string[]|null); + + /** Workflow allKmsKeysVersions */ + allKmsKeysVersions?: (string[]|null); + + /** Workflow cryptoKeyVersion */ + cryptoKeyVersion?: (string|null); + + /** Workflow tags */ + tags?: ({ [k: string]: string }|null); + } + + /** Represents a Workflow. */ + class Workflow implements IWorkflow { + + /** + * Constructs a new Workflow. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1.IWorkflow); + + /** Workflow name. */ + public name: string; + + /** Workflow description. */ + public description: string; + + /** Workflow state. */ + public state: (google.cloud.workflows.v1.Workflow.State|keyof typeof google.cloud.workflows.v1.Workflow.State); + + /** Workflow revisionId. */ + public revisionId: string; + + /** Workflow createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Workflow updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Workflow revisionCreateTime. */ + public revisionCreateTime?: (google.protobuf.ITimestamp|null); + + /** Workflow labels. */ + public labels: { [k: string]: string }; + + /** Workflow serviceAccount. */ + public serviceAccount: string; + + /** Workflow sourceContents. */ + public sourceContents?: (string|null); + + /** Workflow cryptoKeyName. */ + public cryptoKeyName: string; + + /** Workflow stateError. */ + public stateError?: (google.cloud.workflows.v1.Workflow.IStateError|null); + + /** Workflow callLogLevel. */ + public callLogLevel: (google.cloud.workflows.v1.Workflow.CallLogLevel|keyof typeof google.cloud.workflows.v1.Workflow.CallLogLevel); + + /** Workflow userEnvVars. */ + public userEnvVars: { [k: string]: string }; + + /** Workflow executionHistoryLevel. */ + public executionHistoryLevel: (google.cloud.workflows.v1.ExecutionHistoryLevel|keyof typeof google.cloud.workflows.v1.ExecutionHistoryLevel); + + /** Workflow allKmsKeys. */ + public allKmsKeys: string[]; + + /** Workflow allKmsKeysVersions. */ + public allKmsKeysVersions: string[]; + + /** Workflow cryptoKeyVersion. */ + public cryptoKeyVersion: string; + + /** Workflow tags. */ + public tags: { [k: string]: string }; + + /** Workflow sourceCode. */ + public sourceCode?: "sourceContents"; + + /** + * Creates a new Workflow instance using the specified properties. + * @param [properties] Properties to set + * @returns Workflow instance + */ + public static create(properties?: google.cloud.workflows.v1.IWorkflow): google.cloud.workflows.v1.Workflow; + + /** + * Encodes the specified Workflow message. Does not implicitly {@link google.cloud.workflows.v1.Workflow.verify|verify} messages. + * @param message Workflow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1.IWorkflow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Workflow message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.Workflow.verify|verify} messages. + * @param message Workflow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1.IWorkflow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Workflow message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Workflow + * @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.cloud.workflows.v1.Workflow; + + /** + * Decodes a Workflow message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Workflow + * @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.cloud.workflows.v1.Workflow; + + /** + * Verifies a Workflow 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 Workflow message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Workflow + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1.Workflow; + + /** + * Creates a plain object from a Workflow message. Also converts values to other types if specified. + * @param message Workflow + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1.Workflow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Workflow to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Workflow + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Workflow { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ACTIVE = 1, + UNAVAILABLE = 2 + } + + /** Properties of a StateError. */ + interface IStateError { + + /** StateError details */ + details?: (string|null); + + /** StateError type */ + type?: (google.cloud.workflows.v1.Workflow.StateError.Type|keyof typeof google.cloud.workflows.v1.Workflow.StateError.Type|null); + } + + /** Represents a StateError. */ + class StateError implements IStateError { + + /** + * Constructs a new StateError. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1.Workflow.IStateError); + + /** StateError details. */ + public details: string; + + /** StateError type. */ + public type: (google.cloud.workflows.v1.Workflow.StateError.Type|keyof typeof google.cloud.workflows.v1.Workflow.StateError.Type); + + /** + * Creates a new StateError instance using the specified properties. + * @param [properties] Properties to set + * @returns StateError instance + */ + public static create(properties?: google.cloud.workflows.v1.Workflow.IStateError): google.cloud.workflows.v1.Workflow.StateError; + + /** + * Encodes the specified StateError message. Does not implicitly {@link google.cloud.workflows.v1.Workflow.StateError.verify|verify} messages. + * @param message StateError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1.Workflow.IStateError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StateError message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.Workflow.StateError.verify|verify} messages. + * @param message StateError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1.Workflow.IStateError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StateError message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StateError + * @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.cloud.workflows.v1.Workflow.StateError; + + /** + * Decodes a StateError message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StateError + * @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.cloud.workflows.v1.Workflow.StateError; + + /** + * Verifies a StateError 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 StateError message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StateError + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1.Workflow.StateError; + + /** + * Creates a plain object from a StateError message. Also converts values to other types if specified. + * @param message StateError + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1.Workflow.StateError, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StateError to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StateError + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace StateError { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + KMS_ERROR = 1 + } + } + + /** CallLogLevel enum. */ + enum CallLogLevel { + CALL_LOG_LEVEL_UNSPECIFIED = 0, + LOG_ALL_CALLS = 1, + LOG_ERRORS_ONLY = 2, + LOG_NONE = 3 + } + } + + /** Properties of a ListWorkflowsRequest. */ + interface IListWorkflowsRequest { + + /** ListWorkflowsRequest parent */ + parent?: (string|null); + + /** ListWorkflowsRequest pageSize */ + pageSize?: (number|null); + + /** ListWorkflowsRequest pageToken */ + pageToken?: (string|null); + + /** ListWorkflowsRequest filter */ + filter?: (string|null); + + /** ListWorkflowsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListWorkflowsRequest. */ + class ListWorkflowsRequest implements IListWorkflowsRequest { + + /** + * Constructs a new ListWorkflowsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1.IListWorkflowsRequest); + + /** ListWorkflowsRequest parent. */ + public parent: string; + + /** ListWorkflowsRequest pageSize. */ + public pageSize: number; + + /** ListWorkflowsRequest pageToken. */ + public pageToken: string; + + /** ListWorkflowsRequest filter. */ + public filter: string; + + /** ListWorkflowsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListWorkflowsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListWorkflowsRequest instance + */ + public static create(properties?: google.cloud.workflows.v1.IListWorkflowsRequest): google.cloud.workflows.v1.ListWorkflowsRequest; + + /** + * Encodes the specified ListWorkflowsRequest message. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowsRequest.verify|verify} messages. + * @param message ListWorkflowsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1.IListWorkflowsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListWorkflowsRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowsRequest.verify|verify} messages. + * @param message ListWorkflowsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1.IListWorkflowsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListWorkflowsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListWorkflowsRequest + * @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.cloud.workflows.v1.ListWorkflowsRequest; + + /** + * Decodes a ListWorkflowsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListWorkflowsRequest + * @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.cloud.workflows.v1.ListWorkflowsRequest; + + /** + * Verifies a ListWorkflowsRequest 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 ListWorkflowsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListWorkflowsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1.ListWorkflowsRequest; + + /** + * Creates a plain object from a ListWorkflowsRequest message. Also converts values to other types if specified. + * @param message ListWorkflowsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1.ListWorkflowsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListWorkflowsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListWorkflowsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListWorkflowsResponse. */ + interface IListWorkflowsResponse { + + /** ListWorkflowsResponse workflows */ + workflows?: (google.cloud.workflows.v1.IWorkflow[]|null); + + /** ListWorkflowsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListWorkflowsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListWorkflowsResponse. */ + class ListWorkflowsResponse implements IListWorkflowsResponse { + + /** + * Constructs a new ListWorkflowsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1.IListWorkflowsResponse); + + /** ListWorkflowsResponse workflows. */ + public workflows: google.cloud.workflows.v1.IWorkflow[]; + + /** ListWorkflowsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListWorkflowsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListWorkflowsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListWorkflowsResponse instance + */ + public static create(properties?: google.cloud.workflows.v1.IListWorkflowsResponse): google.cloud.workflows.v1.ListWorkflowsResponse; + + /** + * Encodes the specified ListWorkflowsResponse message. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowsResponse.verify|verify} messages. + * @param message ListWorkflowsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1.IListWorkflowsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListWorkflowsResponse message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowsResponse.verify|verify} messages. + * @param message ListWorkflowsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1.IListWorkflowsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListWorkflowsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListWorkflowsResponse + * @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.cloud.workflows.v1.ListWorkflowsResponse; + + /** + * Decodes a ListWorkflowsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListWorkflowsResponse + * @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.cloud.workflows.v1.ListWorkflowsResponse; + + /** + * Verifies a ListWorkflowsResponse 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 ListWorkflowsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListWorkflowsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1.ListWorkflowsResponse; + + /** + * Creates a plain object from a ListWorkflowsResponse message. Also converts values to other types if specified. + * @param message ListWorkflowsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1.ListWorkflowsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListWorkflowsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListWorkflowsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetWorkflowRequest. */ + interface IGetWorkflowRequest { + + /** GetWorkflowRequest name */ + name?: (string|null); + + /** GetWorkflowRequest revisionId */ + revisionId?: (string|null); + } + + /** Represents a GetWorkflowRequest. */ + class GetWorkflowRequest implements IGetWorkflowRequest { + + /** + * Constructs a new GetWorkflowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1.IGetWorkflowRequest); + + /** GetWorkflowRequest name. */ + public name: string; + + /** GetWorkflowRequest revisionId. */ + public revisionId: string; + + /** + * Creates a new GetWorkflowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetWorkflowRequest instance + */ + public static create(properties?: google.cloud.workflows.v1.IGetWorkflowRequest): google.cloud.workflows.v1.GetWorkflowRequest; + + /** + * Encodes the specified GetWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1.GetWorkflowRequest.verify|verify} messages. + * @param message GetWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1.IGetWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.GetWorkflowRequest.verify|verify} messages. + * @param message GetWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1.IGetWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetWorkflowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetWorkflowRequest + * @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.cloud.workflows.v1.GetWorkflowRequest; + + /** + * Decodes a GetWorkflowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetWorkflowRequest + * @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.cloud.workflows.v1.GetWorkflowRequest; + + /** + * Verifies a GetWorkflowRequest 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 GetWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetWorkflowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1.GetWorkflowRequest; + + /** + * Creates a plain object from a GetWorkflowRequest message. Also converts values to other types if specified. + * @param message GetWorkflowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1.GetWorkflowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetWorkflowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetWorkflowRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateWorkflowRequest. */ + interface ICreateWorkflowRequest { + + /** CreateWorkflowRequest parent */ + parent?: (string|null); + + /** CreateWorkflowRequest workflow */ + workflow?: (google.cloud.workflows.v1.IWorkflow|null); + + /** CreateWorkflowRequest workflowId */ + workflowId?: (string|null); + } + + /** Represents a CreateWorkflowRequest. */ + class CreateWorkflowRequest implements ICreateWorkflowRequest { + + /** + * Constructs a new CreateWorkflowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1.ICreateWorkflowRequest); + + /** CreateWorkflowRequest parent. */ + public parent: string; + + /** CreateWorkflowRequest workflow. */ + public workflow?: (google.cloud.workflows.v1.IWorkflow|null); + + /** CreateWorkflowRequest workflowId. */ + public workflowId: string; + + /** + * Creates a new CreateWorkflowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateWorkflowRequest instance + */ + public static create(properties?: google.cloud.workflows.v1.ICreateWorkflowRequest): google.cloud.workflows.v1.CreateWorkflowRequest; + + /** + * Encodes the specified CreateWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1.CreateWorkflowRequest.verify|verify} messages. + * @param message CreateWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1.ICreateWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.CreateWorkflowRequest.verify|verify} messages. + * @param message CreateWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1.ICreateWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateWorkflowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateWorkflowRequest + * @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.cloud.workflows.v1.CreateWorkflowRequest; + + /** + * Decodes a CreateWorkflowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateWorkflowRequest + * @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.cloud.workflows.v1.CreateWorkflowRequest; + + /** + * Verifies a CreateWorkflowRequest 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 CreateWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateWorkflowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1.CreateWorkflowRequest; + + /** + * Creates a plain object from a CreateWorkflowRequest message. Also converts values to other types if specified. + * @param message CreateWorkflowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1.CreateWorkflowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateWorkflowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateWorkflowRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteWorkflowRequest. */ + interface IDeleteWorkflowRequest { + + /** DeleteWorkflowRequest name */ + name?: (string|null); + } + + /** Represents a DeleteWorkflowRequest. */ + class DeleteWorkflowRequest implements IDeleteWorkflowRequest { + + /** + * Constructs a new DeleteWorkflowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1.IDeleteWorkflowRequest); + + /** DeleteWorkflowRequest name. */ + public name: string; + + /** + * Creates a new DeleteWorkflowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteWorkflowRequest instance + */ + public static create(properties?: google.cloud.workflows.v1.IDeleteWorkflowRequest): google.cloud.workflows.v1.DeleteWorkflowRequest; + + /** + * Encodes the specified DeleteWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1.DeleteWorkflowRequest.verify|verify} messages. + * @param message DeleteWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1.IDeleteWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.DeleteWorkflowRequest.verify|verify} messages. + * @param message DeleteWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1.IDeleteWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteWorkflowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteWorkflowRequest + * @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.cloud.workflows.v1.DeleteWorkflowRequest; + + /** + * Decodes a DeleteWorkflowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteWorkflowRequest + * @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.cloud.workflows.v1.DeleteWorkflowRequest; + + /** + * Verifies a DeleteWorkflowRequest 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 DeleteWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteWorkflowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1.DeleteWorkflowRequest; + + /** + * Creates a plain object from a DeleteWorkflowRequest message. Also converts values to other types if specified. + * @param message DeleteWorkflowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1.DeleteWorkflowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteWorkflowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteWorkflowRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateWorkflowRequest. */ + interface IUpdateWorkflowRequest { + + /** UpdateWorkflowRequest workflow */ + workflow?: (google.cloud.workflows.v1.IWorkflow|null); + + /** UpdateWorkflowRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateWorkflowRequest. */ + class UpdateWorkflowRequest implements IUpdateWorkflowRequest { + + /** + * Constructs a new UpdateWorkflowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1.IUpdateWorkflowRequest); + + /** UpdateWorkflowRequest workflow. */ + public workflow?: (google.cloud.workflows.v1.IWorkflow|null); + + /** UpdateWorkflowRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateWorkflowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateWorkflowRequest instance + */ + public static create(properties?: google.cloud.workflows.v1.IUpdateWorkflowRequest): google.cloud.workflows.v1.UpdateWorkflowRequest; + + /** + * Encodes the specified UpdateWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1.UpdateWorkflowRequest.verify|verify} messages. + * @param message UpdateWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1.IUpdateWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.UpdateWorkflowRequest.verify|verify} messages. + * @param message UpdateWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1.IUpdateWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateWorkflowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateWorkflowRequest + * @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.cloud.workflows.v1.UpdateWorkflowRequest; + + /** + * Decodes an UpdateWorkflowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateWorkflowRequest + * @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.cloud.workflows.v1.UpdateWorkflowRequest; + + /** + * Verifies an UpdateWorkflowRequest 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 an UpdateWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateWorkflowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1.UpdateWorkflowRequest; + + /** + * Creates a plain object from an UpdateWorkflowRequest message. Also converts values to other types if specified. + * @param message UpdateWorkflowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1.UpdateWorkflowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateWorkflowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateWorkflowRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OperationMetadata. */ + interface IOperationMetadata { + + /** OperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata target */ + target?: (string|null); + + /** OperationMetadata verb */ + verb?: (string|null); + + /** OperationMetadata apiVersion */ + apiVersion?: (string|null); + } + + /** Represents an OperationMetadata. */ + class OperationMetadata implements IOperationMetadata { + + /** + * Constructs a new OperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1.IOperationMetadata); + + /** OperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata target. */ + public target: string; + + /** OperationMetadata verb. */ + public verb: string; + + /** OperationMetadata apiVersion. */ + public apiVersion: string; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationMetadata instance + */ + public static create(properties?: google.cloud.workflows.v1.IOperationMetadata): google.cloud.workflows.v1.OperationMetadata; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.workflows.v1.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationMetadata + * @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.cloud.workflows.v1.OperationMetadata; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationMetadata + * @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.cloud.workflows.v1.OperationMetadata; + + /** + * Verifies an OperationMetadata 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 an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1.OperationMetadata; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @param message OperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListWorkflowRevisionsRequest. */ + interface IListWorkflowRevisionsRequest { + + /** ListWorkflowRevisionsRequest name */ + name?: (string|null); + + /** ListWorkflowRevisionsRequest pageSize */ + pageSize?: (number|null); + + /** ListWorkflowRevisionsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListWorkflowRevisionsRequest. */ + class ListWorkflowRevisionsRequest implements IListWorkflowRevisionsRequest { + + /** + * Constructs a new ListWorkflowRevisionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1.IListWorkflowRevisionsRequest); + + /** ListWorkflowRevisionsRequest name. */ + public name: string; + + /** ListWorkflowRevisionsRequest pageSize. */ + public pageSize: number; + + /** ListWorkflowRevisionsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListWorkflowRevisionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListWorkflowRevisionsRequest instance + */ + public static create(properties?: google.cloud.workflows.v1.IListWorkflowRevisionsRequest): google.cloud.workflows.v1.ListWorkflowRevisionsRequest; + + /** + * Encodes the specified ListWorkflowRevisionsRequest message. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowRevisionsRequest.verify|verify} messages. + * @param message ListWorkflowRevisionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1.IListWorkflowRevisionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListWorkflowRevisionsRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowRevisionsRequest.verify|verify} messages. + * @param message ListWorkflowRevisionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1.IListWorkflowRevisionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListWorkflowRevisionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListWorkflowRevisionsRequest + * @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.cloud.workflows.v1.ListWorkflowRevisionsRequest; + + /** + * Decodes a ListWorkflowRevisionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListWorkflowRevisionsRequest + * @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.cloud.workflows.v1.ListWorkflowRevisionsRequest; + + /** + * Verifies a ListWorkflowRevisionsRequest 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 ListWorkflowRevisionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListWorkflowRevisionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1.ListWorkflowRevisionsRequest; + + /** + * Creates a plain object from a ListWorkflowRevisionsRequest message. Also converts values to other types if specified. + * @param message ListWorkflowRevisionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1.ListWorkflowRevisionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListWorkflowRevisionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListWorkflowRevisionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListWorkflowRevisionsResponse. */ + interface IListWorkflowRevisionsResponse { + + /** ListWorkflowRevisionsResponse workflows */ + workflows?: (google.cloud.workflows.v1.IWorkflow[]|null); + + /** ListWorkflowRevisionsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListWorkflowRevisionsResponse. */ + class ListWorkflowRevisionsResponse implements IListWorkflowRevisionsResponse { + + /** + * Constructs a new ListWorkflowRevisionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1.IListWorkflowRevisionsResponse); + + /** ListWorkflowRevisionsResponse workflows. */ + public workflows: google.cloud.workflows.v1.IWorkflow[]; + + /** ListWorkflowRevisionsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListWorkflowRevisionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListWorkflowRevisionsResponse instance + */ + public static create(properties?: google.cloud.workflows.v1.IListWorkflowRevisionsResponse): google.cloud.workflows.v1.ListWorkflowRevisionsResponse; + + /** + * Encodes the specified ListWorkflowRevisionsResponse message. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowRevisionsResponse.verify|verify} messages. + * @param message ListWorkflowRevisionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1.IListWorkflowRevisionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListWorkflowRevisionsResponse message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowRevisionsResponse.verify|verify} messages. + * @param message ListWorkflowRevisionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1.IListWorkflowRevisionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListWorkflowRevisionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListWorkflowRevisionsResponse + * @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.cloud.workflows.v1.ListWorkflowRevisionsResponse; + + /** + * Decodes a ListWorkflowRevisionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListWorkflowRevisionsResponse + * @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.cloud.workflows.v1.ListWorkflowRevisionsResponse; + + /** + * Verifies a ListWorkflowRevisionsResponse 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 ListWorkflowRevisionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListWorkflowRevisionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1.ListWorkflowRevisionsResponse; + + /** + * Creates a plain object from a ListWorkflowRevisionsResponse message. Also converts values to other types if specified. + * @param message ListWorkflowRevisionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1.ListWorkflowRevisionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListWorkflowRevisionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListWorkflowRevisionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** ExecutionHistoryLevel enum. */ + enum ExecutionHistoryLevel { + EXECUTION_HISTORY_LEVEL_UNSPECIFIED = 0, + EXECUTION_HISTORY_BASIC = 1, + EXECUTION_HISTORY_DETAILED = 2 + } + } + + /** Namespace v1beta. */ + namespace v1beta { + + /** Represents a Workflows */ + class Workflows extends $protobuf.rpc.Service { + + /** + * Constructs a new Workflows service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Workflows service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Workflows; + + /** + * Calls ListWorkflows. + * @param request ListWorkflowsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListWorkflowsResponse + */ + public listWorkflows(request: google.cloud.workflows.v1beta.IListWorkflowsRequest, callback: google.cloud.workflows.v1beta.Workflows.ListWorkflowsCallback): void; + + /** + * Calls ListWorkflows. + * @param request ListWorkflowsRequest message or plain object + * @returns Promise + */ + public listWorkflows(request: google.cloud.workflows.v1beta.IListWorkflowsRequest): Promise; + + /** + * Calls GetWorkflow. + * @param request GetWorkflowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Workflow + */ + public getWorkflow(request: google.cloud.workflows.v1beta.IGetWorkflowRequest, callback: google.cloud.workflows.v1beta.Workflows.GetWorkflowCallback): void; + + /** + * Calls GetWorkflow. + * @param request GetWorkflowRequest message or plain object + * @returns Promise + */ + public getWorkflow(request: google.cloud.workflows.v1beta.IGetWorkflowRequest): Promise; + + /** + * Calls CreateWorkflow. + * @param request CreateWorkflowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createWorkflow(request: google.cloud.workflows.v1beta.ICreateWorkflowRequest, callback: google.cloud.workflows.v1beta.Workflows.CreateWorkflowCallback): void; + + /** + * Calls CreateWorkflow. + * @param request CreateWorkflowRequest message or plain object + * @returns Promise + */ + public createWorkflow(request: google.cloud.workflows.v1beta.ICreateWorkflowRequest): Promise; + + /** + * Calls DeleteWorkflow. + * @param request DeleteWorkflowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteWorkflow(request: google.cloud.workflows.v1beta.IDeleteWorkflowRequest, callback: google.cloud.workflows.v1beta.Workflows.DeleteWorkflowCallback): void; + + /** + * Calls DeleteWorkflow. + * @param request DeleteWorkflowRequest message or plain object + * @returns Promise + */ + public deleteWorkflow(request: google.cloud.workflows.v1beta.IDeleteWorkflowRequest): Promise; + + /** + * Calls UpdateWorkflow. + * @param request UpdateWorkflowRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateWorkflow(request: google.cloud.workflows.v1beta.IUpdateWorkflowRequest, callback: google.cloud.workflows.v1beta.Workflows.UpdateWorkflowCallback): void; + + /** + * Calls UpdateWorkflow. + * @param request UpdateWorkflowRequest message or plain object + * @returns Promise + */ + public updateWorkflow(request: google.cloud.workflows.v1beta.IUpdateWorkflowRequest): Promise; + } + + namespace Workflows { + + /** + * Callback as used by {@link google.cloud.workflows.v1beta.Workflows|listWorkflows}. + * @param error Error, if any + * @param [response] ListWorkflowsResponse + */ + type ListWorkflowsCallback = (error: (Error|null), response?: google.cloud.workflows.v1beta.ListWorkflowsResponse) => void; + + /** + * Callback as used by {@link google.cloud.workflows.v1beta.Workflows|getWorkflow}. + * @param error Error, if any + * @param [response] Workflow + */ + type GetWorkflowCallback = (error: (Error|null), response?: google.cloud.workflows.v1beta.Workflow) => void; + + /** + * Callback as used by {@link google.cloud.workflows.v1beta.Workflows|createWorkflow}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateWorkflowCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.workflows.v1beta.Workflows|deleteWorkflow}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteWorkflowCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.workflows.v1beta.Workflows|updateWorkflow}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateWorkflowCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a Workflow. */ + interface IWorkflow { + + /** Workflow name */ + name?: (string|null); + + /** Workflow description */ + description?: (string|null); + + /** Workflow state */ + state?: (google.cloud.workflows.v1beta.Workflow.State|keyof typeof google.cloud.workflows.v1beta.Workflow.State|null); + + /** Workflow revisionId */ + revisionId?: (string|null); + + /** Workflow createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Workflow updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** Workflow revisionCreateTime */ + revisionCreateTime?: (google.protobuf.ITimestamp|null); + + /** Workflow labels */ + labels?: ({ [k: string]: string }|null); + + /** Workflow serviceAccount */ + serviceAccount?: (string|null); + + /** Workflow sourceContents */ + sourceContents?: (string|null); + } + + /** Represents a Workflow. */ + class Workflow implements IWorkflow { + + /** + * Constructs a new Workflow. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1beta.IWorkflow); + + /** Workflow name. */ + public name: string; + + /** Workflow description. */ + public description: string; + + /** Workflow state. */ + public state: (google.cloud.workflows.v1beta.Workflow.State|keyof typeof google.cloud.workflows.v1beta.Workflow.State); + + /** Workflow revisionId. */ + public revisionId: string; + + /** Workflow createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Workflow updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Workflow revisionCreateTime. */ + public revisionCreateTime?: (google.protobuf.ITimestamp|null); + + /** Workflow labels. */ + public labels: { [k: string]: string }; + + /** Workflow serviceAccount. */ + public serviceAccount: string; + + /** Workflow sourceContents. */ + public sourceContents?: (string|null); + + /** Workflow sourceCode. */ + public sourceCode?: "sourceContents"; + + /** + * Creates a new Workflow instance using the specified properties. + * @param [properties] Properties to set + * @returns Workflow instance + */ + public static create(properties?: google.cloud.workflows.v1beta.IWorkflow): google.cloud.workflows.v1beta.Workflow; + + /** + * Encodes the specified Workflow message. Does not implicitly {@link google.cloud.workflows.v1beta.Workflow.verify|verify} messages. + * @param message Workflow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1beta.IWorkflow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Workflow message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.Workflow.verify|verify} messages. + * @param message Workflow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1beta.IWorkflow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Workflow message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Workflow + * @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.cloud.workflows.v1beta.Workflow; + + /** + * Decodes a Workflow message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Workflow + * @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.cloud.workflows.v1beta.Workflow; + + /** + * Verifies a Workflow 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 Workflow message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Workflow + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1beta.Workflow; + + /** + * Creates a plain object from a Workflow message. Also converts values to other types if specified. + * @param message Workflow + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1beta.Workflow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Workflow to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Workflow + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Workflow { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ACTIVE = 1 + } + } + + /** Properties of a ListWorkflowsRequest. */ + interface IListWorkflowsRequest { + + /** ListWorkflowsRequest parent */ + parent?: (string|null); + + /** ListWorkflowsRequest pageSize */ + pageSize?: (number|null); + + /** ListWorkflowsRequest pageToken */ + pageToken?: (string|null); + + /** ListWorkflowsRequest filter */ + filter?: (string|null); + + /** ListWorkflowsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListWorkflowsRequest. */ + class ListWorkflowsRequest implements IListWorkflowsRequest { + + /** + * Constructs a new ListWorkflowsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1beta.IListWorkflowsRequest); + + /** ListWorkflowsRequest parent. */ + public parent: string; + + /** ListWorkflowsRequest pageSize. */ + public pageSize: number; + + /** ListWorkflowsRequest pageToken. */ + public pageToken: string; + + /** ListWorkflowsRequest filter. */ + public filter: string; + + /** ListWorkflowsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListWorkflowsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListWorkflowsRequest instance + */ + public static create(properties?: google.cloud.workflows.v1beta.IListWorkflowsRequest): google.cloud.workflows.v1beta.ListWorkflowsRequest; + + /** + * Encodes the specified ListWorkflowsRequest message. Does not implicitly {@link google.cloud.workflows.v1beta.ListWorkflowsRequest.verify|verify} messages. + * @param message ListWorkflowsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1beta.IListWorkflowsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListWorkflowsRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.ListWorkflowsRequest.verify|verify} messages. + * @param message ListWorkflowsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1beta.IListWorkflowsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListWorkflowsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListWorkflowsRequest + * @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.cloud.workflows.v1beta.ListWorkflowsRequest; + + /** + * Decodes a ListWorkflowsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListWorkflowsRequest + * @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.cloud.workflows.v1beta.ListWorkflowsRequest; + + /** + * Verifies a ListWorkflowsRequest 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 ListWorkflowsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListWorkflowsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1beta.ListWorkflowsRequest; + + /** + * Creates a plain object from a ListWorkflowsRequest message. Also converts values to other types if specified. + * @param message ListWorkflowsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1beta.ListWorkflowsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListWorkflowsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListWorkflowsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListWorkflowsResponse. */ + interface IListWorkflowsResponse { + + /** ListWorkflowsResponse workflows */ + workflows?: (google.cloud.workflows.v1beta.IWorkflow[]|null); + + /** ListWorkflowsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListWorkflowsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListWorkflowsResponse. */ + class ListWorkflowsResponse implements IListWorkflowsResponse { + + /** + * Constructs a new ListWorkflowsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1beta.IListWorkflowsResponse); + + /** ListWorkflowsResponse workflows. */ + public workflows: google.cloud.workflows.v1beta.IWorkflow[]; + + /** ListWorkflowsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListWorkflowsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListWorkflowsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListWorkflowsResponse instance + */ + public static create(properties?: google.cloud.workflows.v1beta.IListWorkflowsResponse): google.cloud.workflows.v1beta.ListWorkflowsResponse; + + /** + * Encodes the specified ListWorkflowsResponse message. Does not implicitly {@link google.cloud.workflows.v1beta.ListWorkflowsResponse.verify|verify} messages. + * @param message ListWorkflowsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1beta.IListWorkflowsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListWorkflowsResponse message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.ListWorkflowsResponse.verify|verify} messages. + * @param message ListWorkflowsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1beta.IListWorkflowsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListWorkflowsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListWorkflowsResponse + * @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.cloud.workflows.v1beta.ListWorkflowsResponse; + + /** + * Decodes a ListWorkflowsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListWorkflowsResponse + * @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.cloud.workflows.v1beta.ListWorkflowsResponse; + + /** + * Verifies a ListWorkflowsResponse 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 ListWorkflowsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListWorkflowsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1beta.ListWorkflowsResponse; + + /** + * Creates a plain object from a ListWorkflowsResponse message. Also converts values to other types if specified. + * @param message ListWorkflowsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1beta.ListWorkflowsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListWorkflowsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListWorkflowsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetWorkflowRequest. */ + interface IGetWorkflowRequest { + + /** GetWorkflowRequest name */ + name?: (string|null); + } + + /** Represents a GetWorkflowRequest. */ + class GetWorkflowRequest implements IGetWorkflowRequest { + + /** + * Constructs a new GetWorkflowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1beta.IGetWorkflowRequest); + + /** GetWorkflowRequest name. */ + public name: string; + + /** + * Creates a new GetWorkflowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetWorkflowRequest instance + */ + public static create(properties?: google.cloud.workflows.v1beta.IGetWorkflowRequest): google.cloud.workflows.v1beta.GetWorkflowRequest; + + /** + * Encodes the specified GetWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1beta.GetWorkflowRequest.verify|verify} messages. + * @param message GetWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1beta.IGetWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.GetWorkflowRequest.verify|verify} messages. + * @param message GetWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1beta.IGetWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetWorkflowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetWorkflowRequest + * @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.cloud.workflows.v1beta.GetWorkflowRequest; + + /** + * Decodes a GetWorkflowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetWorkflowRequest + * @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.cloud.workflows.v1beta.GetWorkflowRequest; + + /** + * Verifies a GetWorkflowRequest 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 GetWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetWorkflowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1beta.GetWorkflowRequest; + + /** + * Creates a plain object from a GetWorkflowRequest message. Also converts values to other types if specified. + * @param message GetWorkflowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1beta.GetWorkflowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetWorkflowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetWorkflowRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateWorkflowRequest. */ + interface ICreateWorkflowRequest { + + /** CreateWorkflowRequest parent */ + parent?: (string|null); + + /** CreateWorkflowRequest workflow */ + workflow?: (google.cloud.workflows.v1beta.IWorkflow|null); + + /** CreateWorkflowRequest workflowId */ + workflowId?: (string|null); + } + + /** Represents a CreateWorkflowRequest. */ + class CreateWorkflowRequest implements ICreateWorkflowRequest { + + /** + * Constructs a new CreateWorkflowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1beta.ICreateWorkflowRequest); + + /** CreateWorkflowRequest parent. */ + public parent: string; + + /** CreateWorkflowRequest workflow. */ + public workflow?: (google.cloud.workflows.v1beta.IWorkflow|null); + + /** CreateWorkflowRequest workflowId. */ + public workflowId: string; + + /** + * Creates a new CreateWorkflowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateWorkflowRequest instance + */ + public static create(properties?: google.cloud.workflows.v1beta.ICreateWorkflowRequest): google.cloud.workflows.v1beta.CreateWorkflowRequest; + + /** + * Encodes the specified CreateWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1beta.CreateWorkflowRequest.verify|verify} messages. + * @param message CreateWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1beta.ICreateWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.CreateWorkflowRequest.verify|verify} messages. + * @param message CreateWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1beta.ICreateWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateWorkflowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateWorkflowRequest + * @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.cloud.workflows.v1beta.CreateWorkflowRequest; + + /** + * Decodes a CreateWorkflowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateWorkflowRequest + * @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.cloud.workflows.v1beta.CreateWorkflowRequest; + + /** + * Verifies a CreateWorkflowRequest 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 CreateWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateWorkflowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1beta.CreateWorkflowRequest; + + /** + * Creates a plain object from a CreateWorkflowRequest message. Also converts values to other types if specified. + * @param message CreateWorkflowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1beta.CreateWorkflowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateWorkflowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateWorkflowRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteWorkflowRequest. */ + interface IDeleteWorkflowRequest { + + /** DeleteWorkflowRequest name */ + name?: (string|null); + } + + /** Represents a DeleteWorkflowRequest. */ + class DeleteWorkflowRequest implements IDeleteWorkflowRequest { + + /** + * Constructs a new DeleteWorkflowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1beta.IDeleteWorkflowRequest); + + /** DeleteWorkflowRequest name. */ + public name: string; + + /** + * Creates a new DeleteWorkflowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteWorkflowRequest instance + */ + public static create(properties?: google.cloud.workflows.v1beta.IDeleteWorkflowRequest): google.cloud.workflows.v1beta.DeleteWorkflowRequest; + + /** + * Encodes the specified DeleteWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1beta.DeleteWorkflowRequest.verify|verify} messages. + * @param message DeleteWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1beta.IDeleteWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.DeleteWorkflowRequest.verify|verify} messages. + * @param message DeleteWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1beta.IDeleteWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteWorkflowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteWorkflowRequest + * @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.cloud.workflows.v1beta.DeleteWorkflowRequest; + + /** + * Decodes a DeleteWorkflowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteWorkflowRequest + * @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.cloud.workflows.v1beta.DeleteWorkflowRequest; + + /** + * Verifies a DeleteWorkflowRequest 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 DeleteWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteWorkflowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1beta.DeleteWorkflowRequest; + + /** + * Creates a plain object from a DeleteWorkflowRequest message. Also converts values to other types if specified. + * @param message DeleteWorkflowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1beta.DeleteWorkflowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteWorkflowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteWorkflowRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateWorkflowRequest. */ + interface IUpdateWorkflowRequest { + + /** UpdateWorkflowRequest workflow */ + workflow?: (google.cloud.workflows.v1beta.IWorkflow|null); + + /** UpdateWorkflowRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateWorkflowRequest. */ + class UpdateWorkflowRequest implements IUpdateWorkflowRequest { + + /** + * Constructs a new UpdateWorkflowRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1beta.IUpdateWorkflowRequest); + + /** UpdateWorkflowRequest workflow. */ + public workflow?: (google.cloud.workflows.v1beta.IWorkflow|null); + + /** UpdateWorkflowRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateWorkflowRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateWorkflowRequest instance + */ + public static create(properties?: google.cloud.workflows.v1beta.IUpdateWorkflowRequest): google.cloud.workflows.v1beta.UpdateWorkflowRequest; + + /** + * Encodes the specified UpdateWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1beta.UpdateWorkflowRequest.verify|verify} messages. + * @param message UpdateWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1beta.IUpdateWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.UpdateWorkflowRequest.verify|verify} messages. + * @param message UpdateWorkflowRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1beta.IUpdateWorkflowRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateWorkflowRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateWorkflowRequest + * @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.cloud.workflows.v1beta.UpdateWorkflowRequest; + + /** + * Decodes an UpdateWorkflowRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateWorkflowRequest + * @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.cloud.workflows.v1beta.UpdateWorkflowRequest; + + /** + * Verifies an UpdateWorkflowRequest 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 an UpdateWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateWorkflowRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1beta.UpdateWorkflowRequest; + + /** + * Creates a plain object from an UpdateWorkflowRequest message. Also converts values to other types if specified. + * @param message UpdateWorkflowRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1beta.UpdateWorkflowRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateWorkflowRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateWorkflowRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OperationMetadata. */ + interface IOperationMetadata { + + /** OperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata target */ + target?: (string|null); + + /** OperationMetadata verb */ + verb?: (string|null); + + /** OperationMetadata apiVersion */ + apiVersion?: (string|null); + } + + /** Represents an OperationMetadata. */ + class OperationMetadata implements IOperationMetadata { + + /** + * Constructs a new OperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.workflows.v1beta.IOperationMetadata); + + /** OperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** OperationMetadata target. */ + public target: string; + + /** OperationMetadata verb. */ + public verb: string; + + /** OperationMetadata apiVersion. */ + public apiVersion: string; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationMetadata instance + */ + public static create(properties?: google.cloud.workflows.v1beta.IOperationMetadata): google.cloud.workflows.v1beta.OperationMetadata; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.workflows.v1beta.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.workflows.v1beta.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.workflows.v1beta.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationMetadata + * @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.cloud.workflows.v1beta.OperationMetadata; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationMetadata + * @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.cloud.workflows.v1beta.OperationMetadata; + + /** + * Verifies an OperationMetadata 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 an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.workflows.v1beta.OperationMetadata; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @param message OperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.workflows.v1beta.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } } } @@ -2879,6 +5406,9 @@ export namespace google { /** CommonLanguageSettings destinations */ destinations?: (google.api.ClientLibraryDestination[]|null); + + /** CommonLanguageSettings selectiveGapicGeneration */ + selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); } /** Represents a CommonLanguageSettings. */ @@ -2896,6 +5426,9 @@ export namespace google { /** CommonLanguageSettings destinations. */ public destinations: google.api.ClientLibraryDestination[]; + /** CommonLanguageSettings selectiveGapicGeneration. */ + public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @param [properties] Properties to set @@ -3596,6 +6129,9 @@ export namespace google { /** PythonSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures */ + experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); } /** Represents a PythonSettings. */ @@ -3610,6 +6146,9 @@ export namespace google { /** PythonSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** PythonSettings experimentalFeatures. */ + public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + /** * Creates a new PythonSettings instance using the specified properties. * @param [properties] Properties to set @@ -3688,19 +6227,131 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a NodeSettings. */ - interface INodeSettings { + namespace PythonSettings { - /** NodeSettings common */ - common?: (google.api.ICommonLanguageSettings|null); - } + /** Properties of an ExperimentalFeatures. */ + interface IExperimentalFeatures { - /** Represents a NodeSettings. */ - class NodeSettings implements INodeSettings { + /** ExperimentalFeatures restAsyncIoEnabled */ + restAsyncIoEnabled?: (boolean|null); - /** - * Constructs a new NodeSettings. - * @param [properties] Properties to set + /** ExperimentalFeatures protobufPythonicTypesEnabled */ + protobufPythonicTypesEnabled?: (boolean|null); + + /** ExperimentalFeatures unversionedPackageDisabled */ + unversionedPackageDisabled?: (boolean|null); + } + + /** Represents an ExperimentalFeatures. */ + class ExperimentalFeatures implements IExperimentalFeatures { + + /** + * Constructs a new ExperimentalFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); + + /** ExperimentalFeatures restAsyncIoEnabled. */ + public restAsyncIoEnabled: boolean; + + /** ExperimentalFeatures protobufPythonicTypesEnabled. */ + public protobufPythonicTypesEnabled: boolean; + + /** ExperimentalFeatures unversionedPackageDisabled. */ + public unversionedPackageDisabled: boolean; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns ExperimentalFeatures instance + */ + public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Verifies an ExperimentalFeatures 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 an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExperimentalFeatures + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @param message ExperimentalFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExperimentalFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a NodeSettings. */ + interface INodeSettings { + + /** NodeSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + } + + /** Represents a NodeSettings. */ + class NodeSettings implements INodeSettings { + + /** + * Constructs a new NodeSettings. + * @param [properties] Properties to set */ constructor(properties?: google.api.INodeSettings); @@ -4014,6 +6665,9 @@ export namespace google { /** GoSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); } /** Represents a GoSettings. */ @@ -4028,6 +6682,9 @@ export namespace google { /** GoSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** GoSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + /** * Creates a new GoSettings instance using the specified properties. * @param [properties] Properties to set @@ -4352,6 +7009,109 @@ export namespace google { PACKAGE_MANAGER = 20 } + /** Properties of a SelectiveGapicGeneration. */ + interface ISelectiveGapicGeneration { + + /** SelectiveGapicGeneration methods */ + methods?: (string[]|null); + + /** SelectiveGapicGeneration generateOmittedAsInternal */ + generateOmittedAsInternal?: (boolean|null); + } + + /** Represents a SelectiveGapicGeneration. */ + class SelectiveGapicGeneration implements ISelectiveGapicGeneration { + + /** + * Constructs a new SelectiveGapicGeneration. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ISelectiveGapicGeneration); + + /** SelectiveGapicGeneration methods. */ + public methods: string[]; + + /** SelectiveGapicGeneration generateOmittedAsInternal. */ + public generateOmittedAsInternal: boolean; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectiveGapicGeneration instance + */ + public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Verifies a SelectiveGapicGeneration 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 SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectiveGapicGeneration + */ + public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @param message SelectiveGapicGeneration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** LaunchStage enum. */ enum LaunchStage { LAUNCH_STAGE_UNSPECIFIED = 0, @@ -4733,6 +7493,7 @@ export namespace google { /** Edition enum. */ enum Edition { EDITION_UNKNOWN = 0, + EDITION_LEGACY = 900, EDITION_PROTO2 = 998, EDITION_PROTO3 = 999, EDITION_2023 = 1000, @@ -4763,6 +7524,9 @@ export namespace google { /** FileDescriptorProto weakDependency */ weakDependency?: (number[]|null); + /** FileDescriptorProto optionDependency */ + optionDependency?: (string[]|null); + /** FileDescriptorProto messageType */ messageType?: (google.protobuf.IDescriptorProto[]|null); @@ -4812,6 +7576,9 @@ export namespace google { /** FileDescriptorProto weakDependency. */ public weakDependency: number[]; + /** FileDescriptorProto optionDependency. */ + public optionDependency: string[]; + /** FileDescriptorProto messageType. */ public messageType: google.protobuf.IDescriptorProto[]; @@ -4946,6 +7713,9 @@ export namespace google { /** DescriptorProto reservedName */ reservedName?: (string[]|null); + + /** DescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents a DescriptorProto. */ @@ -4987,6 +7757,9 @@ export namespace google { /** DescriptorProto reservedName. */ public reservedName: string[]; + /** DescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new DescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -5834,6 +8607,9 @@ export namespace google { /** EnumDescriptorProto reservedName */ reservedName?: (string[]|null); + + /** EnumDescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents an EnumDescriptorProto. */ @@ -5860,6 +8636,9 @@ export namespace google { /** EnumDescriptorProto reservedName. */ public reservedName: string[]; + /** EnumDescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -6794,6 +9573,9 @@ export namespace google { /** FieldOptions features */ features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); @@ -6849,6 +9631,9 @@ export namespace google { /** FieldOptions features. */ public features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -7069,6 +9854,121 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a FeatureSupport. */ + interface IFeatureSupport { + + /** FeatureSupport editionIntroduced */ + editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport editionDeprecated */ + editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport deprecationWarning */ + deprecationWarning?: (string|null); + + /** FeatureSupport editionRemoved */ + editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSupport. */ + class FeatureSupport implements IFeatureSupport { + + /** + * Constructs a new FeatureSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); + + /** FeatureSupport editionIntroduced. */ + public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport editionDeprecated. */ + public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport deprecationWarning. */ + public deprecationWarning: string; + + /** FeatureSupport editionRemoved. */ + public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSupport instance + */ + public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Verifies a FeatureSupport 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 FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSupport + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @param message FeatureSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of an OneofOptions. */ @@ -7307,6 +10207,9 @@ export namespace google { /** EnumValueOptions debugRedact */ debugRedact?: (boolean|null); + /** EnumValueOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); } @@ -7329,6 +10232,9 @@ export namespace google { /** EnumValueOptions debugRedact. */ public debugRedact: boolean; + /** EnumValueOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -7548,6 +10454,9 @@ export namespace google { /** MethodOptions .google.api.methodSignature */ ".google.api.methodSignature"?: (string[]|null); + + /** MethodOptions .google.longrunning.operationInfo */ + ".google.longrunning.operationInfo"?: (google.longrunning.IOperationInfo|null); } /** Represents a MethodOptions. */ @@ -7918,6 +10827,12 @@ export namespace google { /** FeatureSet jsonFormat */ jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); + + /** FeatureSet enforceNamingStyle */ + enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); + + /** FeatureSet defaultSymbolVisibility */ + defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); } /** Represents a FeatureSet. */ @@ -7947,6 +10862,12 @@ export namespace google { /** FeatureSet jsonFormat. */ public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); + /** FeatureSet enforceNamingStyle. */ + public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); + + /** FeatureSet defaultSymbolVisibility. */ + public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); + /** * Creates a new FeatureSet instance using the specified properties. * @param [properties] Properties to set @@ -8069,28 +10990,138 @@ export namespace google { ALLOW = 1, LEGACY_BEST_EFFORT = 2 } - } - /** Properties of a FeatureSetDefaults. */ - interface IFeatureSetDefaults { + /** EnforceNamingStyle enum. */ + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2 + } - /** FeatureSetDefaults defaults */ - defaults?: (google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault[]|null); + /** Properties of a VisibilityFeature. */ + interface IVisibilityFeature { + } - /** FeatureSetDefaults minimumEdition */ - minimumEdition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + /** Represents a VisibilityFeature. */ + class VisibilityFeature implements IVisibilityFeature { - /** FeatureSetDefaults maximumEdition */ - maximumEdition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - } + /** + * Constructs a new VisibilityFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); - /** Represents a FeatureSetDefaults. */ - class FeatureSetDefaults implements IFeatureSetDefaults { + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns VisibilityFeature instance + */ + public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; - /** - * Constructs a new FeatureSetDefaults. - * @param [properties] Properties to set - */ + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Verifies a VisibilityFeature 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 VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisibilityFeature + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @param message VisibilityFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisibilityFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisibilityFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VisibilityFeature { + + /** DefaultSymbolVisibility enum. */ + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + EXPORT_ALL = 1, + EXPORT_TOP_LEVEL = 2, + LOCAL_ALL = 3, + STRICT = 4 + } + } + } + + /** Properties of a FeatureSetDefaults. */ + interface IFeatureSetDefaults { + + /** FeatureSetDefaults defaults */ + defaults?: (google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault[]|null); + + /** FeatureSetDefaults minimumEdition */ + minimumEdition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSetDefaults maximumEdition */ + maximumEdition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSetDefaults. */ + class FeatureSetDefaults implements IFeatureSetDefaults { + + /** + * Constructs a new FeatureSetDefaults. + * @param [properties] Properties to set + */ constructor(properties?: google.protobuf.IFeatureSetDefaults); /** FeatureSetDefaults defaults. */ @@ -8188,8 +11219,11 @@ export namespace google { /** FeatureSetEditionDefault edition */ edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - /** FeatureSetEditionDefault features */ - features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures */ + overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures */ + fixedFeatures?: (google.protobuf.IFeatureSet|null); } /** Represents a FeatureSetEditionDefault. */ @@ -8204,8 +11238,11 @@ export namespace google { /** FeatureSetEditionDefault edition. */ public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - /** FeatureSetEditionDefault features. */ - public features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures. */ + public overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures. */ + public fixedFeatures?: (google.protobuf.IFeatureSet|null); /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -8738,6 +11775,13 @@ export namespace google { } } + /** SymbolVisibility enum. */ + enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2 + } + /** Properties of a Duration. */ interface IDuration { @@ -8943,5 +11987,1381 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of an Any. */ + interface IAny { + + /** Any type_url */ + type_url?: (string|null); + + /** Any value */ + value?: (Uint8Array|Buffer|string|null); + } + + /** Represents an Any. */ + class Any implements IAny { + + /** + * Constructs a new Any. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IAny); + + /** Any type_url. */ + public type_url: string; + + /** Any value. */ + public value: (Uint8Array|Buffer|string); + + /** + * Creates a new Any instance using the specified properties. + * @param [properties] Properties to set + * @returns Any instance + */ + public static create(properties?: google.protobuf.IAny): google.protobuf.Any; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Any message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Any + * @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.protobuf.Any; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Any + * @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.protobuf.Any; + + /** + * Verifies an Any 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 an Any message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Any + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Any; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @param message Any + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Any to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Any + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Empty. */ + interface IEmpty { + } + + /** Represents an Empty. */ + class Empty implements IEmpty { + + /** + * Constructs a new Empty. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEmpty); + + /** + * Creates a new Empty instance using the specified properties. + * @param [properties] Properties to set + * @returns Empty instance + */ + public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Empty + * @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.protobuf.Empty; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Empty + * @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.protobuf.Empty; + + /** + * Verifies an Empty 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 an Empty message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Empty + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @param message Empty + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Empty to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Empty + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); + } + + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { + + /** + * Constructs a new FieldMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldMask); + + /** FieldMask paths. */ + public paths: string[]; + + /** + * Creates a new FieldMask instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldMask instance + */ + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldMask + * @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.protobuf.FieldMask; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldMask + * @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.protobuf.FieldMask; + + /** + * Verifies a FieldMask 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 FieldMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldMask + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldMask + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace longrunning. */ + namespace longrunning { + + /** Represents an Operations */ + class Operations extends $protobuf.rpc.Service { + + /** + * Constructs a new Operations service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new Operations service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): Operations; + + /** + * Calls ListOperations. + * @param request ListOperationsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListOperationsResponse + */ + public listOperations(request: google.longrunning.IListOperationsRequest, callback: google.longrunning.Operations.ListOperationsCallback): void; + + /** + * Calls ListOperations. + * @param request ListOperationsRequest message or plain object + * @returns Promise + */ + public listOperations(request: google.longrunning.IListOperationsRequest): Promise; + + /** + * Calls GetOperation. + * @param request GetOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public getOperation(request: google.longrunning.IGetOperationRequest, callback: google.longrunning.Operations.GetOperationCallback): void; + + /** + * Calls GetOperation. + * @param request GetOperationRequest message or plain object + * @returns Promise + */ + public getOperation(request: google.longrunning.IGetOperationRequest): Promise; + + /** + * Calls DeleteOperation. + * @param request DeleteOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteOperation(request: google.longrunning.IDeleteOperationRequest, callback: google.longrunning.Operations.DeleteOperationCallback): void; + + /** + * Calls DeleteOperation. + * @param request DeleteOperationRequest message or plain object + * @returns Promise + */ + public deleteOperation(request: google.longrunning.IDeleteOperationRequest): Promise; + + /** + * Calls CancelOperation. + * @param request CancelOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public cancelOperation(request: google.longrunning.ICancelOperationRequest, callback: google.longrunning.Operations.CancelOperationCallback): void; + + /** + * Calls CancelOperation. + * @param request CancelOperationRequest message or plain object + * @returns Promise + */ + public cancelOperation(request: google.longrunning.ICancelOperationRequest): Promise; + + /** + * Calls WaitOperation. + * @param request WaitOperationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public waitOperation(request: google.longrunning.IWaitOperationRequest, callback: google.longrunning.Operations.WaitOperationCallback): void; + + /** + * Calls WaitOperation. + * @param request WaitOperationRequest message or plain object + * @returns Promise + */ + public waitOperation(request: google.longrunning.IWaitOperationRequest): Promise; + } + + namespace Operations { + + /** + * Callback as used by {@link google.longrunning.Operations|listOperations}. + * @param error Error, if any + * @param [response] ListOperationsResponse + */ + type ListOperationsCallback = (error: (Error|null), response?: google.longrunning.ListOperationsResponse) => void; + + /** + * Callback as used by {@link google.longrunning.Operations|getOperation}. + * @param error Error, if any + * @param [response] Operation + */ + type GetOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. + * @param error Error, if any + * @param [response] Empty + */ + type CancelOperationCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.longrunning.Operations|waitOperation}. + * @param error Error, if any + * @param [response] Operation + */ + type WaitOperationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of an Operation. */ + interface IOperation { + + /** Operation name */ + name?: (string|null); + + /** Operation metadata */ + metadata?: (google.protobuf.IAny|null); + + /** Operation done */ + done?: (boolean|null); + + /** Operation error */ + error?: (google.rpc.IStatus|null); + + /** Operation response */ + response?: (google.protobuf.IAny|null); + } + + /** Represents an Operation. */ + class Operation implements IOperation { + + /** + * Constructs a new Operation. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IOperation); + + /** Operation name. */ + public name: string; + + /** Operation metadata. */ + public metadata?: (google.protobuf.IAny|null); + + /** Operation done. */ + public done: boolean; + + /** Operation error. */ + public error?: (google.rpc.IStatus|null); + + /** Operation response. */ + public response?: (google.protobuf.IAny|null); + + /** Operation result. */ + public result?: ("error"|"response"); + + /** + * Creates a new Operation instance using the specified properties. + * @param [properties] Properties to set + * @returns Operation instance + */ + public static create(properties?: google.longrunning.IOperation): google.longrunning.Operation; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @param message Operation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @param message Operation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Operation + * @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.longrunning.Operation; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Operation + * @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.longrunning.Operation; + + /** + * Verifies an Operation 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 an Operation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Operation + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.Operation; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @param message Operation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.Operation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Operation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Operation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetOperationRequest. */ + interface IGetOperationRequest { + + /** GetOperationRequest name */ + name?: (string|null); + } + + /** Represents a GetOperationRequest. */ + class GetOperationRequest implements IGetOperationRequest { + + /** + * Constructs a new GetOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IGetOperationRequest); + + /** GetOperationRequest name. */ + public name: string; + + /** + * Creates a new GetOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetOperationRequest instance + */ + public static create(properties?: google.longrunning.IGetOperationRequest): google.longrunning.GetOperationRequest; + + /** + * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @param message GetOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IGetOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @param message GetOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IGetOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetOperationRequest + * @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.longrunning.GetOperationRequest; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetOperationRequest + * @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.longrunning.GetOperationRequest; + + /** + * Verifies a GetOperationRequest 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 GetOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.GetOperationRequest; + + /** + * Creates a plain object from a GetOperationRequest message. Also converts values to other types if specified. + * @param message GetOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.GetOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListOperationsRequest. */ + interface IListOperationsRequest { + + /** ListOperationsRequest name */ + name?: (string|null); + + /** ListOperationsRequest filter */ + filter?: (string|null); + + /** ListOperationsRequest pageSize */ + pageSize?: (number|null); + + /** ListOperationsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListOperationsRequest. */ + class ListOperationsRequest implements IListOperationsRequest { + + /** + * Constructs a new ListOperationsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IListOperationsRequest); + + /** ListOperationsRequest name. */ + public name: string; + + /** ListOperationsRequest filter. */ + public filter: string; + + /** ListOperationsRequest pageSize. */ + public pageSize: number; + + /** ListOperationsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListOperationsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListOperationsRequest instance + */ + public static create(properties?: google.longrunning.IListOperationsRequest): google.longrunning.ListOperationsRequest; + + /** + * Encodes the specified ListOperationsRequest message. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @param message ListOperationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IListOperationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListOperationsRequest message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @param message ListOperationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IListOperationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListOperationsRequest + * @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.longrunning.ListOperationsRequest; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListOperationsRequest + * @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.longrunning.ListOperationsRequest; + + /** + * Verifies a ListOperationsRequest 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 ListOperationsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListOperationsRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.ListOperationsRequest; + + /** + * Creates a plain object from a ListOperationsRequest message. Also converts values to other types if specified. + * @param message ListOperationsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.ListOperationsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListOperationsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListOperationsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListOperationsResponse. */ + interface IListOperationsResponse { + + /** ListOperationsResponse operations */ + operations?: (google.longrunning.IOperation[]|null); + + /** ListOperationsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListOperationsResponse. */ + class ListOperationsResponse implements IListOperationsResponse { + + /** + * Constructs a new ListOperationsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IListOperationsResponse); + + /** ListOperationsResponse operations. */ + public operations: google.longrunning.IOperation[]; + + /** ListOperationsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListOperationsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListOperationsResponse instance + */ + public static create(properties?: google.longrunning.IListOperationsResponse): google.longrunning.ListOperationsResponse; + + /** + * Encodes the specified ListOperationsResponse message. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @param message ListOperationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IListOperationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListOperationsResponse message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @param message ListOperationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IListOperationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListOperationsResponse + * @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.longrunning.ListOperationsResponse; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListOperationsResponse + * @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.longrunning.ListOperationsResponse; + + /** + * Verifies a ListOperationsResponse 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 ListOperationsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListOperationsResponse + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.ListOperationsResponse; + + /** + * Creates a plain object from a ListOperationsResponse message. Also converts values to other types if specified. + * @param message ListOperationsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.ListOperationsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListOperationsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListOperationsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CancelOperationRequest. */ + interface ICancelOperationRequest { + + /** CancelOperationRequest name */ + name?: (string|null); + } + + /** Represents a CancelOperationRequest. */ + class CancelOperationRequest implements ICancelOperationRequest { + + /** + * Constructs a new CancelOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.ICancelOperationRequest); + + /** CancelOperationRequest name. */ + public name: string; + + /** + * Creates a new CancelOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CancelOperationRequest instance + */ + public static create(properties?: google.longrunning.ICancelOperationRequest): google.longrunning.CancelOperationRequest; + + /** + * Encodes the specified CancelOperationRequest message. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @param message CancelOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.ICancelOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CancelOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @param message CancelOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.ICancelOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CancelOperationRequest + * @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.longrunning.CancelOperationRequest; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CancelOperationRequest + * @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.longrunning.CancelOperationRequest; + + /** + * Verifies a CancelOperationRequest 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 CancelOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CancelOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.CancelOperationRequest; + + /** + * Creates a plain object from a CancelOperationRequest message. Also converts values to other types if specified. + * @param message CancelOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.CancelOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CancelOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CancelOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteOperationRequest. */ + interface IDeleteOperationRequest { + + /** DeleteOperationRequest name */ + name?: (string|null); + } + + /** Represents a DeleteOperationRequest. */ + class DeleteOperationRequest implements IDeleteOperationRequest { + + /** + * Constructs a new DeleteOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IDeleteOperationRequest); + + /** DeleteOperationRequest name. */ + public name: string; + + /** + * Creates a new DeleteOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteOperationRequest instance + */ + public static create(properties?: google.longrunning.IDeleteOperationRequest): google.longrunning.DeleteOperationRequest; + + /** + * Encodes the specified DeleteOperationRequest message. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @param message DeleteOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IDeleteOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @param message DeleteOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IDeleteOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteOperationRequest + * @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.longrunning.DeleteOperationRequest; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteOperationRequest + * @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.longrunning.DeleteOperationRequest; + + /** + * Verifies a DeleteOperationRequest 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 DeleteOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.DeleteOperationRequest; + + /** + * Creates a plain object from a DeleteOperationRequest message. Also converts values to other types if specified. + * @param message DeleteOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.DeleteOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a WaitOperationRequest. */ + interface IWaitOperationRequest { + + /** WaitOperationRequest name */ + name?: (string|null); + + /** WaitOperationRequest timeout */ + timeout?: (google.protobuf.IDuration|null); + } + + /** Represents a WaitOperationRequest. */ + class WaitOperationRequest implements IWaitOperationRequest { + + /** + * Constructs a new WaitOperationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IWaitOperationRequest); + + /** WaitOperationRequest name. */ + public name: string; + + /** WaitOperationRequest timeout. */ + public timeout?: (google.protobuf.IDuration|null); + + /** + * Creates a new WaitOperationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WaitOperationRequest instance + */ + public static create(properties?: google.longrunning.IWaitOperationRequest): google.longrunning.WaitOperationRequest; + + /** + * Encodes the specified WaitOperationRequest message. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @param message WaitOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IWaitOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WaitOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @param message WaitOperationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IWaitOperationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WaitOperationRequest + * @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.longrunning.WaitOperationRequest; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WaitOperationRequest + * @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.longrunning.WaitOperationRequest; + + /** + * Verifies a WaitOperationRequest 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 WaitOperationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WaitOperationRequest + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.WaitOperationRequest; + + /** + * Creates a plain object from a WaitOperationRequest message. Also converts values to other types if specified. + * @param message WaitOperationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.WaitOperationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WaitOperationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WaitOperationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OperationInfo. */ + interface IOperationInfo { + + /** OperationInfo responseType */ + responseType?: (string|null); + + /** OperationInfo metadataType */ + metadataType?: (string|null); + } + + /** Represents an OperationInfo. */ + class OperationInfo implements IOperationInfo { + + /** + * Constructs a new OperationInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.longrunning.IOperationInfo); + + /** OperationInfo responseType. */ + public responseType: string; + + /** OperationInfo metadataType. */ + public metadataType: string; + + /** + * Creates a new OperationInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationInfo instance + */ + public static create(properties?: google.longrunning.IOperationInfo): google.longrunning.OperationInfo; + + /** + * Encodes the specified OperationInfo message. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @param message OperationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.longrunning.IOperationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationInfo message, length delimited. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @param message OperationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.longrunning.IOperationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationInfo + * @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.longrunning.OperationInfo; + + /** + * Decodes an OperationInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationInfo + * @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.longrunning.OperationInfo; + + /** + * Verifies an OperationInfo 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 an OperationInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationInfo + */ + public static fromObject(object: { [k: string]: any }): google.longrunning.OperationInfo; + + /** + * Creates a plain object from an OperationInfo message. Also converts values to other types if specified. + * @param message OperationInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.longrunning.OperationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace rpc. */ + namespace rpc { + + /** Properties of a Status. */ + interface IStatus { + + /** Status code */ + code?: (number|null); + + /** Status message */ + message?: (string|null); + + /** Status details */ + details?: (google.protobuf.IAny[]|null); + } + + /** Represents a Status. */ + class Status implements IStatus { + + /** + * Constructs a new Status. + * @param [properties] Properties to set + */ + constructor(properties?: google.rpc.IStatus); + + /** Status code. */ + public code: number; + + /** Status message. */ + public message: string; + + /** Status details. */ + public details: google.protobuf.IAny[]; + + /** + * Creates a new Status instance using the specified properties. + * @param [properties] Properties to set + * @returns Status instance + */ + public static create(properties?: google.rpc.IStatus): google.rpc.Status; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Status message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Status + * @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.rpc.Status; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Status + * @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.rpc.Status; + + /** + * Verifies a Status 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 Status message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Status + */ + public static fromObject(object: { [k: string]: any }): google.rpc.Status; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @param message Status + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.rpc.Status, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Status to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Status + * @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-cloud-workflows/protos/protos.js b/packages/google-cloud-workflows/protos/protos.js index bf1f2d4e19b2..52e407480802 100644 --- a/packages/google-cloud-workflows/protos/protos.js +++ b/packages/google-cloud-workflows/protos/protos.js @@ -28,7 +28,7 @@ var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace - var $root = $protobuf.roots._google_cloud_workflow_executions_protos || ($protobuf.roots._google_cloud_workflow_executions_protos = {}); + var $root = $protobuf.roots._google_cloud_workflows_protos || ($protobuf.roots._google_cloud_workflows_protos = {}); $root.google = (function() { @@ -6066,5022 +6066,6331 @@ return executions; })(); - return workflows; - })(); + workflows.v1 = (function() { - return cloud; - })(); + /** + * Namespace v1. + * @memberof google.cloud.workflows + * @namespace + */ + var v1 = {}; - google.api = (function() { + v1.Workflows = (function() { - /** - * Namespace api. - * @memberof google - * @namespace - */ - var api = {}; + /** + * Constructs a new Workflows service. + * @memberof google.cloud.workflows.v1 + * @classdesc Represents a Workflows + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Workflows(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } - api.Http = (function() { + (Workflows.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Workflows; - /** - * Properties of a Http. - * @memberof google.api - * @interface IHttp - * @property {Array.|null} [rules] Http rules - * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion - */ + /** + * Creates new Workflows service using the specified rpc implementation. + * @function create + * @memberof google.cloud.workflows.v1.Workflows + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Workflows} RPC service. Useful where requests and/or responses are streamed. + */ + Workflows.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; - /** - * Constructs a new Http. - * @memberof google.api - * @classdesc Represents a Http. - * @implements IHttp - * @constructor - * @param {google.api.IHttp=} [properties] Properties to set - */ - function Http(properties) { - this.rules = []; - 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]]; - } + /** + * Callback as used by {@link google.cloud.workflows.v1.Workflows|listWorkflows}. + * @memberof google.cloud.workflows.v1.Workflows + * @typedef ListWorkflowsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.workflows.v1.ListWorkflowsResponse} [response] ListWorkflowsResponse + */ - /** - * Http rules. - * @member {Array.} rules - * @memberof google.api.Http - * @instance - */ - Http.prototype.rules = $util.emptyArray; + /** + * Calls ListWorkflows. + * @function listWorkflows + * @memberof google.cloud.workflows.v1.Workflows + * @instance + * @param {google.cloud.workflows.v1.IListWorkflowsRequest} request ListWorkflowsRequest message or plain object + * @param {google.cloud.workflows.v1.Workflows.ListWorkflowsCallback} callback Node-style callback called with the error, if any, and ListWorkflowsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Workflows.prototype.listWorkflows = function listWorkflows(request, callback) { + return this.rpcCall(listWorkflows, $root.google.cloud.workflows.v1.ListWorkflowsRequest, $root.google.cloud.workflows.v1.ListWorkflowsResponse, request, callback); + }, "name", { value: "ListWorkflows" }); - /** - * Http fullyDecodeReservedExpansion. - * @member {boolean} fullyDecodeReservedExpansion - * @memberof google.api.Http - * @instance - */ - Http.prototype.fullyDecodeReservedExpansion = false; + /** + * Calls ListWorkflows. + * @function listWorkflows + * @memberof google.cloud.workflows.v1.Workflows + * @instance + * @param {google.cloud.workflows.v1.IListWorkflowsRequest} request ListWorkflowsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Creates a new Http instance using the specified properties. - * @function create - * @memberof google.api.Http - * @static - * @param {google.api.IHttp=} [properties] Properties to set - * @returns {google.api.Http} Http instance - */ - Http.create = function create(properties) { - return new Http(properties); - }; + /** + * Callback as used by {@link google.cloud.workflows.v1.Workflows|getWorkflow}. + * @memberof google.cloud.workflows.v1.Workflows + * @typedef GetWorkflowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.workflows.v1.Workflow} [response] Workflow + */ - /** - * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. - * @function encode - * @memberof google.api.Http - * @static - * @param {google.api.IHttp} message Http message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Http.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rules != null && message.rules.length) - for (var i = 0; i < message.rules.length; ++i) - $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); - return writer; - }; + /** + * Calls GetWorkflow. + * @function getWorkflow + * @memberof google.cloud.workflows.v1.Workflows + * @instance + * @param {google.cloud.workflows.v1.IGetWorkflowRequest} request GetWorkflowRequest message or plain object + * @param {google.cloud.workflows.v1.Workflows.GetWorkflowCallback} callback Node-style callback called with the error, if any, and Workflow + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Workflows.prototype.getWorkflow = function getWorkflow(request, callback) { + return this.rpcCall(getWorkflow, $root.google.cloud.workflows.v1.GetWorkflowRequest, $root.google.cloud.workflows.v1.Workflow, request, callback); + }, "name", { value: "GetWorkflow" }); - /** - * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.Http - * @static - * @param {google.api.IHttp} message Http message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Http.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Calls GetWorkflow. + * @function getWorkflow + * @memberof google.cloud.workflows.v1.Workflows + * @instance + * @param {google.cloud.workflows.v1.IGetWorkflowRequest} request GetWorkflowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Decodes a Http message from the specified reader or buffer. - * @function decode - * @memberof google.api.Http - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.Http} Http - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Http.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.rules && message.rules.length)) - message.rules = []; - message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); - break; - } - case 2: { - message.fullyDecodeReservedExpansion = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Callback as used by {@link google.cloud.workflows.v1.Workflows|createWorkflow}. + * @memberof google.cloud.workflows.v1.Workflows + * @typedef CreateWorkflowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ - /** - * Decodes a Http message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.Http - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.Http} Http - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Http.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Calls CreateWorkflow. + * @function createWorkflow + * @memberof google.cloud.workflows.v1.Workflows + * @instance + * @param {google.cloud.workflows.v1.ICreateWorkflowRequest} request CreateWorkflowRequest message or plain object + * @param {google.cloud.workflows.v1.Workflows.CreateWorkflowCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Workflows.prototype.createWorkflow = function createWorkflow(request, callback) { + return this.rpcCall(createWorkflow, $root.google.cloud.workflows.v1.CreateWorkflowRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateWorkflow" }); - /** - * Verifies a Http message. - * @function verify - * @memberof google.api.Http - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Http.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rules != null && message.hasOwnProperty("rules")) { - if (!Array.isArray(message.rules)) - return "rules: array expected"; - for (var i = 0; i < message.rules.length; ++i) { - var error = $root.google.api.HttpRule.verify(message.rules[i]); - if (error) - return "rules." + error; - } - } - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) - if (typeof message.fullyDecodeReservedExpansion !== "boolean") - return "fullyDecodeReservedExpansion: boolean expected"; - return null; - }; + /** + * Calls CreateWorkflow. + * @function createWorkflow + * @memberof google.cloud.workflows.v1.Workflows + * @instance + * @param {google.cloud.workflows.v1.ICreateWorkflowRequest} request CreateWorkflowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Creates a Http message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.Http - * @static - * @param {Object.} object Plain object - * @returns {google.api.Http} Http - */ - Http.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.Http) - return object; - var message = new $root.google.api.Http(); - if (object.rules) { - if (!Array.isArray(object.rules)) - throw TypeError(".google.api.Http.rules: array expected"); - message.rules = []; - for (var i = 0; i < object.rules.length; ++i) { - if (typeof object.rules[i] !== "object") - throw TypeError(".google.api.Http.rules: object expected"); - message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); - } - } - if (object.fullyDecodeReservedExpansion != null) - message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); - return message; - }; + /** + * Callback as used by {@link google.cloud.workflows.v1.Workflows|deleteWorkflow}. + * @memberof google.cloud.workflows.v1.Workflows + * @typedef DeleteWorkflowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ - /** - * Creates a plain object from a Http message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.Http - * @static - * @param {google.api.Http} message Http - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Http.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.rules = []; - if (options.defaults) - object.fullyDecodeReservedExpansion = false; - if (message.rules && message.rules.length) { - object.rules = []; - for (var j = 0; j < message.rules.length; ++j) - object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); - } - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) - object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; - return object; - }; + /** + * Calls DeleteWorkflow. + * @function deleteWorkflow + * @memberof google.cloud.workflows.v1.Workflows + * @instance + * @param {google.cloud.workflows.v1.IDeleteWorkflowRequest} request DeleteWorkflowRequest message or plain object + * @param {google.cloud.workflows.v1.Workflows.DeleteWorkflowCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Workflows.prototype.deleteWorkflow = function deleteWorkflow(request, callback) { + return this.rpcCall(deleteWorkflow, $root.google.cloud.workflows.v1.DeleteWorkflowRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteWorkflow" }); - /** - * Converts this Http to JSON. - * @function toJSON - * @memberof google.api.Http - * @instance - * @returns {Object.} JSON object - */ - Http.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Calls DeleteWorkflow. + * @function deleteWorkflow + * @memberof google.cloud.workflows.v1.Workflows + * @instance + * @param {google.cloud.workflows.v1.IDeleteWorkflowRequest} request DeleteWorkflowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Gets the default type url for Http - * @function getTypeUrl - * @memberof google.api.Http - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Http.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.Http"; - }; + /** + * Callback as used by {@link google.cloud.workflows.v1.Workflows|updateWorkflow}. + * @memberof google.cloud.workflows.v1.Workflows + * @typedef UpdateWorkflowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ - return Http; - })(); + /** + * Calls UpdateWorkflow. + * @function updateWorkflow + * @memberof google.cloud.workflows.v1.Workflows + * @instance + * @param {google.cloud.workflows.v1.IUpdateWorkflowRequest} request UpdateWorkflowRequest message or plain object + * @param {google.cloud.workflows.v1.Workflows.UpdateWorkflowCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Workflows.prototype.updateWorkflow = function updateWorkflow(request, callback) { + return this.rpcCall(updateWorkflow, $root.google.cloud.workflows.v1.UpdateWorkflowRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateWorkflow" }); - api.HttpRule = (function() { + /** + * Calls UpdateWorkflow. + * @function updateWorkflow + * @memberof google.cloud.workflows.v1.Workflows + * @instance + * @param {google.cloud.workflows.v1.IUpdateWorkflowRequest} request UpdateWorkflowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Properties of a HttpRule. - * @memberof google.api - * @interface IHttpRule - * @property {string|null} [selector] HttpRule selector - * @property {string|null} [get] HttpRule get - * @property {string|null} [put] HttpRule put - * @property {string|null} [post] HttpRule post - * @property {string|null} ["delete"] HttpRule delete - * @property {string|null} [patch] HttpRule patch - * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom - * @property {string|null} [body] HttpRule body - * @property {string|null} [responseBody] HttpRule responseBody - * @property {Array.|null} [additionalBindings] HttpRule additionalBindings - */ + /** + * Callback as used by {@link google.cloud.workflows.v1.Workflows|listWorkflowRevisions}. + * @memberof google.cloud.workflows.v1.Workflows + * @typedef ListWorkflowRevisionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.workflows.v1.ListWorkflowRevisionsResponse} [response] ListWorkflowRevisionsResponse + */ - /** - * Constructs a new HttpRule. - * @memberof google.api - * @classdesc Represents a HttpRule. - * @implements IHttpRule - * @constructor - * @param {google.api.IHttpRule=} [properties] Properties to set - */ - function HttpRule(properties) { - this.additionalBindings = []; - 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]]; - } + /** + * Calls ListWorkflowRevisions. + * @function listWorkflowRevisions + * @memberof google.cloud.workflows.v1.Workflows + * @instance + * @param {google.cloud.workflows.v1.IListWorkflowRevisionsRequest} request ListWorkflowRevisionsRequest message or plain object + * @param {google.cloud.workflows.v1.Workflows.ListWorkflowRevisionsCallback} callback Node-style callback called with the error, if any, and ListWorkflowRevisionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Workflows.prototype.listWorkflowRevisions = function listWorkflowRevisions(request, callback) { + return this.rpcCall(listWorkflowRevisions, $root.google.cloud.workflows.v1.ListWorkflowRevisionsRequest, $root.google.cloud.workflows.v1.ListWorkflowRevisionsResponse, request, callback); + }, "name", { value: "ListWorkflowRevisions" }); - /** - * HttpRule selector. - * @member {string} selector - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.selector = ""; + /** + * Calls ListWorkflowRevisions. + * @function listWorkflowRevisions + * @memberof google.cloud.workflows.v1.Workflows + * @instance + * @param {google.cloud.workflows.v1.IListWorkflowRevisionsRequest} request ListWorkflowRevisionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * HttpRule get. - * @member {string|null|undefined} get - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.get = null; + return Workflows; + })(); - /** - * HttpRule put. - * @member {string|null|undefined} put - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.put = null; + v1.Workflow = (function() { - /** - * HttpRule post. - * @member {string|null|undefined} post - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.post = null; + /** + * Properties of a Workflow. + * @memberof google.cloud.workflows.v1 + * @interface IWorkflow + * @property {string|null} [name] Workflow name + * @property {string|null} [description] Workflow description + * @property {google.cloud.workflows.v1.Workflow.State|null} [state] Workflow state + * @property {string|null} [revisionId] Workflow revisionId + * @property {google.protobuf.ITimestamp|null} [createTime] Workflow createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] Workflow updateTime + * @property {google.protobuf.ITimestamp|null} [revisionCreateTime] Workflow revisionCreateTime + * @property {Object.|null} [labels] Workflow labels + * @property {string|null} [serviceAccount] Workflow serviceAccount + * @property {string|null} [sourceContents] Workflow sourceContents + * @property {string|null} [cryptoKeyName] Workflow cryptoKeyName + * @property {google.cloud.workflows.v1.Workflow.IStateError|null} [stateError] Workflow stateError + * @property {google.cloud.workflows.v1.Workflow.CallLogLevel|null} [callLogLevel] Workflow callLogLevel + * @property {Object.|null} [userEnvVars] Workflow userEnvVars + * @property {google.cloud.workflows.v1.ExecutionHistoryLevel|null} [executionHistoryLevel] Workflow executionHistoryLevel + * @property {Array.|null} [allKmsKeys] Workflow allKmsKeys + * @property {Array.|null} [allKmsKeysVersions] Workflow allKmsKeysVersions + * @property {string|null} [cryptoKeyVersion] Workflow cryptoKeyVersion + * @property {Object.|null} [tags] Workflow tags + */ - /** - * HttpRule delete. - * @member {string|null|undefined} delete - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype["delete"] = null; + /** + * Constructs a new Workflow. + * @memberof google.cloud.workflows.v1 + * @classdesc Represents a Workflow. + * @implements IWorkflow + * @constructor + * @param {google.cloud.workflows.v1.IWorkflow=} [properties] Properties to set + */ + function Workflow(properties) { + this.labels = {}; + this.userEnvVars = {}; + this.allKmsKeys = []; + this.allKmsKeysVersions = []; + this.tags = {}; + 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]]; + } - /** - * HttpRule patch. - * @member {string|null|undefined} patch - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.patch = null; + /** + * Workflow name. + * @member {string} name + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.name = ""; - /** - * HttpRule custom. - * @member {google.api.ICustomHttpPattern|null|undefined} custom - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.custom = null; + /** + * Workflow description. + * @member {string} description + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.description = ""; - /** - * HttpRule body. - * @member {string} body - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.body = ""; + /** + * Workflow state. + * @member {google.cloud.workflows.v1.Workflow.State} state + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.state = 0; - /** - * HttpRule responseBody. - * @member {string} responseBody - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.responseBody = ""; + /** + * Workflow revisionId. + * @member {string} revisionId + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.revisionId = ""; - /** - * HttpRule additionalBindings. - * @member {Array.} additionalBindings - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.additionalBindings = $util.emptyArray; + /** + * Workflow createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.createTime = null; - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + /** + * Workflow updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.updateTime = null; - /** - * HttpRule pattern. - * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern - * @memberof google.api.HttpRule - * @instance - */ - Object.defineProperty(HttpRule.prototype, "pattern", { - get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), - set: $util.oneOfSetter($oneOfFields) - }); + /** + * Workflow revisionCreateTime. + * @member {google.protobuf.ITimestamp|null|undefined} revisionCreateTime + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.revisionCreateTime = null; - /** - * Creates a new HttpRule instance using the specified properties. - * @function create - * @memberof google.api.HttpRule - * @static - * @param {google.api.IHttpRule=} [properties] Properties to set - * @returns {google.api.HttpRule} HttpRule instance - */ - HttpRule.create = function create(properties) { - return new HttpRule(properties); - }; + /** + * Workflow labels. + * @member {Object.} labels + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.labels = $util.emptyObject; - /** - * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. - * @function encode - * @memberof google.api.HttpRule - * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HttpRule.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); - if (message.get != null && Object.hasOwnProperty.call(message, "get")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); - if (message.put != null && Object.hasOwnProperty.call(message, "put")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); - if (message.post != null && Object.hasOwnProperty.call(message, "post")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); - if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); - if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); - if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) - $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.additionalBindings != null && message.additionalBindings.length) - for (var i = 0; i < message.additionalBindings.length; ++i) - $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); - return writer; - }; + /** + * Workflow serviceAccount. + * @member {string} serviceAccount + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.serviceAccount = ""; - /** - * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.HttpRule - * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HttpRule.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Workflow sourceContents. + * @member {string|null|undefined} sourceContents + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.sourceContents = null; - /** - * Decodes a HttpRule message from the specified reader or buffer. - * @function decode - * @memberof google.api.HttpRule - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.HttpRule} HttpRule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HttpRule.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.selector = reader.string(); - break; - } - case 2: { - message.get = reader.string(); - break; + /** + * Workflow cryptoKeyName. + * @member {string} cryptoKeyName + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.cryptoKeyName = ""; + + /** + * Workflow stateError. + * @member {google.cloud.workflows.v1.Workflow.IStateError|null|undefined} stateError + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.stateError = null; + + /** + * Workflow callLogLevel. + * @member {google.cloud.workflows.v1.Workflow.CallLogLevel} callLogLevel + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.callLogLevel = 0; + + /** + * Workflow userEnvVars. + * @member {Object.} userEnvVars + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.userEnvVars = $util.emptyObject; + + /** + * Workflow executionHistoryLevel. + * @member {google.cloud.workflows.v1.ExecutionHistoryLevel} executionHistoryLevel + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.executionHistoryLevel = 0; + + /** + * Workflow allKmsKeys. + * @member {Array.} allKmsKeys + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.allKmsKeys = $util.emptyArray; + + /** + * Workflow allKmsKeysVersions. + * @member {Array.} allKmsKeysVersions + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.allKmsKeysVersions = $util.emptyArray; + + /** + * Workflow cryptoKeyVersion. + * @member {string} cryptoKeyVersion + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.cryptoKeyVersion = ""; + + /** + * Workflow tags. + * @member {Object.} tags + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Workflow.prototype.tags = $util.emptyObject; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Workflow sourceCode. + * @member {"sourceContents"|undefined} sourceCode + * @memberof google.cloud.workflows.v1.Workflow + * @instance + */ + Object.defineProperty(Workflow.prototype, "sourceCode", { + get: $util.oneOfGetter($oneOfFields = ["sourceContents"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Workflow instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1.Workflow + * @static + * @param {google.cloud.workflows.v1.IWorkflow=} [properties] Properties to set + * @returns {google.cloud.workflows.v1.Workflow} Workflow instance + */ + Workflow.create = function create(properties) { + return new Workflow(properties); + }; + + /** + * Encodes the specified Workflow message. Does not implicitly {@link google.cloud.workflows.v1.Workflow.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1.Workflow + * @static + * @param {google.cloud.workflows.v1.IWorkflow} message Workflow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Workflow.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); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.revisionId != null && Object.hasOwnProperty.call(message, "revisionId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.revisionId); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.revisionCreateTime != null && Object.hasOwnProperty.call(message, "revisionCreateTime")) + $root.google.protobuf.Timestamp.encode(message.revisionCreateTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.serviceAccount != null && Object.hasOwnProperty.call(message, "serviceAccount")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.serviceAccount); + if (message.sourceContents != null && Object.hasOwnProperty.call(message, "sourceContents")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.sourceContents); + if (message.cryptoKeyName != null && Object.hasOwnProperty.call(message, "cryptoKeyName")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.cryptoKeyName); + if (message.stateError != null && Object.hasOwnProperty.call(message, "stateError")) + $root.google.cloud.workflows.v1.Workflow.StateError.encode(message.stateError, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.callLogLevel != null && Object.hasOwnProperty.call(message, "callLogLevel")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.callLogLevel); + if (message.userEnvVars != null && Object.hasOwnProperty.call(message, "userEnvVars")) + for (var keys = Object.keys(message.userEnvVars), i = 0; i < keys.length; ++i) + writer.uint32(/* id 14, wireType 2 =*/114).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.userEnvVars[keys[i]]).ldelim(); + if (message.executionHistoryLevel != null && Object.hasOwnProperty.call(message, "executionHistoryLevel")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.executionHistoryLevel); + if (message.allKmsKeys != null && message.allKmsKeys.length) + for (var i = 0; i < message.allKmsKeys.length; ++i) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.allKmsKeys[i]); + if (message.allKmsKeysVersions != null && message.allKmsKeysVersions.length) + for (var i = 0; i < message.allKmsKeysVersions.length; ++i) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.allKmsKeysVersions[i]); + if (message.cryptoKeyVersion != null && Object.hasOwnProperty.call(message, "cryptoKeyVersion")) + writer.uint32(/* id 18, wireType 2 =*/146).string(message.cryptoKeyVersion); + if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) + for (var keys = Object.keys(message.tags), i = 0; i < keys.length; ++i) + writer.uint32(/* id 19, wireType 2 =*/154).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.tags[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified Workflow message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.Workflow.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1.Workflow + * @static + * @param {google.cloud.workflows.v1.IWorkflow} message Workflow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Workflow.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Workflow message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1.Workflow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1.Workflow} Workflow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Workflow.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1.Workflow(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.state = reader.int32(); + break; + } + case 4: { + message.revisionId = reader.string(); + break; + } + case 5: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.revisionCreateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + case 9: { + message.serviceAccount = reader.string(); + break; + } + case 10: { + message.sourceContents = reader.string(); + break; + } + case 11: { + message.cryptoKeyName = reader.string(); + break; + } + case 12: { + message.stateError = $root.google.cloud.workflows.v1.Workflow.StateError.decode(reader, reader.uint32()); + break; + } + case 13: { + message.callLogLevel = reader.int32(); + break; + } + case 14: { + if (message.userEnvVars === $util.emptyObject) + message.userEnvVars = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.userEnvVars[key] = value; + break; + } + case 15: { + message.executionHistoryLevel = reader.int32(); + break; + } + case 16: { + if (!(message.allKmsKeys && message.allKmsKeys.length)) + message.allKmsKeys = []; + message.allKmsKeys.push(reader.string()); + break; + } + case 17: { + if (!(message.allKmsKeysVersions && message.allKmsKeysVersions.length)) + message.allKmsKeysVersions = []; + message.allKmsKeysVersions.push(reader.string()); + break; + } + case 18: { + message.cryptoKeyVersion = reader.string(); + break; + } + case 19: { + if (message.tags === $util.emptyObject) + message.tags = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.tags[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } } - case 3: { - message.put = reader.string(); - break; + return message; + }; + + /** + * Decodes a Workflow message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1.Workflow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1.Workflow} Workflow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Workflow.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Workflow message. + * @function verify + * @memberof google.cloud.workflows.v1.Workflow + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Workflow.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.revisionId != null && message.hasOwnProperty("revisionId")) + if (!$util.isString(message.revisionId)) + return "revisionId: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; } - case 4: { - message.post = reader.string(); - break; + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; } - case 5: { - message["delete"] = reader.string(); - break; + if (message.revisionCreateTime != null && message.hasOwnProperty("revisionCreateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.revisionCreateTime); + if (error) + return "revisionCreateTime." + error; } - case 6: { - message.patch = reader.string(); - break; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; } - case 8: { - message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); - break; + if (message.serviceAccount != null && message.hasOwnProperty("serviceAccount")) + if (!$util.isString(message.serviceAccount)) + return "serviceAccount: string expected"; + if (message.sourceContents != null && message.hasOwnProperty("sourceContents")) { + properties.sourceCode = 1; + if (!$util.isString(message.sourceContents)) + return "sourceContents: string expected"; } - case 7: { - message.body = reader.string(); + if (message.cryptoKeyName != null && message.hasOwnProperty("cryptoKeyName")) + if (!$util.isString(message.cryptoKeyName)) + return "cryptoKeyName: string expected"; + if (message.stateError != null && message.hasOwnProperty("stateError")) { + var error = $root.google.cloud.workflows.v1.Workflow.StateError.verify(message.stateError); + if (error) + return "stateError." + error; + } + if (message.callLogLevel != null && message.hasOwnProperty("callLogLevel")) + switch (message.callLogLevel) { + default: + return "callLogLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.userEnvVars != null && message.hasOwnProperty("userEnvVars")) { + if (!$util.isObject(message.userEnvVars)) + return "userEnvVars: object expected"; + var key = Object.keys(message.userEnvVars); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.userEnvVars[key[i]])) + return "userEnvVars: string{k:string} expected"; + } + if (message.executionHistoryLevel != null && message.hasOwnProperty("executionHistoryLevel")) + switch (message.executionHistoryLevel) { + default: + return "executionHistoryLevel: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.allKmsKeys != null && message.hasOwnProperty("allKmsKeys")) { + if (!Array.isArray(message.allKmsKeys)) + return "allKmsKeys: array expected"; + for (var i = 0; i < message.allKmsKeys.length; ++i) + if (!$util.isString(message.allKmsKeys[i])) + return "allKmsKeys: string[] expected"; + } + if (message.allKmsKeysVersions != null && message.hasOwnProperty("allKmsKeysVersions")) { + if (!Array.isArray(message.allKmsKeysVersions)) + return "allKmsKeysVersions: array expected"; + for (var i = 0; i < message.allKmsKeysVersions.length; ++i) + if (!$util.isString(message.allKmsKeysVersions[i])) + return "allKmsKeysVersions: string[] expected"; + } + if (message.cryptoKeyVersion != null && message.hasOwnProperty("cryptoKeyVersion")) + if (!$util.isString(message.cryptoKeyVersion)) + return "cryptoKeyVersion: string expected"; + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!$util.isObject(message.tags)) + return "tags: object expected"; + var key = Object.keys(message.tags); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.tags[key[i]])) + return "tags: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a Workflow message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1.Workflow + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1.Workflow} Workflow + */ + Workflow.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1.Workflow) + return object; + var message = new $root.google.cloud.workflows.v1.Workflow(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ACTIVE": + case 1: + message.state = 1; + break; + case "UNAVAILABLE": + case 2: + message.state = 2; break; } - case 12: { - message.responseBody = reader.string(); + if (object.revisionId != null) + message.revisionId = String(object.revisionId); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.workflows.v1.Workflow.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.workflows.v1.Workflow.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.revisionCreateTime != null) { + if (typeof object.revisionCreateTime !== "object") + throw TypeError(".google.cloud.workflows.v1.Workflow.revisionCreateTime: object expected"); + message.revisionCreateTime = $root.google.protobuf.Timestamp.fromObject(object.revisionCreateTime); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.workflows.v1.Workflow.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.serviceAccount != null) + message.serviceAccount = String(object.serviceAccount); + if (object.sourceContents != null) + message.sourceContents = String(object.sourceContents); + if (object.cryptoKeyName != null) + message.cryptoKeyName = String(object.cryptoKeyName); + if (object.stateError != null) { + if (typeof object.stateError !== "object") + throw TypeError(".google.cloud.workflows.v1.Workflow.stateError: object expected"); + message.stateError = $root.google.cloud.workflows.v1.Workflow.StateError.fromObject(object.stateError); + } + switch (object.callLogLevel) { + default: + if (typeof object.callLogLevel === "number") { + message.callLogLevel = object.callLogLevel; + break; + } + break; + case "CALL_LOG_LEVEL_UNSPECIFIED": + case 0: + message.callLogLevel = 0; + break; + case "LOG_ALL_CALLS": + case 1: + message.callLogLevel = 1; + break; + case "LOG_ERRORS_ONLY": + case 2: + message.callLogLevel = 2; + break; + case "LOG_NONE": + case 3: + message.callLogLevel = 3; break; } - case 11: { - if (!(message.additionalBindings && message.additionalBindings.length)) - message.additionalBindings = []; - message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + if (object.userEnvVars) { + if (typeof object.userEnvVars !== "object") + throw TypeError(".google.cloud.workflows.v1.Workflow.userEnvVars: object expected"); + message.userEnvVars = {}; + for (var keys = Object.keys(object.userEnvVars), i = 0; i < keys.length; ++i) + message.userEnvVars[keys[i]] = String(object.userEnvVars[keys[i]]); + } + switch (object.executionHistoryLevel) { + default: + if (typeof object.executionHistoryLevel === "number") { + message.executionHistoryLevel = object.executionHistoryLevel; + break; + } + break; + case "EXECUTION_HISTORY_LEVEL_UNSPECIFIED": + case 0: + message.executionHistoryLevel = 0; + break; + case "EXECUTION_HISTORY_BASIC": + case 1: + message.executionHistoryLevel = 1; + break; + case "EXECUTION_HISTORY_DETAILED": + case 2: + message.executionHistoryLevel = 2; break; } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + if (object.allKmsKeys) { + if (!Array.isArray(object.allKmsKeys)) + throw TypeError(".google.cloud.workflows.v1.Workflow.allKmsKeys: array expected"); + message.allKmsKeys = []; + for (var i = 0; i < object.allKmsKeys.length; ++i) + message.allKmsKeys[i] = String(object.allKmsKeys[i]); + } + if (object.allKmsKeysVersions) { + if (!Array.isArray(object.allKmsKeysVersions)) + throw TypeError(".google.cloud.workflows.v1.Workflow.allKmsKeysVersions: array expected"); + message.allKmsKeysVersions = []; + for (var i = 0; i < object.allKmsKeysVersions.length; ++i) + message.allKmsKeysVersions[i] = String(object.allKmsKeysVersions[i]); + } + if (object.cryptoKeyVersion != null) + message.cryptoKeyVersion = String(object.cryptoKeyVersion); + if (object.tags) { + if (typeof object.tags !== "object") + throw TypeError(".google.cloud.workflows.v1.Workflow.tags: object expected"); + message.tags = {}; + for (var keys = Object.keys(object.tags), i = 0; i < keys.length; ++i) + message.tags[keys[i]] = String(object.tags[keys[i]]); + } + return message; + }; - /** - * Decodes a HttpRule message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.HttpRule - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.HttpRule} HttpRule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HttpRule.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates a plain object from a Workflow message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1.Workflow + * @static + * @param {google.cloud.workflows.v1.Workflow} message Workflow + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Workflow.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.allKmsKeys = []; + object.allKmsKeysVersions = []; + } + if (options.objects || options.defaults) { + object.labels = {}; + object.userEnvVars = {}; + object.tags = {}; + } + if (options.defaults) { + object.name = ""; + object.description = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.revisionId = ""; + object.createTime = null; + object.updateTime = null; + object.revisionCreateTime = null; + object.serviceAccount = ""; + object.cryptoKeyName = ""; + object.stateError = null; + object.callLogLevel = options.enums === String ? "CALL_LOG_LEVEL_UNSPECIFIED" : 0; + object.executionHistoryLevel = options.enums === String ? "EXECUTION_HISTORY_LEVEL_UNSPECIFIED" : 0; + object.cryptoKeyVersion = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.workflows.v1.Workflow.State[message.state] === undefined ? message.state : $root.google.cloud.workflows.v1.Workflow.State[message.state] : message.state; + if (message.revisionId != null && message.hasOwnProperty("revisionId")) + object.revisionId = message.revisionId; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.revisionCreateTime != null && message.hasOwnProperty("revisionCreateTime")) + object.revisionCreateTime = $root.google.protobuf.Timestamp.toObject(message.revisionCreateTime, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.serviceAccount != null && message.hasOwnProperty("serviceAccount")) + object.serviceAccount = message.serviceAccount; + if (message.sourceContents != null && message.hasOwnProperty("sourceContents")) { + object.sourceContents = message.sourceContents; + if (options.oneofs) + object.sourceCode = "sourceContents"; + } + if (message.cryptoKeyName != null && message.hasOwnProperty("cryptoKeyName")) + object.cryptoKeyName = message.cryptoKeyName; + if (message.stateError != null && message.hasOwnProperty("stateError")) + object.stateError = $root.google.cloud.workflows.v1.Workflow.StateError.toObject(message.stateError, options); + if (message.callLogLevel != null && message.hasOwnProperty("callLogLevel")) + object.callLogLevel = options.enums === String ? $root.google.cloud.workflows.v1.Workflow.CallLogLevel[message.callLogLevel] === undefined ? message.callLogLevel : $root.google.cloud.workflows.v1.Workflow.CallLogLevel[message.callLogLevel] : message.callLogLevel; + if (message.userEnvVars && (keys2 = Object.keys(message.userEnvVars)).length) { + object.userEnvVars = {}; + for (var j = 0; j < keys2.length; ++j) + object.userEnvVars[keys2[j]] = message.userEnvVars[keys2[j]]; + } + if (message.executionHistoryLevel != null && message.hasOwnProperty("executionHistoryLevel")) + object.executionHistoryLevel = options.enums === String ? $root.google.cloud.workflows.v1.ExecutionHistoryLevel[message.executionHistoryLevel] === undefined ? message.executionHistoryLevel : $root.google.cloud.workflows.v1.ExecutionHistoryLevel[message.executionHistoryLevel] : message.executionHistoryLevel; + if (message.allKmsKeys && message.allKmsKeys.length) { + object.allKmsKeys = []; + for (var j = 0; j < message.allKmsKeys.length; ++j) + object.allKmsKeys[j] = message.allKmsKeys[j]; + } + if (message.allKmsKeysVersions && message.allKmsKeysVersions.length) { + object.allKmsKeysVersions = []; + for (var j = 0; j < message.allKmsKeysVersions.length; ++j) + object.allKmsKeysVersions[j] = message.allKmsKeysVersions[j]; + } + if (message.cryptoKeyVersion != null && message.hasOwnProperty("cryptoKeyVersion")) + object.cryptoKeyVersion = message.cryptoKeyVersion; + if (message.tags && (keys2 = Object.keys(message.tags)).length) { + object.tags = {}; + for (var j = 0; j < keys2.length; ++j) + object.tags[keys2[j]] = message.tags[keys2[j]]; + } + return object; + }; - /** - * Verifies a HttpRule message. - * @function verify - * @memberof google.api.HttpRule - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - HttpRule.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.selector != null && message.hasOwnProperty("selector")) - if (!$util.isString(message.selector)) - return "selector: string expected"; - if (message.get != null && message.hasOwnProperty("get")) { - properties.pattern = 1; - if (!$util.isString(message.get)) - return "get: string expected"; - } - if (message.put != null && message.hasOwnProperty("put")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.put)) - return "put: string expected"; - } - if (message.post != null && message.hasOwnProperty("post")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.post)) - return "post: string expected"; - } - if (message["delete"] != null && message.hasOwnProperty("delete")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message["delete"])) - return "delete: string expected"; - } - if (message.patch != null && message.hasOwnProperty("patch")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.patch)) - return "patch: string expected"; - } - if (message.custom != null && message.hasOwnProperty("custom")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - { - var error = $root.google.api.CustomHttpPattern.verify(message.custom); - if (error) - return "custom." + error; - } - } - if (message.body != null && message.hasOwnProperty("body")) - if (!$util.isString(message.body)) - return "body: string expected"; - if (message.responseBody != null && message.hasOwnProperty("responseBody")) - if (!$util.isString(message.responseBody)) - return "responseBody: string expected"; - if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { - if (!Array.isArray(message.additionalBindings)) - return "additionalBindings: array expected"; - for (var i = 0; i < message.additionalBindings.length; ++i) { - var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); - if (error) - return "additionalBindings." + error; - } - } - return null; - }; - - /** - * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.HttpRule - * @static - * @param {Object.} object Plain object - * @returns {google.api.HttpRule} HttpRule - */ - HttpRule.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.HttpRule) - return object; - var message = new $root.google.api.HttpRule(); - if (object.selector != null) - message.selector = String(object.selector); - if (object.get != null) - message.get = String(object.get); - if (object.put != null) - message.put = String(object.put); - if (object.post != null) - message.post = String(object.post); - if (object["delete"] != null) - message["delete"] = String(object["delete"]); - if (object.patch != null) - message.patch = String(object.patch); - if (object.custom != null) { - if (typeof object.custom !== "object") - throw TypeError(".google.api.HttpRule.custom: object expected"); - message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); - } - if (object.body != null) - message.body = String(object.body); - if (object.responseBody != null) - message.responseBody = String(object.responseBody); - if (object.additionalBindings) { - if (!Array.isArray(object.additionalBindings)) - throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); - message.additionalBindings = []; - for (var i = 0; i < object.additionalBindings.length; ++i) { - if (typeof object.additionalBindings[i] !== "object") - throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); - message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); - } - } - return message; - }; + /** + * Converts this Workflow to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1.Workflow + * @instance + * @returns {Object.} JSON object + */ + Workflow.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a plain object from a HttpRule message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.HttpRule - * @static - * @param {google.api.HttpRule} message HttpRule - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - HttpRule.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.additionalBindings = []; - if (options.defaults) { - object.selector = ""; - object.body = ""; - object.responseBody = ""; - } - if (message.selector != null && message.hasOwnProperty("selector")) - object.selector = message.selector; - if (message.get != null && message.hasOwnProperty("get")) { - object.get = message.get; - if (options.oneofs) - object.pattern = "get"; - } - if (message.put != null && message.hasOwnProperty("put")) { - object.put = message.put; - if (options.oneofs) - object.pattern = "put"; - } - if (message.post != null && message.hasOwnProperty("post")) { - object.post = message.post; - if (options.oneofs) - object.pattern = "post"; - } - if (message["delete"] != null && message.hasOwnProperty("delete")) { - object["delete"] = message["delete"]; - if (options.oneofs) - object.pattern = "delete"; - } - if (message.patch != null && message.hasOwnProperty("patch")) { - object.patch = message.patch; - if (options.oneofs) - object.pattern = "patch"; - } - if (message.body != null && message.hasOwnProperty("body")) - object.body = message.body; - if (message.custom != null && message.hasOwnProperty("custom")) { - object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); - if (options.oneofs) - object.pattern = "custom"; - } - if (message.additionalBindings && message.additionalBindings.length) { - object.additionalBindings = []; - for (var j = 0; j < message.additionalBindings.length; ++j) - object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); - } - if (message.responseBody != null && message.hasOwnProperty("responseBody")) - object.responseBody = message.responseBody; - return object; - }; + /** + * Gets the default type url for Workflow + * @function getTypeUrl + * @memberof google.cloud.workflows.v1.Workflow + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Workflow.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1.Workflow"; + }; - /** - * Converts this HttpRule to JSON. - * @function toJSON - * @memberof google.api.HttpRule - * @instance - * @returns {Object.} JSON object - */ - HttpRule.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * State enum. + * @name google.cloud.workflows.v1.Workflow.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ACTIVE=1 ACTIVE value + * @property {number} UNAVAILABLE=2 UNAVAILABLE value + */ + Workflow.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACTIVE"] = 1; + values[valuesById[2] = "UNAVAILABLE"] = 2; + return values; + })(); - /** - * Gets the default type url for HttpRule - * @function getTypeUrl - * @memberof google.api.HttpRule - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - HttpRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.HttpRule"; - }; + Workflow.StateError = (function() { - return HttpRule; - })(); + /** + * Properties of a StateError. + * @memberof google.cloud.workflows.v1.Workflow + * @interface IStateError + * @property {string|null} [details] StateError details + * @property {google.cloud.workflows.v1.Workflow.StateError.Type|null} [type] StateError type + */ - api.CustomHttpPattern = (function() { + /** + * Constructs a new StateError. + * @memberof google.cloud.workflows.v1.Workflow + * @classdesc Represents a StateError. + * @implements IStateError + * @constructor + * @param {google.cloud.workflows.v1.Workflow.IStateError=} [properties] Properties to set + */ + function StateError(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]]; + } - /** - * Properties of a CustomHttpPattern. - * @memberof google.api - * @interface ICustomHttpPattern - * @property {string|null} [kind] CustomHttpPattern kind - * @property {string|null} [path] CustomHttpPattern path - */ + /** + * StateError details. + * @member {string} details + * @memberof google.cloud.workflows.v1.Workflow.StateError + * @instance + */ + StateError.prototype.details = ""; - /** - * Constructs a new CustomHttpPattern. - * @memberof google.api - * @classdesc Represents a CustomHttpPattern. - * @implements ICustomHttpPattern - * @constructor - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set - */ - function CustomHttpPattern(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]]; - } + /** + * StateError type. + * @member {google.cloud.workflows.v1.Workflow.StateError.Type} type + * @memberof google.cloud.workflows.v1.Workflow.StateError + * @instance + */ + StateError.prototype.type = 0; - /** - * CustomHttpPattern kind. - * @member {string} kind - * @memberof google.api.CustomHttpPattern - * @instance - */ - CustomHttpPattern.prototype.kind = ""; + /** + * Creates a new StateError instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1.Workflow.StateError + * @static + * @param {google.cloud.workflows.v1.Workflow.IStateError=} [properties] Properties to set + * @returns {google.cloud.workflows.v1.Workflow.StateError} StateError instance + */ + StateError.create = function create(properties) { + return new StateError(properties); + }; - /** - * CustomHttpPattern path. - * @member {string} path - * @memberof google.api.CustomHttpPattern - * @instance - */ - CustomHttpPattern.prototype.path = ""; + /** + * Encodes the specified StateError message. Does not implicitly {@link google.cloud.workflows.v1.Workflow.StateError.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1.Workflow.StateError + * @static + * @param {google.cloud.workflows.v1.Workflow.IStateError} message StateError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StateError.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.details != null && Object.hasOwnProperty.call(message, "details")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.details); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + return writer; + }; - /** - * Creates a new CustomHttpPattern instance using the specified properties. - * @function create - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set - * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance - */ - CustomHttpPattern.create = function create(properties) { - return new CustomHttpPattern(properties); - }; + /** + * Encodes the specified StateError message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.Workflow.StateError.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1.Workflow.StateError + * @static + * @param {google.cloud.workflows.v1.Workflow.IStateError} message StateError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StateError.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. - * @function encode - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomHttpPattern.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); - return writer; - }; + /** + * Decodes a StateError message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1.Workflow.StateError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1.Workflow.StateError} StateError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StateError.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1.Workflow.StateError(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.details = reader.string(); + break; + } + case 2: { + message.type = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Decodes a StateError message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1.Workflow.StateError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1.Workflow.StateError} StateError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StateError.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Decodes a CustomHttpPattern message from the specified reader or buffer. - * @function decode - * @memberof google.api.CustomHttpPattern - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.CustomHttpPattern} CustomHttpPattern - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CustomHttpPattern.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.path = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Verifies a StateError message. + * @function verify + * @memberof google.cloud.workflows.v1.Workflow.StateError + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StateError.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.details != null && message.hasOwnProperty("details")) + if (!$util.isString(message.details)) + return "details: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; - /** - * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.CustomHttpPattern - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.CustomHttpPattern} CustomHttpPattern - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates a StateError message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1.Workflow.StateError + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1.Workflow.StateError} StateError + */ + StateError.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1.Workflow.StateError) + return object; + var message = new $root.google.cloud.workflows.v1.Workflow.StateError(); + if (object.details != null) + message.details = String(object.details); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "KMS_ERROR": + case 1: + message.type = 1; + break; + } + return message; + }; - /** - * Verifies a CustomHttpPattern message. - * @function verify - * @memberof google.api.CustomHttpPattern - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CustomHttpPattern.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!$util.isString(message.path)) - return "path: string expected"; - return null; - }; + /** + * Creates a plain object from a StateError message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1.Workflow.StateError + * @static + * @param {google.cloud.workflows.v1.Workflow.StateError} message StateError + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StateError.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.details = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + } + if (message.details != null && message.hasOwnProperty("details")) + object.details = message.details; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.workflows.v1.Workflow.StateError.Type[message.type] === undefined ? message.type : $root.google.cloud.workflows.v1.Workflow.StateError.Type[message.type] : message.type; + return object; + }; - /** - * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.CustomHttpPattern - * @static - * @param {Object.} object Plain object - * @returns {google.api.CustomHttpPattern} CustomHttpPattern - */ - CustomHttpPattern.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.CustomHttpPattern) - return object; - var message = new $root.google.api.CustomHttpPattern(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.path != null) - message.path = String(object.path); - return message; - }; + /** + * Converts this StateError to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1.Workflow.StateError + * @instance + * @returns {Object.} JSON object + */ + StateError.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.CustomHttpPattern} message CustomHttpPattern - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CustomHttpPattern.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.path = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.path != null && message.hasOwnProperty("path")) - object.path = message.path; - return object; - }; + /** + * Gets the default type url for StateError + * @function getTypeUrl + * @memberof google.cloud.workflows.v1.Workflow.StateError + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StateError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1.Workflow.StateError"; + }; - /** - * Converts this CustomHttpPattern to JSON. - * @function toJSON - * @memberof google.api.CustomHttpPattern - * @instance - * @returns {Object.} JSON object - */ - CustomHttpPattern.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Type enum. + * @name google.cloud.workflows.v1.Workflow.StateError.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} KMS_ERROR=1 KMS_ERROR value + */ + StateError.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "KMS_ERROR"] = 1; + return values; + })(); - /** - * Gets the default type url for CustomHttpPattern - * @function getTypeUrl - * @memberof google.api.CustomHttpPattern - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CustomHttpPattern.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.CustomHttpPattern"; - }; + return StateError; + })(); - return CustomHttpPattern; - })(); + /** + * CallLogLevel enum. + * @name google.cloud.workflows.v1.Workflow.CallLogLevel + * @enum {number} + * @property {number} CALL_LOG_LEVEL_UNSPECIFIED=0 CALL_LOG_LEVEL_UNSPECIFIED value + * @property {number} LOG_ALL_CALLS=1 LOG_ALL_CALLS value + * @property {number} LOG_ERRORS_ONLY=2 LOG_ERRORS_ONLY value + * @property {number} LOG_NONE=3 LOG_NONE value + */ + Workflow.CallLogLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CALL_LOG_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "LOG_ALL_CALLS"] = 1; + values[valuesById[2] = "LOG_ERRORS_ONLY"] = 2; + values[valuesById[3] = "LOG_NONE"] = 3; + return values; + })(); - api.CommonLanguageSettings = (function() { + return Workflow; + })(); - /** - * Properties of a CommonLanguageSettings. - * @memberof google.api - * @interface ICommonLanguageSettings - * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri - * @property {Array.|null} [destinations] CommonLanguageSettings destinations - */ + v1.ListWorkflowsRequest = (function() { - /** - * Constructs a new CommonLanguageSettings. - * @memberof google.api - * @classdesc Represents a CommonLanguageSettings. - * @implements ICommonLanguageSettings - * @constructor - * @param {google.api.ICommonLanguageSettings=} [properties] Properties to set - */ - function CommonLanguageSettings(properties) { - this.destinations = []; - 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]]; - } + /** + * Properties of a ListWorkflowsRequest. + * @memberof google.cloud.workflows.v1 + * @interface IListWorkflowsRequest + * @property {string|null} [parent] ListWorkflowsRequest parent + * @property {number|null} [pageSize] ListWorkflowsRequest pageSize + * @property {string|null} [pageToken] ListWorkflowsRequest pageToken + * @property {string|null} [filter] ListWorkflowsRequest filter + * @property {string|null} [orderBy] ListWorkflowsRequest orderBy + */ - /** - * CommonLanguageSettings referenceDocsUri. - * @member {string} referenceDocsUri - * @memberof google.api.CommonLanguageSettings - * @instance - */ - CommonLanguageSettings.prototype.referenceDocsUri = ""; + /** + * Constructs a new ListWorkflowsRequest. + * @memberof google.cloud.workflows.v1 + * @classdesc Represents a ListWorkflowsRequest. + * @implements IListWorkflowsRequest + * @constructor + * @param {google.cloud.workflows.v1.IListWorkflowsRequest=} [properties] Properties to set + */ + function ListWorkflowsRequest(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]]; + } - /** - * CommonLanguageSettings destinations. - * @member {Array.} destinations - * @memberof google.api.CommonLanguageSettings - * @instance - */ - CommonLanguageSettings.prototype.destinations = $util.emptyArray; + /** + * ListWorkflowsRequest parent. + * @member {string} parent + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @instance + */ + ListWorkflowsRequest.prototype.parent = ""; - /** - * Creates a new CommonLanguageSettings instance using the specified properties. - * @function create - * @memberof google.api.CommonLanguageSettings - * @static - * @param {google.api.ICommonLanguageSettings=} [properties] Properties to set - * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings instance - */ - CommonLanguageSettings.create = function create(properties) { - return new CommonLanguageSettings(properties); - }; + /** + * ListWorkflowsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @instance + */ + ListWorkflowsRequest.prototype.pageSize = 0; - /** - * Encodes the specified CommonLanguageSettings message. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. - * @function encode - * @memberof google.api.CommonLanguageSettings - * @static - * @param {google.api.ICommonLanguageSettings} message CommonLanguageSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommonLanguageSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.referenceDocsUri != null && Object.hasOwnProperty.call(message, "referenceDocsUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.referenceDocsUri); - if (message.destinations != null && message.destinations.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.destinations.length; ++i) - writer.int32(message.destinations[i]); - writer.ldelim(); - } - return writer; - }; + /** + * ListWorkflowsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @instance + */ + ListWorkflowsRequest.prototype.pageToken = ""; - /** - * Encodes the specified CommonLanguageSettings message, length delimited. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.CommonLanguageSettings - * @static - * @param {google.api.ICommonLanguageSettings} message CommonLanguageSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommonLanguageSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * ListWorkflowsRequest filter. + * @member {string} filter + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @instance + */ + ListWorkflowsRequest.prototype.filter = ""; - /** - * Decodes a CommonLanguageSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.CommonLanguageSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommonLanguageSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CommonLanguageSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.referenceDocsUri = reader.string(); - break; + /** + * ListWorkflowsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @instance + */ + ListWorkflowsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListWorkflowsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @static + * @param {google.cloud.workflows.v1.IListWorkflowsRequest=} [properties] Properties to set + * @returns {google.cloud.workflows.v1.ListWorkflowsRequest} ListWorkflowsRequest instance + */ + ListWorkflowsRequest.create = function create(properties) { + return new ListWorkflowsRequest(properties); + }; + + /** + * Encodes the specified ListWorkflowsRequest message. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @static + * @param {google.cloud.workflows.v1.IListWorkflowsRequest} message ListWorkflowsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWorkflowsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListWorkflowsRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @static + * @param {google.cloud.workflows.v1.IListWorkflowsRequest} message ListWorkflowsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWorkflowsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListWorkflowsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1.ListWorkflowsRequest} ListWorkflowsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWorkflowsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1.ListWorkflowsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } } - case 2: { - if (!(message.destinations && message.destinations.length)) - message.destinations = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.destinations.push(reader.int32()); - } else - message.destinations.push(reader.int32()); - break; + return message; + }; + + /** + * Decodes a ListWorkflowsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1.ListWorkflowsRequest} ListWorkflowsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWorkflowsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListWorkflowsRequest message. + * @function verify + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListWorkflowsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListWorkflowsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1.ListWorkflowsRequest} ListWorkflowsRequest + */ + ListWorkflowsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1.ListWorkflowsRequest) + return object; + var message = new $root.google.cloud.workflows.v1.ListWorkflowsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListWorkflowsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @static + * @param {google.cloud.workflows.v1.ListWorkflowsRequest} message ListWorkflowsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListWorkflowsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; - /** - * Decodes a CommonLanguageSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.CommonLanguageSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommonLanguageSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Converts this ListWorkflowsRequest to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @instance + * @returns {Object.} JSON object + */ + ListWorkflowsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Verifies a CommonLanguageSettings message. - * @function verify - * @memberof google.api.CommonLanguageSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CommonLanguageSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) - if (!$util.isString(message.referenceDocsUri)) - return "referenceDocsUri: string expected"; - if (message.destinations != null && message.hasOwnProperty("destinations")) { - if (!Array.isArray(message.destinations)) - return "destinations: array expected"; - for (var i = 0; i < message.destinations.length; ++i) - switch (message.destinations[i]) { - default: - return "destinations: enum value[] expected"; - case 0: - case 10: - case 20: - break; + /** + * Gets the default type url for ListWorkflowsRequest + * @function getTypeUrl + * @memberof google.cloud.workflows.v1.ListWorkflowsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListWorkflowsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } - } - return null; - }; + return typeUrlPrefix + "/google.cloud.workflows.v1.ListWorkflowsRequest"; + }; - /** - * Creates a CommonLanguageSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.CommonLanguageSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings - */ - CommonLanguageSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.CommonLanguageSettings) - return object; - var message = new $root.google.api.CommonLanguageSettings(); - if (object.referenceDocsUri != null) - message.referenceDocsUri = String(object.referenceDocsUri); - if (object.destinations) { - if (!Array.isArray(object.destinations)) - throw TypeError(".google.api.CommonLanguageSettings.destinations: array expected"); - message.destinations = []; - for (var i = 0; i < object.destinations.length; ++i) - switch (object.destinations[i]) { - default: - if (typeof object.destinations[i] === "number") { - message.destinations[i] = object.destinations[i]; + return ListWorkflowsRequest; + })(); + + v1.ListWorkflowsResponse = (function() { + + /** + * Properties of a ListWorkflowsResponse. + * @memberof google.cloud.workflows.v1 + * @interface IListWorkflowsResponse + * @property {Array.|null} [workflows] ListWorkflowsResponse workflows + * @property {string|null} [nextPageToken] ListWorkflowsResponse nextPageToken + * @property {Array.|null} [unreachable] ListWorkflowsResponse unreachable + */ + + /** + * Constructs a new ListWorkflowsResponse. + * @memberof google.cloud.workflows.v1 + * @classdesc Represents a ListWorkflowsResponse. + * @implements IListWorkflowsResponse + * @constructor + * @param {google.cloud.workflows.v1.IListWorkflowsResponse=} [properties] Properties to set + */ + function ListWorkflowsResponse(properties) { + this.workflows = []; + this.unreachable = []; + 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]]; + } + + /** + * ListWorkflowsResponse workflows. + * @member {Array.} workflows + * @memberof google.cloud.workflows.v1.ListWorkflowsResponse + * @instance + */ + ListWorkflowsResponse.prototype.workflows = $util.emptyArray; + + /** + * ListWorkflowsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.workflows.v1.ListWorkflowsResponse + * @instance + */ + ListWorkflowsResponse.prototype.nextPageToken = ""; + + /** + * ListWorkflowsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.workflows.v1.ListWorkflowsResponse + * @instance + */ + ListWorkflowsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListWorkflowsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1.ListWorkflowsResponse + * @static + * @param {google.cloud.workflows.v1.IListWorkflowsResponse=} [properties] Properties to set + * @returns {google.cloud.workflows.v1.ListWorkflowsResponse} ListWorkflowsResponse instance + */ + ListWorkflowsResponse.create = function create(properties) { + return new ListWorkflowsResponse(properties); + }; + + /** + * Encodes the specified ListWorkflowsResponse message. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1.ListWorkflowsResponse + * @static + * @param {google.cloud.workflows.v1.IListWorkflowsResponse} message ListWorkflowsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWorkflowsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.workflows != null && message.workflows.length) + for (var i = 0; i < message.workflows.length; ++i) + $root.google.cloud.workflows.v1.Workflow.encode(message.workflows[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListWorkflowsResponse message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1.ListWorkflowsResponse + * @static + * @param {google.cloud.workflows.v1.IListWorkflowsResponse} message ListWorkflowsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWorkflowsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListWorkflowsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1.ListWorkflowsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1.ListWorkflowsResponse} ListWorkflowsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWorkflowsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1.ListWorkflowsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.workflows && message.workflows.length)) + message.workflows = []; + message.workflows.push($root.google.cloud.workflows.v1.Workflow.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); break; } - case "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": - case 0: - message.destinations[i] = 0; - break; - case "GITHUB": - case 10: - message.destinations[i] = 10; - break; - case "PACKAGE_MANAGER": - case 20: - message.destinations[i] = 20; - break; } - } - return message; - }; + return message; + }; - /** - * Creates a plain object from a CommonLanguageSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.CommonLanguageSettings - * @static - * @param {google.api.CommonLanguageSettings} message CommonLanguageSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CommonLanguageSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.destinations = []; - if (options.defaults) - object.referenceDocsUri = ""; - if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) - object.referenceDocsUri = message.referenceDocsUri; - if (message.destinations && message.destinations.length) { - object.destinations = []; - for (var j = 0; j < message.destinations.length; ++j) - object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; - } - return object; - }; + /** + * Decodes a ListWorkflowsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1.ListWorkflowsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1.ListWorkflowsResponse} ListWorkflowsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWorkflowsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Converts this CommonLanguageSettings to JSON. - * @function toJSON - * @memberof google.api.CommonLanguageSettings - * @instance - * @returns {Object.} JSON object - */ - CommonLanguageSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Verifies a ListWorkflowsResponse message. + * @function verify + * @memberof google.cloud.workflows.v1.ListWorkflowsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListWorkflowsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.workflows != null && message.hasOwnProperty("workflows")) { + if (!Array.isArray(message.workflows)) + return "workflows: array expected"; + for (var i = 0; i < message.workflows.length; ++i) { + var error = $root.google.cloud.workflows.v1.Workflow.verify(message.workflows[i]); + if (error) + return "workflows." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; - /** - * Gets the default type url for CommonLanguageSettings - * @function getTypeUrl - * @memberof google.api.CommonLanguageSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CommonLanguageSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.CommonLanguageSettings"; - }; + /** + * Creates a ListWorkflowsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1.ListWorkflowsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1.ListWorkflowsResponse} ListWorkflowsResponse + */ + ListWorkflowsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1.ListWorkflowsResponse) + return object; + var message = new $root.google.cloud.workflows.v1.ListWorkflowsResponse(); + if (object.workflows) { + if (!Array.isArray(object.workflows)) + throw TypeError(".google.cloud.workflows.v1.ListWorkflowsResponse.workflows: array expected"); + message.workflows = []; + for (var i = 0; i < object.workflows.length; ++i) { + if (typeof object.workflows[i] !== "object") + throw TypeError(".google.cloud.workflows.v1.ListWorkflowsResponse.workflows: object expected"); + message.workflows[i] = $root.google.cloud.workflows.v1.Workflow.fromObject(object.workflows[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.workflows.v1.ListWorkflowsResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; - return CommonLanguageSettings; - })(); + /** + * Creates a plain object from a ListWorkflowsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1.ListWorkflowsResponse + * @static + * @param {google.cloud.workflows.v1.ListWorkflowsResponse} message ListWorkflowsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListWorkflowsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.workflows = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.workflows && message.workflows.length) { + object.workflows = []; + for (var j = 0; j < message.workflows.length; ++j) + object.workflows[j] = $root.google.cloud.workflows.v1.Workflow.toObject(message.workflows[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; - api.ClientLibrarySettings = (function() { + /** + * Converts this ListWorkflowsResponse to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1.ListWorkflowsResponse + * @instance + * @returns {Object.} JSON object + */ + ListWorkflowsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Properties of a ClientLibrarySettings. - * @memberof google.api - * @interface IClientLibrarySettings - * @property {string|null} [version] ClientLibrarySettings version - * @property {google.api.LaunchStage|null} [launchStage] ClientLibrarySettings launchStage - * @property {boolean|null} [restNumericEnums] ClientLibrarySettings restNumericEnums - * @property {google.api.IJavaSettings|null} [javaSettings] ClientLibrarySettings javaSettings - * @property {google.api.ICppSettings|null} [cppSettings] ClientLibrarySettings cppSettings - * @property {google.api.IPhpSettings|null} [phpSettings] ClientLibrarySettings phpSettings - * @property {google.api.IPythonSettings|null} [pythonSettings] ClientLibrarySettings pythonSettings - * @property {google.api.INodeSettings|null} [nodeSettings] ClientLibrarySettings nodeSettings - * @property {google.api.IDotnetSettings|null} [dotnetSettings] ClientLibrarySettings dotnetSettings - * @property {google.api.IRubySettings|null} [rubySettings] ClientLibrarySettings rubySettings - * @property {google.api.IGoSettings|null} [goSettings] ClientLibrarySettings goSettings - */ + /** + * Gets the default type url for ListWorkflowsResponse + * @function getTypeUrl + * @memberof google.cloud.workflows.v1.ListWorkflowsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListWorkflowsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1.ListWorkflowsResponse"; + }; - /** - * Constructs a new ClientLibrarySettings. - * @memberof google.api - * @classdesc Represents a ClientLibrarySettings. - * @implements IClientLibrarySettings - * @constructor - * @param {google.api.IClientLibrarySettings=} [properties] Properties to set - */ - function ClientLibrarySettings(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]]; - } + return ListWorkflowsResponse; + })(); - /** - * ClientLibrarySettings version. - * @member {string} version - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.version = ""; + v1.GetWorkflowRequest = (function() { - /** - * ClientLibrarySettings launchStage. - * @member {google.api.LaunchStage} launchStage - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.launchStage = 0; + /** + * Properties of a GetWorkflowRequest. + * @memberof google.cloud.workflows.v1 + * @interface IGetWorkflowRequest + * @property {string|null} [name] GetWorkflowRequest name + * @property {string|null} [revisionId] GetWorkflowRequest revisionId + */ - /** - * ClientLibrarySettings restNumericEnums. - * @member {boolean} restNumericEnums - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.restNumericEnums = false; + /** + * Constructs a new GetWorkflowRequest. + * @memberof google.cloud.workflows.v1 + * @classdesc Represents a GetWorkflowRequest. + * @implements IGetWorkflowRequest + * @constructor + * @param {google.cloud.workflows.v1.IGetWorkflowRequest=} [properties] Properties to set + */ + function GetWorkflowRequest(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]]; + } - /** - * ClientLibrarySettings javaSettings. - * @member {google.api.IJavaSettings|null|undefined} javaSettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.javaSettings = null; + /** + * GetWorkflowRequest name. + * @member {string} name + * @memberof google.cloud.workflows.v1.GetWorkflowRequest + * @instance + */ + GetWorkflowRequest.prototype.name = ""; - /** - * ClientLibrarySettings cppSettings. - * @member {google.api.ICppSettings|null|undefined} cppSettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.cppSettings = null; + /** + * GetWorkflowRequest revisionId. + * @member {string} revisionId + * @memberof google.cloud.workflows.v1.GetWorkflowRequest + * @instance + */ + GetWorkflowRequest.prototype.revisionId = ""; - /** - * ClientLibrarySettings phpSettings. - * @member {google.api.IPhpSettings|null|undefined} phpSettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.phpSettings = null; + /** + * Creates a new GetWorkflowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1.GetWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.IGetWorkflowRequest=} [properties] Properties to set + * @returns {google.cloud.workflows.v1.GetWorkflowRequest} GetWorkflowRequest instance + */ + GetWorkflowRequest.create = function create(properties) { + return new GetWorkflowRequest(properties); + }; - /** - * ClientLibrarySettings pythonSettings. - * @member {google.api.IPythonSettings|null|undefined} pythonSettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.pythonSettings = null; + /** + * Encodes the specified GetWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1.GetWorkflowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1.GetWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.IGetWorkflowRequest} message GetWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetWorkflowRequest.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); + if (message.revisionId != null && Object.hasOwnProperty.call(message, "revisionId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.revisionId); + return writer; + }; - /** - * ClientLibrarySettings nodeSettings. - * @member {google.api.INodeSettings|null|undefined} nodeSettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.nodeSettings = null; + /** + * Encodes the specified GetWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.GetWorkflowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1.GetWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.IGetWorkflowRequest} message GetWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetWorkflowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * ClientLibrarySettings dotnetSettings. - * @member {google.api.IDotnetSettings|null|undefined} dotnetSettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.dotnetSettings = null; + /** + * Decodes a GetWorkflowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1.GetWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1.GetWorkflowRequest} GetWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetWorkflowRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1.GetWorkflowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.revisionId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * ClientLibrarySettings rubySettings. - * @member {google.api.IRubySettings|null|undefined} rubySettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.rubySettings = null; + /** + * Decodes a GetWorkflowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1.GetWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1.GetWorkflowRequest} GetWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetWorkflowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * ClientLibrarySettings goSettings. - * @member {google.api.IGoSettings|null|undefined} goSettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.goSettings = null; + /** + * Verifies a GetWorkflowRequest message. + * @function verify + * @memberof google.cloud.workflows.v1.GetWorkflowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetWorkflowRequest.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"; + if (message.revisionId != null && message.hasOwnProperty("revisionId")) + if (!$util.isString(message.revisionId)) + return "revisionId: string expected"; + return null; + }; - /** - * Creates a new ClientLibrarySettings instance using the specified properties. - * @function create - * @memberof google.api.ClientLibrarySettings - * @static - * @param {google.api.IClientLibrarySettings=} [properties] Properties to set - * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings instance - */ - ClientLibrarySettings.create = function create(properties) { - return new ClientLibrarySettings(properties); - }; + /** + * Creates a GetWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1.GetWorkflowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1.GetWorkflowRequest} GetWorkflowRequest + */ + GetWorkflowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1.GetWorkflowRequest) + return object; + var message = new $root.google.cloud.workflows.v1.GetWorkflowRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.revisionId != null) + message.revisionId = String(object.revisionId); + return message; + }; - /** - * Encodes the specified ClientLibrarySettings message. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. - * @function encode - * @memberof google.api.ClientLibrarySettings - * @static - * @param {google.api.IClientLibrarySettings} message ClientLibrarySettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientLibrarySettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); - if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.launchStage); - if (message.restNumericEnums != null && Object.hasOwnProperty.call(message, "restNumericEnums")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.restNumericEnums); - if (message.javaSettings != null && Object.hasOwnProperty.call(message, "javaSettings")) - $root.google.api.JavaSettings.encode(message.javaSettings, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.cppSettings != null && Object.hasOwnProperty.call(message, "cppSettings")) - $root.google.api.CppSettings.encode(message.cppSettings, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); - if (message.phpSettings != null && Object.hasOwnProperty.call(message, "phpSettings")) - $root.google.api.PhpSettings.encode(message.phpSettings, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); - if (message.pythonSettings != null && Object.hasOwnProperty.call(message, "pythonSettings")) - $root.google.api.PythonSettings.encode(message.pythonSettings, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); - if (message.nodeSettings != null && Object.hasOwnProperty.call(message, "nodeSettings")) - $root.google.api.NodeSettings.encode(message.nodeSettings, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); - if (message.dotnetSettings != null && Object.hasOwnProperty.call(message, "dotnetSettings")) - $root.google.api.DotnetSettings.encode(message.dotnetSettings, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); - if (message.rubySettings != null && Object.hasOwnProperty.call(message, "rubySettings")) - $root.google.api.RubySettings.encode(message.rubySettings, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); - if (message.goSettings != null && Object.hasOwnProperty.call(message, "goSettings")) - $root.google.api.GoSettings.encode(message.goSettings, writer.uint32(/* id 28, wireType 2 =*/226).fork()).ldelim(); - return writer; - }; + /** + * Creates a plain object from a GetWorkflowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1.GetWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.GetWorkflowRequest} message GetWorkflowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetWorkflowRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.revisionId = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.revisionId != null && message.hasOwnProperty("revisionId")) + object.revisionId = message.revisionId; + return object; + }; - /** - * Encodes the specified ClientLibrarySettings message, length delimited. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.ClientLibrarySettings - * @static - * @param {google.api.IClientLibrarySettings} message ClientLibrarySettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientLibrarySettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Converts this GetWorkflowRequest to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1.GetWorkflowRequest + * @instance + * @returns {Object.} JSON object + */ + GetWorkflowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Decodes a ClientLibrarySettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.ClientLibrarySettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientLibrarySettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ClientLibrarySettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.version = reader.string(); - break; - } - case 2: { - message.launchStage = reader.int32(); - break; - } - case 3: { - message.restNumericEnums = reader.bool(); - break; - } - case 21: { - message.javaSettings = $root.google.api.JavaSettings.decode(reader, reader.uint32()); - break; - } - case 22: { - message.cppSettings = $root.google.api.CppSettings.decode(reader, reader.uint32()); - break; - } - case 23: { - message.phpSettings = $root.google.api.PhpSettings.decode(reader, reader.uint32()); - break; + /** + * Gets the default type url for GetWorkflowRequest + * @function getTypeUrl + * @memberof google.cloud.workflows.v1.GetWorkflowRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetWorkflowRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } - case 24: { - message.pythonSettings = $root.google.api.PythonSettings.decode(reader, reader.uint32()); - break; + return typeUrlPrefix + "/google.cloud.workflows.v1.GetWorkflowRequest"; + }; + + return GetWorkflowRequest; + })(); + + v1.CreateWorkflowRequest = (function() { + + /** + * Properties of a CreateWorkflowRequest. + * @memberof google.cloud.workflows.v1 + * @interface ICreateWorkflowRequest + * @property {string|null} [parent] CreateWorkflowRequest parent + * @property {google.cloud.workflows.v1.IWorkflow|null} [workflow] CreateWorkflowRequest workflow + * @property {string|null} [workflowId] CreateWorkflowRequest workflowId + */ + + /** + * Constructs a new CreateWorkflowRequest. + * @memberof google.cloud.workflows.v1 + * @classdesc Represents a CreateWorkflowRequest. + * @implements ICreateWorkflowRequest + * @constructor + * @param {google.cloud.workflows.v1.ICreateWorkflowRequest=} [properties] Properties to set + */ + function CreateWorkflowRequest(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]]; + } + + /** + * CreateWorkflowRequest parent. + * @member {string} parent + * @memberof google.cloud.workflows.v1.CreateWorkflowRequest + * @instance + */ + CreateWorkflowRequest.prototype.parent = ""; + + /** + * CreateWorkflowRequest workflow. + * @member {google.cloud.workflows.v1.IWorkflow|null|undefined} workflow + * @memberof google.cloud.workflows.v1.CreateWorkflowRequest + * @instance + */ + CreateWorkflowRequest.prototype.workflow = null; + + /** + * CreateWorkflowRequest workflowId. + * @member {string} workflowId + * @memberof google.cloud.workflows.v1.CreateWorkflowRequest + * @instance + */ + CreateWorkflowRequest.prototype.workflowId = ""; + + /** + * Creates a new CreateWorkflowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1.CreateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.ICreateWorkflowRequest=} [properties] Properties to set + * @returns {google.cloud.workflows.v1.CreateWorkflowRequest} CreateWorkflowRequest instance + */ + CreateWorkflowRequest.create = function create(properties) { + return new CreateWorkflowRequest(properties); + }; + + /** + * Encodes the specified CreateWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1.CreateWorkflowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1.CreateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.ICreateWorkflowRequest} message CreateWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateWorkflowRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.workflow != null && Object.hasOwnProperty.call(message, "workflow")) + $root.google.cloud.workflows.v1.Workflow.encode(message.workflow, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.workflowId != null && Object.hasOwnProperty.call(message, "workflowId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.workflowId); + return writer; + }; + + /** + * Encodes the specified CreateWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.CreateWorkflowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1.CreateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.ICreateWorkflowRequest} message CreateWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateWorkflowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateWorkflowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1.CreateWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1.CreateWorkflowRequest} CreateWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateWorkflowRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1.CreateWorkflowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.workflow = $root.google.cloud.workflows.v1.Workflow.decode(reader, reader.uint32()); + break; + } + case 3: { + message.workflowId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } } - case 25: { - message.nodeSettings = $root.google.api.NodeSettings.decode(reader, reader.uint32()); - break; + return message; + }; + + /** + * Decodes a CreateWorkflowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1.CreateWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1.CreateWorkflowRequest} CreateWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateWorkflowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateWorkflowRequest message. + * @function verify + * @memberof google.cloud.workflows.v1.CreateWorkflowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateWorkflowRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.workflow != null && message.hasOwnProperty("workflow")) { + var error = $root.google.cloud.workflows.v1.Workflow.verify(message.workflow); + if (error) + return "workflow." + error; } - case 26: { - message.dotnetSettings = $root.google.api.DotnetSettings.decode(reader, reader.uint32()); - break; + if (message.workflowId != null && message.hasOwnProperty("workflowId")) + if (!$util.isString(message.workflowId)) + return "workflowId: string expected"; + return null; + }; + + /** + * Creates a CreateWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1.CreateWorkflowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1.CreateWorkflowRequest} CreateWorkflowRequest + */ + CreateWorkflowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1.CreateWorkflowRequest) + return object; + var message = new $root.google.cloud.workflows.v1.CreateWorkflowRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.workflow != null) { + if (typeof object.workflow !== "object") + throw TypeError(".google.cloud.workflows.v1.CreateWorkflowRequest.workflow: object expected"); + message.workflow = $root.google.cloud.workflows.v1.Workflow.fromObject(object.workflow); } - case 27: { - message.rubySettings = $root.google.api.RubySettings.decode(reader, reader.uint32()); - break; + if (object.workflowId != null) + message.workflowId = String(object.workflowId); + return message; + }; + + /** + * Creates a plain object from a CreateWorkflowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1.CreateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.CreateWorkflowRequest} message CreateWorkflowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateWorkflowRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.workflow = null; + object.workflowId = ""; } - case 28: { - message.goSettings = $root.google.api.GoSettings.decode(reader, reader.uint32()); - break; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.workflow != null && message.hasOwnProperty("workflow")) + object.workflow = $root.google.cloud.workflows.v1.Workflow.toObject(message.workflow, options); + if (message.workflowId != null && message.hasOwnProperty("workflowId")) + object.workflowId = message.workflowId; + return object; + }; + + /** + * Converts this CreateWorkflowRequest to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1.CreateWorkflowRequest + * @instance + * @returns {Object.} JSON object + */ + CreateWorkflowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateWorkflowRequest + * @function getTypeUrl + * @memberof google.cloud.workflows.v1.CreateWorkflowRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateWorkflowRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + return typeUrlPrefix + "/google.cloud.workflows.v1.CreateWorkflowRequest"; + }; - /** - * Decodes a ClientLibrarySettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.ClientLibrarySettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientLibrarySettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return CreateWorkflowRequest; + })(); - /** - * Verifies a ClientLibrarySettings message. - * @function verify - * @memberof google.api.ClientLibrarySettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ClientLibrarySettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isString(message.version)) - return "version: string expected"; - if (message.launchStage != null && message.hasOwnProperty("launchStage")) - switch (message.launchStage) { - default: - return "launchStage: enum value expected"; - case 0: - case 6: - case 7: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.restNumericEnums != null && message.hasOwnProperty("restNumericEnums")) - if (typeof message.restNumericEnums !== "boolean") - return "restNumericEnums: boolean expected"; - if (message.javaSettings != null && message.hasOwnProperty("javaSettings")) { - var error = $root.google.api.JavaSettings.verify(message.javaSettings); - if (error) - return "javaSettings." + error; - } - if (message.cppSettings != null && message.hasOwnProperty("cppSettings")) { - var error = $root.google.api.CppSettings.verify(message.cppSettings); - if (error) - return "cppSettings." + error; - } - if (message.phpSettings != null && message.hasOwnProperty("phpSettings")) { - var error = $root.google.api.PhpSettings.verify(message.phpSettings); - if (error) - return "phpSettings." + error; - } - if (message.pythonSettings != null && message.hasOwnProperty("pythonSettings")) { - var error = $root.google.api.PythonSettings.verify(message.pythonSettings); - if (error) - return "pythonSettings." + error; - } - if (message.nodeSettings != null && message.hasOwnProperty("nodeSettings")) { - var error = $root.google.api.NodeSettings.verify(message.nodeSettings); - if (error) - return "nodeSettings." + error; - } - if (message.dotnetSettings != null && message.hasOwnProperty("dotnetSettings")) { - var error = $root.google.api.DotnetSettings.verify(message.dotnetSettings); - if (error) - return "dotnetSettings." + error; - } - if (message.rubySettings != null && message.hasOwnProperty("rubySettings")) { - var error = $root.google.api.RubySettings.verify(message.rubySettings); - if (error) - return "rubySettings." + error; - } - if (message.goSettings != null && message.hasOwnProperty("goSettings")) { - var error = $root.google.api.GoSettings.verify(message.goSettings); - if (error) - return "goSettings." + error; - } - return null; - }; + v1.DeleteWorkflowRequest = (function() { - /** - * Creates a ClientLibrarySettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.ClientLibrarySettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings - */ - ClientLibrarySettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.ClientLibrarySettings) - return object; - var message = new $root.google.api.ClientLibrarySettings(); - if (object.version != null) - message.version = String(object.version); - switch (object.launchStage) { - default: - if (typeof object.launchStage === "number") { - message.launchStage = object.launchStage; - break; + /** + * Properties of a DeleteWorkflowRequest. + * @memberof google.cloud.workflows.v1 + * @interface IDeleteWorkflowRequest + * @property {string|null} [name] DeleteWorkflowRequest name + */ + + /** + * Constructs a new DeleteWorkflowRequest. + * @memberof google.cloud.workflows.v1 + * @classdesc Represents a DeleteWorkflowRequest. + * @implements IDeleteWorkflowRequest + * @constructor + * @param {google.cloud.workflows.v1.IDeleteWorkflowRequest=} [properties] Properties to set + */ + function DeleteWorkflowRequest(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]]; } - break; - case "LAUNCH_STAGE_UNSPECIFIED": - case 0: - message.launchStage = 0; - break; - case "UNIMPLEMENTED": - case 6: - message.launchStage = 6; - break; - case "PRELAUNCH": - case 7: - message.launchStage = 7; - break; - case "EARLY_ACCESS": - case 1: - message.launchStage = 1; - break; - case "ALPHA": - case 2: - message.launchStage = 2; - break; - case "BETA": - case 3: - message.launchStage = 3; - break; - case "GA": - case 4: - message.launchStage = 4; - break; - case "DEPRECATED": - case 5: - message.launchStage = 5; - break; - } - if (object.restNumericEnums != null) - message.restNumericEnums = Boolean(object.restNumericEnums); - if (object.javaSettings != null) { - if (typeof object.javaSettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.javaSettings: object expected"); - message.javaSettings = $root.google.api.JavaSettings.fromObject(object.javaSettings); - } - if (object.cppSettings != null) { - if (typeof object.cppSettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.cppSettings: object expected"); - message.cppSettings = $root.google.api.CppSettings.fromObject(object.cppSettings); - } - if (object.phpSettings != null) { - if (typeof object.phpSettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.phpSettings: object expected"); - message.phpSettings = $root.google.api.PhpSettings.fromObject(object.phpSettings); - } - if (object.pythonSettings != null) { - if (typeof object.pythonSettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.pythonSettings: object expected"); - message.pythonSettings = $root.google.api.PythonSettings.fromObject(object.pythonSettings); - } - if (object.nodeSettings != null) { - if (typeof object.nodeSettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.nodeSettings: object expected"); - message.nodeSettings = $root.google.api.NodeSettings.fromObject(object.nodeSettings); - } - if (object.dotnetSettings != null) { - if (typeof object.dotnetSettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.dotnetSettings: object expected"); - message.dotnetSettings = $root.google.api.DotnetSettings.fromObject(object.dotnetSettings); - } - if (object.rubySettings != null) { - if (typeof object.rubySettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.rubySettings: object expected"); - message.rubySettings = $root.google.api.RubySettings.fromObject(object.rubySettings); - } - if (object.goSettings != null) { - if (typeof object.goSettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.goSettings: object expected"); - message.goSettings = $root.google.api.GoSettings.fromObject(object.goSettings); - } - return message; - }; - /** - * Creates a plain object from a ClientLibrarySettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.ClientLibrarySettings - * @static - * @param {google.api.ClientLibrarySettings} message ClientLibrarySettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ClientLibrarySettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.version = ""; - object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; - object.restNumericEnums = false; - object.javaSettings = null; - object.cppSettings = null; - object.phpSettings = null; - object.pythonSettings = null; - object.nodeSettings = null; - object.dotnetSettings = null; - object.rubySettings = null; - object.goSettings = null; - } - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; - if (message.launchStage != null && message.hasOwnProperty("launchStage")) - object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; - if (message.restNumericEnums != null && message.hasOwnProperty("restNumericEnums")) - object.restNumericEnums = message.restNumericEnums; - if (message.javaSettings != null && message.hasOwnProperty("javaSettings")) - object.javaSettings = $root.google.api.JavaSettings.toObject(message.javaSettings, options); - if (message.cppSettings != null && message.hasOwnProperty("cppSettings")) - object.cppSettings = $root.google.api.CppSettings.toObject(message.cppSettings, options); - if (message.phpSettings != null && message.hasOwnProperty("phpSettings")) - object.phpSettings = $root.google.api.PhpSettings.toObject(message.phpSettings, options); - if (message.pythonSettings != null && message.hasOwnProperty("pythonSettings")) - object.pythonSettings = $root.google.api.PythonSettings.toObject(message.pythonSettings, options); - if (message.nodeSettings != null && message.hasOwnProperty("nodeSettings")) - object.nodeSettings = $root.google.api.NodeSettings.toObject(message.nodeSettings, options); - if (message.dotnetSettings != null && message.hasOwnProperty("dotnetSettings")) - object.dotnetSettings = $root.google.api.DotnetSettings.toObject(message.dotnetSettings, options); - if (message.rubySettings != null && message.hasOwnProperty("rubySettings")) - object.rubySettings = $root.google.api.RubySettings.toObject(message.rubySettings, options); - if (message.goSettings != null && message.hasOwnProperty("goSettings")) - object.goSettings = $root.google.api.GoSettings.toObject(message.goSettings, options); - return object; - }; + /** + * DeleteWorkflowRequest name. + * @member {string} name + * @memberof google.cloud.workflows.v1.DeleteWorkflowRequest + * @instance + */ + DeleteWorkflowRequest.prototype.name = ""; - /** - * Converts this ClientLibrarySettings to JSON. - * @function toJSON - * @memberof google.api.ClientLibrarySettings - * @instance - * @returns {Object.} JSON object - */ - ClientLibrarySettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a new DeleteWorkflowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1.DeleteWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.IDeleteWorkflowRequest=} [properties] Properties to set + * @returns {google.cloud.workflows.v1.DeleteWorkflowRequest} DeleteWorkflowRequest instance + */ + DeleteWorkflowRequest.create = function create(properties) { + return new DeleteWorkflowRequest(properties); + }; - /** - * Gets the default type url for ClientLibrarySettings - * @function getTypeUrl - * @memberof google.api.ClientLibrarySettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ClientLibrarySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.ClientLibrarySettings"; - }; + /** + * Encodes the specified DeleteWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1.DeleteWorkflowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1.DeleteWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.IDeleteWorkflowRequest} message DeleteWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteWorkflowRequest.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; + }; - return ClientLibrarySettings; - })(); + /** + * Encodes the specified DeleteWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.DeleteWorkflowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1.DeleteWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.IDeleteWorkflowRequest} message DeleteWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteWorkflowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - api.Publishing = (function() { + /** + * Decodes a DeleteWorkflowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1.DeleteWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1.DeleteWorkflowRequest} DeleteWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteWorkflowRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1.DeleteWorkflowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Properties of a Publishing. - * @memberof google.api - * @interface IPublishing - * @property {Array.|null} [methodSettings] Publishing methodSettings - * @property {string|null} [newIssueUri] Publishing newIssueUri - * @property {string|null} [documentationUri] Publishing documentationUri - * @property {string|null} [apiShortName] Publishing apiShortName - * @property {string|null} [githubLabel] Publishing githubLabel - * @property {Array.|null} [codeownerGithubTeams] Publishing codeownerGithubTeams - * @property {string|null} [docTagPrefix] Publishing docTagPrefix - * @property {google.api.ClientLibraryOrganization|null} [organization] Publishing organization - * @property {Array.|null} [librarySettings] Publishing librarySettings - * @property {string|null} [protoReferenceDocumentationUri] Publishing protoReferenceDocumentationUri - * @property {string|null} [restReferenceDocumentationUri] Publishing restReferenceDocumentationUri - */ + /** + * Decodes a DeleteWorkflowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1.DeleteWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1.DeleteWorkflowRequest} DeleteWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteWorkflowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Constructs a new Publishing. - * @memberof google.api - * @classdesc Represents a Publishing. - * @implements IPublishing - * @constructor - * @param {google.api.IPublishing=} [properties] Properties to set - */ - function Publishing(properties) { - this.methodSettings = []; - this.codeownerGithubTeams = []; - this.librarySettings = []; - 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]]; - } + /** + * Verifies a DeleteWorkflowRequest message. + * @function verify + * @memberof google.cloud.workflows.v1.DeleteWorkflowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteWorkflowRequest.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; + }; - /** - * Publishing methodSettings. - * @member {Array.} methodSettings - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.methodSettings = $util.emptyArray; + /** + * Creates a DeleteWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1.DeleteWorkflowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1.DeleteWorkflowRequest} DeleteWorkflowRequest + */ + DeleteWorkflowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1.DeleteWorkflowRequest) + return object; + var message = new $root.google.cloud.workflows.v1.DeleteWorkflowRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; - /** - * Publishing newIssueUri. - * @member {string} newIssueUri - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.newIssueUri = ""; + /** + * Creates a plain object from a DeleteWorkflowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1.DeleteWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.DeleteWorkflowRequest} message DeleteWorkflowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteWorkflowRequest.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; + }; - /** - * Publishing documentationUri. - * @member {string} documentationUri - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.documentationUri = ""; + /** + * Converts this DeleteWorkflowRequest to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1.DeleteWorkflowRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteWorkflowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Publishing apiShortName. - * @member {string} apiShortName - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.apiShortName = ""; + /** + * Gets the default type url for DeleteWorkflowRequest + * @function getTypeUrl + * @memberof google.cloud.workflows.v1.DeleteWorkflowRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteWorkflowRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1.DeleteWorkflowRequest"; + }; - /** - * Publishing githubLabel. - * @member {string} githubLabel - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.githubLabel = ""; + return DeleteWorkflowRequest; + })(); - /** - * Publishing codeownerGithubTeams. - * @member {Array.} codeownerGithubTeams - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.codeownerGithubTeams = $util.emptyArray; + v1.UpdateWorkflowRequest = (function() { - /** - * Publishing docTagPrefix. - * @member {string} docTagPrefix - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.docTagPrefix = ""; + /** + * Properties of an UpdateWorkflowRequest. + * @memberof google.cloud.workflows.v1 + * @interface IUpdateWorkflowRequest + * @property {google.cloud.workflows.v1.IWorkflow|null} [workflow] UpdateWorkflowRequest workflow + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateWorkflowRequest updateMask + */ - /** - * Publishing organization. - * @member {google.api.ClientLibraryOrganization} organization - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.organization = 0; + /** + * Constructs a new UpdateWorkflowRequest. + * @memberof google.cloud.workflows.v1 + * @classdesc Represents an UpdateWorkflowRequest. + * @implements IUpdateWorkflowRequest + * @constructor + * @param {google.cloud.workflows.v1.IUpdateWorkflowRequest=} [properties] Properties to set + */ + function UpdateWorkflowRequest(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]]; + } - /** - * Publishing librarySettings. - * @member {Array.} librarySettings - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.librarySettings = $util.emptyArray; + /** + * UpdateWorkflowRequest workflow. + * @member {google.cloud.workflows.v1.IWorkflow|null|undefined} workflow + * @memberof google.cloud.workflows.v1.UpdateWorkflowRequest + * @instance + */ + UpdateWorkflowRequest.prototype.workflow = null; - /** - * Publishing protoReferenceDocumentationUri. - * @member {string} protoReferenceDocumentationUri - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.protoReferenceDocumentationUri = ""; + /** + * UpdateWorkflowRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.workflows.v1.UpdateWorkflowRequest + * @instance + */ + UpdateWorkflowRequest.prototype.updateMask = null; - /** - * Publishing restReferenceDocumentationUri. - * @member {string} restReferenceDocumentationUri - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.restReferenceDocumentationUri = ""; + /** + * Creates a new UpdateWorkflowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1.UpdateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.IUpdateWorkflowRequest=} [properties] Properties to set + * @returns {google.cloud.workflows.v1.UpdateWorkflowRequest} UpdateWorkflowRequest instance + */ + UpdateWorkflowRequest.create = function create(properties) { + return new UpdateWorkflowRequest(properties); + }; - /** - * Creates a new Publishing instance using the specified properties. - * @function create - * @memberof google.api.Publishing - * @static - * @param {google.api.IPublishing=} [properties] Properties to set - * @returns {google.api.Publishing} Publishing instance - */ - Publishing.create = function create(properties) { - return new Publishing(properties); - }; + /** + * Encodes the specified UpdateWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1.UpdateWorkflowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1.UpdateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.IUpdateWorkflowRequest} message UpdateWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateWorkflowRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.workflow != null && Object.hasOwnProperty.call(message, "workflow")) + $root.google.cloud.workflows.v1.Workflow.encode(message.workflow, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; - /** - * Encodes the specified Publishing message. Does not implicitly {@link google.api.Publishing.verify|verify} messages. - * @function encode - * @memberof google.api.Publishing - * @static - * @param {google.api.IPublishing} message Publishing message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Publishing.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.methodSettings != null && message.methodSettings.length) - for (var i = 0; i < message.methodSettings.length; ++i) - $root.google.api.MethodSettings.encode(message.methodSettings[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.newIssueUri != null && Object.hasOwnProperty.call(message, "newIssueUri")) - writer.uint32(/* id 101, wireType 2 =*/810).string(message.newIssueUri); - if (message.documentationUri != null && Object.hasOwnProperty.call(message, "documentationUri")) - writer.uint32(/* id 102, wireType 2 =*/818).string(message.documentationUri); - if (message.apiShortName != null && Object.hasOwnProperty.call(message, "apiShortName")) - writer.uint32(/* id 103, wireType 2 =*/826).string(message.apiShortName); - if (message.githubLabel != null && Object.hasOwnProperty.call(message, "githubLabel")) - writer.uint32(/* id 104, wireType 2 =*/834).string(message.githubLabel); - if (message.codeownerGithubTeams != null && message.codeownerGithubTeams.length) - for (var i = 0; i < message.codeownerGithubTeams.length; ++i) - writer.uint32(/* id 105, wireType 2 =*/842).string(message.codeownerGithubTeams[i]); - if (message.docTagPrefix != null && Object.hasOwnProperty.call(message, "docTagPrefix")) - writer.uint32(/* id 106, wireType 2 =*/850).string(message.docTagPrefix); - if (message.organization != null && Object.hasOwnProperty.call(message, "organization")) - writer.uint32(/* id 107, wireType 0 =*/856).int32(message.organization); - if (message.librarySettings != null && message.librarySettings.length) - for (var i = 0; i < message.librarySettings.length; ++i) - $root.google.api.ClientLibrarySettings.encode(message.librarySettings[i], writer.uint32(/* id 109, wireType 2 =*/874).fork()).ldelim(); - if (message.protoReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "protoReferenceDocumentationUri")) - writer.uint32(/* id 110, wireType 2 =*/882).string(message.protoReferenceDocumentationUri); - if (message.restReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "restReferenceDocumentationUri")) - writer.uint32(/* id 111, wireType 2 =*/890).string(message.restReferenceDocumentationUri); - return writer; - }; + /** + * Encodes the specified UpdateWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.UpdateWorkflowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1.UpdateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.IUpdateWorkflowRequest} message UpdateWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateWorkflowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Encodes the specified Publishing message, length delimited. Does not implicitly {@link google.api.Publishing.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.Publishing - * @static - * @param {google.api.IPublishing} message Publishing message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Publishing.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Decodes an UpdateWorkflowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1.UpdateWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1.UpdateWorkflowRequest} UpdateWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateWorkflowRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1.UpdateWorkflowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.workflow = $root.google.cloud.workflows.v1.Workflow.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Decodes a Publishing message from the specified reader or buffer. - * @function decode - * @memberof google.api.Publishing - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.Publishing} Publishing - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Publishing.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Publishing(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 2: { - if (!(message.methodSettings && message.methodSettings.length)) - message.methodSettings = []; - message.methodSettings.push($root.google.api.MethodSettings.decode(reader, reader.uint32())); - break; + /** + * Decodes an UpdateWorkflowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1.UpdateWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1.UpdateWorkflowRequest} UpdateWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateWorkflowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateWorkflowRequest message. + * @function verify + * @memberof google.cloud.workflows.v1.UpdateWorkflowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateWorkflowRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.workflow != null && message.hasOwnProperty("workflow")) { + var error = $root.google.cloud.workflows.v1.Workflow.verify(message.workflow); + if (error) + return "workflow." + error; } - case 101: { - message.newIssueUri = reader.string(); - break; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; } - case 102: { - message.documentationUri = reader.string(); - break; + return null; + }; + + /** + * Creates an UpdateWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1.UpdateWorkflowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1.UpdateWorkflowRequest} UpdateWorkflowRequest + */ + UpdateWorkflowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1.UpdateWorkflowRequest) + return object; + var message = new $root.google.cloud.workflows.v1.UpdateWorkflowRequest(); + if (object.workflow != null) { + if (typeof object.workflow !== "object") + throw TypeError(".google.cloud.workflows.v1.UpdateWorkflowRequest.workflow: object expected"); + message.workflow = $root.google.cloud.workflows.v1.Workflow.fromObject(object.workflow); } - case 103: { - message.apiShortName = reader.string(); - break; + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.workflows.v1.UpdateWorkflowRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); } - case 104: { - message.githubLabel = reader.string(); - break; + return message; + }; + + /** + * Creates a plain object from an UpdateWorkflowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1.UpdateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1.UpdateWorkflowRequest} message UpdateWorkflowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateWorkflowRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.workflow = null; + object.updateMask = null; } - case 105: { - if (!(message.codeownerGithubTeams && message.codeownerGithubTeams.length)) - message.codeownerGithubTeams = []; - message.codeownerGithubTeams.push(reader.string()); - break; + if (message.workflow != null && message.hasOwnProperty("workflow")) + object.workflow = $root.google.cloud.workflows.v1.Workflow.toObject(message.workflow, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateWorkflowRequest to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1.UpdateWorkflowRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateWorkflowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateWorkflowRequest + * @function getTypeUrl + * @memberof google.cloud.workflows.v1.UpdateWorkflowRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateWorkflowRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } - case 106: { - message.docTagPrefix = reader.string(); - break; + return typeUrlPrefix + "/google.cloud.workflows.v1.UpdateWorkflowRequest"; + }; + + return UpdateWorkflowRequest; + })(); + + v1.OperationMetadata = (function() { + + /** + * Properties of an OperationMetadata. + * @memberof google.cloud.workflows.v1 + * @interface IOperationMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [endTime] OperationMetadata endTime + * @property {string|null} [target] OperationMetadata target + * @property {string|null} [verb] OperationMetadata verb + * @property {string|null} [apiVersion] OperationMetadata apiVersion + */ + + /** + * Constructs a new OperationMetadata. + * @memberof google.cloud.workflows.v1 + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata + * @constructor + * @param {google.cloud.workflows.v1.IOperationMetadata=} [properties] Properties to set + */ + function OperationMetadata(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]]; + } + + /** + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.workflows.v1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.createTime = null; + + /** + * OperationMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.workflows.v1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.endTime = null; + + /** + * OperationMetadata target. + * @member {string} target + * @memberof google.cloud.workflows.v1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.target = ""; + + /** + * OperationMetadata verb. + * @member {string} verb + * @memberof google.cloud.workflows.v1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.verb = ""; + + /** + * OperationMetadata apiVersion. + * @member {string} apiVersion + * @memberof google.cloud.workflows.v1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.apiVersion = ""; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1.OperationMetadata + * @static + * @param {google.cloud.workflows.v1.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.workflows.v1.OperationMetadata} OperationMetadata instance + */ + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); + }; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.workflows.v1.OperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1.OperationMetadata + * @static + * @param {google.cloud.workflows.v1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.target != null && Object.hasOwnProperty.call(message, "target")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.target); + if (message.verb != null && Object.hasOwnProperty.call(message, "verb")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.verb); + if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.apiVersion); + return writer; + }; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.OperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1.OperationMetadata + * @static + * @param {google.cloud.workflows.v1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1.OperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.target = reader.string(); + break; + } + case 4: { + message.verb = reader.string(); + break; + } + case 5: { + message.apiVersion = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } } - case 107: { - message.organization = reader.int32(); - break; + return message; + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationMetadata message. + * @function verify + * @memberof google.cloud.workflows.v1.OperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; } - case 109: { - if (!(message.librarySettings && message.librarySettings.length)) - message.librarySettings = []; - message.librarySettings.push($root.google.api.ClientLibrarySettings.decode(reader, reader.uint32())); - break; + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; } - case 110: { - message.protoReferenceDocumentationUri = reader.string(); - break; + if (message.target != null && message.hasOwnProperty("target")) + if (!$util.isString(message.target)) + return "target: string expected"; + if (message.verb != null && message.hasOwnProperty("verb")) + if (!$util.isString(message.verb)) + return "verb: string expected"; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + if (!$util.isString(message.apiVersion)) + return "apiVersion: string expected"; + return null; + }; + + /** + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1.OperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1.OperationMetadata} OperationMetadata + */ + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1.OperationMetadata) + return object; + var message = new $root.google.cloud.workflows.v1.OperationMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.workflows.v1.OperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); } - case 111: { - message.restReferenceDocumentationUri = reader.string(); - break; + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.workflows.v1.OperationMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + if (object.target != null) + message.target = String(object.target); + if (object.verb != null) + message.verb = String(object.verb); + if (object.apiVersion != null) + message.apiVersion = String(object.apiVersion); + return message; + }; - /** - * Decodes a Publishing message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.Publishing - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.Publishing} Publishing - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Publishing.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1.OperationMetadata + * @static + * @param {google.cloud.workflows.v1.OperationMetadata} message OperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.endTime = null; + object.target = ""; + object.verb = ""; + object.apiVersion = ""; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.target != null && message.hasOwnProperty("target")) + object.target = message.target; + if (message.verb != null && message.hasOwnProperty("verb")) + object.verb = message.verb; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + object.apiVersion = message.apiVersion; + return object; + }; - /** - * Verifies a Publishing message. - * @function verify - * @memberof google.api.Publishing - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Publishing.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.methodSettings != null && message.hasOwnProperty("methodSettings")) { - if (!Array.isArray(message.methodSettings)) - return "methodSettings: array expected"; - for (var i = 0; i < message.methodSettings.length; ++i) { - var error = $root.google.api.MethodSettings.verify(message.methodSettings[i]); - if (error) - return "methodSettings." + error; - } - } - if (message.newIssueUri != null && message.hasOwnProperty("newIssueUri")) - if (!$util.isString(message.newIssueUri)) - return "newIssueUri: string expected"; - if (message.documentationUri != null && message.hasOwnProperty("documentationUri")) - if (!$util.isString(message.documentationUri)) - return "documentationUri: string expected"; - if (message.apiShortName != null && message.hasOwnProperty("apiShortName")) - if (!$util.isString(message.apiShortName)) - return "apiShortName: string expected"; - if (message.githubLabel != null && message.hasOwnProperty("githubLabel")) - if (!$util.isString(message.githubLabel)) - return "githubLabel: string expected"; - if (message.codeownerGithubTeams != null && message.hasOwnProperty("codeownerGithubTeams")) { - if (!Array.isArray(message.codeownerGithubTeams)) - return "codeownerGithubTeams: array expected"; - for (var i = 0; i < message.codeownerGithubTeams.length; ++i) - if (!$util.isString(message.codeownerGithubTeams[i])) - return "codeownerGithubTeams: string[] expected"; - } - if (message.docTagPrefix != null && message.hasOwnProperty("docTagPrefix")) - if (!$util.isString(message.docTagPrefix)) - return "docTagPrefix: string expected"; - if (message.organization != null && message.hasOwnProperty("organization")) - switch (message.organization) { - default: - return "organization: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - break; - } - if (message.librarySettings != null && message.hasOwnProperty("librarySettings")) { - if (!Array.isArray(message.librarySettings)) - return "librarySettings: array expected"; - for (var i = 0; i < message.librarySettings.length; ++i) { - var error = $root.google.api.ClientLibrarySettings.verify(message.librarySettings[i]); - if (error) - return "librarySettings." + error; + /** + * Converts this OperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1.OperationMetadata + * @instance + * @returns {Object.} JSON object + */ + OperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OperationMetadata + * @function getTypeUrl + * @memberof google.cloud.workflows.v1.OperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1.OperationMetadata"; + }; + + return OperationMetadata; + })(); + + v1.ListWorkflowRevisionsRequest = (function() { + + /** + * Properties of a ListWorkflowRevisionsRequest. + * @memberof google.cloud.workflows.v1 + * @interface IListWorkflowRevisionsRequest + * @property {string|null} [name] ListWorkflowRevisionsRequest name + * @property {number|null} [pageSize] ListWorkflowRevisionsRequest pageSize + * @property {string|null} [pageToken] ListWorkflowRevisionsRequest pageToken + */ + + /** + * Constructs a new ListWorkflowRevisionsRequest. + * @memberof google.cloud.workflows.v1 + * @classdesc Represents a ListWorkflowRevisionsRequest. + * @implements IListWorkflowRevisionsRequest + * @constructor + * @param {google.cloud.workflows.v1.IListWorkflowRevisionsRequest=} [properties] Properties to set + */ + function ListWorkflowRevisionsRequest(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]]; } - } - if (message.protoReferenceDocumentationUri != null && message.hasOwnProperty("protoReferenceDocumentationUri")) - if (!$util.isString(message.protoReferenceDocumentationUri)) - return "protoReferenceDocumentationUri: string expected"; - if (message.restReferenceDocumentationUri != null && message.hasOwnProperty("restReferenceDocumentationUri")) - if (!$util.isString(message.restReferenceDocumentationUri)) - return "restReferenceDocumentationUri: string expected"; - return null; - }; - /** - * Creates a Publishing message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.Publishing - * @static - * @param {Object.} object Plain object - * @returns {google.api.Publishing} Publishing - */ - Publishing.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.Publishing) - return object; - var message = new $root.google.api.Publishing(); - if (object.methodSettings) { - if (!Array.isArray(object.methodSettings)) - throw TypeError(".google.api.Publishing.methodSettings: array expected"); - message.methodSettings = []; - for (var i = 0; i < object.methodSettings.length; ++i) { - if (typeof object.methodSettings[i] !== "object") - throw TypeError(".google.api.Publishing.methodSettings: object expected"); - message.methodSettings[i] = $root.google.api.MethodSettings.fromObject(object.methodSettings[i]); - } - } - if (object.newIssueUri != null) - message.newIssueUri = String(object.newIssueUri); - if (object.documentationUri != null) - message.documentationUri = String(object.documentationUri); - if (object.apiShortName != null) - message.apiShortName = String(object.apiShortName); - if (object.githubLabel != null) - message.githubLabel = String(object.githubLabel); - if (object.codeownerGithubTeams) { - if (!Array.isArray(object.codeownerGithubTeams)) - throw TypeError(".google.api.Publishing.codeownerGithubTeams: array expected"); - message.codeownerGithubTeams = []; - for (var i = 0; i < object.codeownerGithubTeams.length; ++i) - message.codeownerGithubTeams[i] = String(object.codeownerGithubTeams[i]); - } - if (object.docTagPrefix != null) - message.docTagPrefix = String(object.docTagPrefix); - switch (object.organization) { - default: - if (typeof object.organization === "number") { - message.organization = object.organization; - break; - } - break; - case "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": - case 0: - message.organization = 0; - break; - case "CLOUD": - case 1: - message.organization = 1; - break; - case "ADS": - case 2: - message.organization = 2; - break; - case "PHOTOS": - case 3: - message.organization = 3; - break; - case "STREET_VIEW": - case 4: - message.organization = 4; - break; - case "SHOPPING": - case 5: - message.organization = 5; - break; - case "GEO": - case 6: - message.organization = 6; - break; - case "GENERATIVE_AI": - case 7: - message.organization = 7; - break; - } - if (object.librarySettings) { - if (!Array.isArray(object.librarySettings)) - throw TypeError(".google.api.Publishing.librarySettings: array expected"); - message.librarySettings = []; - for (var i = 0; i < object.librarySettings.length; ++i) { - if (typeof object.librarySettings[i] !== "object") - throw TypeError(".google.api.Publishing.librarySettings: object expected"); - message.librarySettings[i] = $root.google.api.ClientLibrarySettings.fromObject(object.librarySettings[i]); - } - } - if (object.protoReferenceDocumentationUri != null) - message.protoReferenceDocumentationUri = String(object.protoReferenceDocumentationUri); - if (object.restReferenceDocumentationUri != null) - message.restReferenceDocumentationUri = String(object.restReferenceDocumentationUri); - return message; - }; + /** + * ListWorkflowRevisionsRequest name. + * @member {string} name + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsRequest + * @instance + */ + ListWorkflowRevisionsRequest.prototype.name = ""; - /** - * Creates a plain object from a Publishing message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.Publishing - * @static - * @param {google.api.Publishing} message Publishing - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Publishing.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.methodSettings = []; - object.codeownerGithubTeams = []; - object.librarySettings = []; - } - if (options.defaults) { - object.newIssueUri = ""; - object.documentationUri = ""; - object.apiShortName = ""; - object.githubLabel = ""; - object.docTagPrefix = ""; - object.organization = options.enums === String ? "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" : 0; - object.protoReferenceDocumentationUri = ""; - object.restReferenceDocumentationUri = ""; - } - if (message.methodSettings && message.methodSettings.length) { - object.methodSettings = []; - for (var j = 0; j < message.methodSettings.length; ++j) - object.methodSettings[j] = $root.google.api.MethodSettings.toObject(message.methodSettings[j], options); - } - if (message.newIssueUri != null && message.hasOwnProperty("newIssueUri")) - object.newIssueUri = message.newIssueUri; - if (message.documentationUri != null && message.hasOwnProperty("documentationUri")) - object.documentationUri = message.documentationUri; - if (message.apiShortName != null && message.hasOwnProperty("apiShortName")) - object.apiShortName = message.apiShortName; - if (message.githubLabel != null && message.hasOwnProperty("githubLabel")) - object.githubLabel = message.githubLabel; - if (message.codeownerGithubTeams && message.codeownerGithubTeams.length) { - object.codeownerGithubTeams = []; - for (var j = 0; j < message.codeownerGithubTeams.length; ++j) - object.codeownerGithubTeams[j] = message.codeownerGithubTeams[j]; - } - if (message.docTagPrefix != null && message.hasOwnProperty("docTagPrefix")) - object.docTagPrefix = message.docTagPrefix; - if (message.organization != null && message.hasOwnProperty("organization")) - object.organization = options.enums === String ? $root.google.api.ClientLibraryOrganization[message.organization] === undefined ? message.organization : $root.google.api.ClientLibraryOrganization[message.organization] : message.organization; - if (message.librarySettings && message.librarySettings.length) { - object.librarySettings = []; - for (var j = 0; j < message.librarySettings.length; ++j) - object.librarySettings[j] = $root.google.api.ClientLibrarySettings.toObject(message.librarySettings[j], options); - } - if (message.protoReferenceDocumentationUri != null && message.hasOwnProperty("protoReferenceDocumentationUri")) - object.protoReferenceDocumentationUri = message.protoReferenceDocumentationUri; - if (message.restReferenceDocumentationUri != null && message.hasOwnProperty("restReferenceDocumentationUri")) - object.restReferenceDocumentationUri = message.restReferenceDocumentationUri; - return object; - }; + /** + * ListWorkflowRevisionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsRequest + * @instance + */ + ListWorkflowRevisionsRequest.prototype.pageSize = 0; - /** - * Converts this Publishing to JSON. - * @function toJSON - * @memberof google.api.Publishing - * @instance - * @returns {Object.} JSON object - */ - Publishing.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * ListWorkflowRevisionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsRequest + * @instance + */ + ListWorkflowRevisionsRequest.prototype.pageToken = ""; - /** - * Gets the default type url for Publishing - * @function getTypeUrl - * @memberof google.api.Publishing - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Publishing.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.Publishing"; - }; + /** + * Creates a new ListWorkflowRevisionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsRequest + * @static + * @param {google.cloud.workflows.v1.IListWorkflowRevisionsRequest=} [properties] Properties to set + * @returns {google.cloud.workflows.v1.ListWorkflowRevisionsRequest} ListWorkflowRevisionsRequest instance + */ + ListWorkflowRevisionsRequest.create = function create(properties) { + return new ListWorkflowRevisionsRequest(properties); + }; - return Publishing; - })(); + /** + * Encodes the specified ListWorkflowRevisionsRequest message. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowRevisionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsRequest + * @static + * @param {google.cloud.workflows.v1.IListWorkflowRevisionsRequest} message ListWorkflowRevisionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWorkflowRevisionsRequest.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); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; - api.JavaSettings = (function() { + /** + * Encodes the specified ListWorkflowRevisionsRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowRevisionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsRequest + * @static + * @param {google.cloud.workflows.v1.IListWorkflowRevisionsRequest} message ListWorkflowRevisionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWorkflowRevisionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Properties of a JavaSettings. - * @memberof google.api - * @interface IJavaSettings - * @property {string|null} [libraryPackage] JavaSettings libraryPackage - * @property {Object.|null} [serviceClassNames] JavaSettings serviceClassNames - * @property {google.api.ICommonLanguageSettings|null} [common] JavaSettings common - */ + /** + * Decodes a ListWorkflowRevisionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1.ListWorkflowRevisionsRequest} ListWorkflowRevisionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWorkflowRevisionsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1.ListWorkflowRevisionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Constructs a new JavaSettings. - * @memberof google.api - * @classdesc Represents a JavaSettings. - * @implements IJavaSettings - * @constructor - * @param {google.api.IJavaSettings=} [properties] Properties to set - */ - function JavaSettings(properties) { - this.serviceClassNames = {}; - 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]]; - } + /** + * Decodes a ListWorkflowRevisionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1.ListWorkflowRevisionsRequest} ListWorkflowRevisionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWorkflowRevisionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * JavaSettings libraryPackage. - * @member {string} libraryPackage - * @memberof google.api.JavaSettings - * @instance - */ - JavaSettings.prototype.libraryPackage = ""; + /** + * Verifies a ListWorkflowRevisionsRequest message. + * @function verify + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListWorkflowRevisionsRequest.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"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; - /** - * JavaSettings serviceClassNames. - * @member {Object.} serviceClassNames - * @memberof google.api.JavaSettings - * @instance - */ - JavaSettings.prototype.serviceClassNames = $util.emptyObject; + /** + * Creates a ListWorkflowRevisionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1.ListWorkflowRevisionsRequest} ListWorkflowRevisionsRequest + */ + ListWorkflowRevisionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1.ListWorkflowRevisionsRequest) + return object; + var message = new $root.google.cloud.workflows.v1.ListWorkflowRevisionsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; - /** - * JavaSettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.JavaSettings - * @instance - */ - JavaSettings.prototype.common = null; + /** + * Creates a plain object from a ListWorkflowRevisionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsRequest + * @static + * @param {google.cloud.workflows.v1.ListWorkflowRevisionsRequest} message ListWorkflowRevisionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListWorkflowRevisionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; - /** - * Creates a new JavaSettings instance using the specified properties. - * @function create - * @memberof google.api.JavaSettings - * @static - * @param {google.api.IJavaSettings=} [properties] Properties to set - * @returns {google.api.JavaSettings} JavaSettings instance - */ - JavaSettings.create = function create(properties) { - return new JavaSettings(properties); - }; + /** + * Converts this ListWorkflowRevisionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListWorkflowRevisionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Encodes the specified JavaSettings message. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. - * @function encode - * @memberof google.api.JavaSettings - * @static - * @param {google.api.IJavaSettings} message JavaSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - JavaSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.libraryPackage != null && Object.hasOwnProperty.call(message, "libraryPackage")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.libraryPackage); - if (message.serviceClassNames != null && Object.hasOwnProperty.call(message, "serviceClassNames")) - for (var keys = Object.keys(message.serviceClassNames), i = 0; i < keys.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.serviceClassNames[keys[i]]).ldelim(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; + /** + * Gets the default type url for ListWorkflowRevisionsRequest + * @function getTypeUrl + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListWorkflowRevisionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1.ListWorkflowRevisionsRequest"; + }; - /** - * Encodes the specified JavaSettings message, length delimited. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.JavaSettings - * @static - * @param {google.api.IJavaSettings} message JavaSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - JavaSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + return ListWorkflowRevisionsRequest; + })(); - /** - * Decodes a JavaSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.JavaSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.JavaSettings} JavaSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - JavaSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.JavaSettings(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.libraryPackage = reader.string(); - break; - } - case 2: { - if (message.serviceClassNames === $util.emptyObject) - message.serviceClassNames = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); + v1.ListWorkflowRevisionsResponse = (function() { + + /** + * Properties of a ListWorkflowRevisionsResponse. + * @memberof google.cloud.workflows.v1 + * @interface IListWorkflowRevisionsResponse + * @property {Array.|null} [workflows] ListWorkflowRevisionsResponse workflows + * @property {string|null} [nextPageToken] ListWorkflowRevisionsResponse nextPageToken + */ + + /** + * Constructs a new ListWorkflowRevisionsResponse. + * @memberof google.cloud.workflows.v1 + * @classdesc Represents a ListWorkflowRevisionsResponse. + * @implements IListWorkflowRevisionsResponse + * @constructor + * @param {google.cloud.workflows.v1.IListWorkflowRevisionsResponse=} [properties] Properties to set + */ + function ListWorkflowRevisionsResponse(properties) { + this.workflows = []; + 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]]; + } + + /** + * ListWorkflowRevisionsResponse workflows. + * @member {Array.} workflows + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsResponse + * @instance + */ + ListWorkflowRevisionsResponse.prototype.workflows = $util.emptyArray; + + /** + * ListWorkflowRevisionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsResponse + * @instance + */ + ListWorkflowRevisionsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListWorkflowRevisionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsResponse + * @static + * @param {google.cloud.workflows.v1.IListWorkflowRevisionsResponse=} [properties] Properties to set + * @returns {google.cloud.workflows.v1.ListWorkflowRevisionsResponse} ListWorkflowRevisionsResponse instance + */ + ListWorkflowRevisionsResponse.create = function create(properties) { + return new ListWorkflowRevisionsResponse(properties); + }; + + /** + * Encodes the specified ListWorkflowRevisionsResponse message. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowRevisionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsResponse + * @static + * @param {google.cloud.workflows.v1.IListWorkflowRevisionsResponse} message ListWorkflowRevisionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWorkflowRevisionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.workflows != null && message.workflows.length) + for (var i = 0; i < message.workflows.length; ++i) + $root.google.cloud.workflows.v1.Workflow.encode(message.workflows[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListWorkflowRevisionsResponse message, length delimited. Does not implicitly {@link google.cloud.workflows.v1.ListWorkflowRevisionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsResponse + * @static + * @param {google.cloud.workflows.v1.IListWorkflowRevisionsResponse} message ListWorkflowRevisionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWorkflowRevisionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListWorkflowRevisionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1.ListWorkflowRevisionsResponse} ListWorkflowRevisionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWorkflowRevisionsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1.ListWorkflowRevisionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.workflows && message.workflows.length)) + message.workflows = []; + message.workflows.push($root.google.cloud.workflows.v1.Workflow.decode(reader, reader.uint32())); break; - default: - reader.skipType(tag2 & 7); + } + case 2: { + message.nextPageToken = reader.string(); break; } + default: + reader.skipType(tag & 7); + break; } - message.serviceClassNames[key] = value; - break; - } - case 3: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + return message; + }; - /** - * Decodes a JavaSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.JavaSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.JavaSettings} JavaSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - JavaSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a ListWorkflowRevisionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1.ListWorkflowRevisionsResponse} ListWorkflowRevisionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWorkflowRevisionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a JavaSettings message. - * @function verify - * @memberof google.api.JavaSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - JavaSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.libraryPackage != null && message.hasOwnProperty("libraryPackage")) - if (!$util.isString(message.libraryPackage)) - return "libraryPackage: string expected"; - if (message.serviceClassNames != null && message.hasOwnProperty("serviceClassNames")) { - if (!$util.isObject(message.serviceClassNames)) - return "serviceClassNames: object expected"; - var key = Object.keys(message.serviceClassNames); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.serviceClassNames[key[i]])) - return "serviceClassNames: string{k:string} expected"; - } - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - return null; - }; + /** + * Verifies a ListWorkflowRevisionsResponse message. + * @function verify + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListWorkflowRevisionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.workflows != null && message.hasOwnProperty("workflows")) { + if (!Array.isArray(message.workflows)) + return "workflows: array expected"; + for (var i = 0; i < message.workflows.length; ++i) { + var error = $root.google.cloud.workflows.v1.Workflow.verify(message.workflows[i]); + if (error) + return "workflows." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; - /** - * Creates a JavaSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.JavaSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.JavaSettings} JavaSettings - */ - JavaSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.JavaSettings) - return object; - var message = new $root.google.api.JavaSettings(); - if (object.libraryPackage != null) - message.libraryPackage = String(object.libraryPackage); - if (object.serviceClassNames) { - if (typeof object.serviceClassNames !== "object") - throw TypeError(".google.api.JavaSettings.serviceClassNames: object expected"); - message.serviceClassNames = {}; - for (var keys = Object.keys(object.serviceClassNames), i = 0; i < keys.length; ++i) - message.serviceClassNames[keys[i]] = String(object.serviceClassNames[keys[i]]); - } - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.JavaSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - return message; - }; + /** + * Creates a ListWorkflowRevisionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1.ListWorkflowRevisionsResponse} ListWorkflowRevisionsResponse + */ + ListWorkflowRevisionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1.ListWorkflowRevisionsResponse) + return object; + var message = new $root.google.cloud.workflows.v1.ListWorkflowRevisionsResponse(); + if (object.workflows) { + if (!Array.isArray(object.workflows)) + throw TypeError(".google.cloud.workflows.v1.ListWorkflowRevisionsResponse.workflows: array expected"); + message.workflows = []; + for (var i = 0; i < object.workflows.length; ++i) { + if (typeof object.workflows[i] !== "object") + throw TypeError(".google.cloud.workflows.v1.ListWorkflowRevisionsResponse.workflows: object expected"); + message.workflows[i] = $root.google.cloud.workflows.v1.Workflow.fromObject(object.workflows[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; - /** - * Creates a plain object from a JavaSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.JavaSettings - * @static - * @param {google.api.JavaSettings} message JavaSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - JavaSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.serviceClassNames = {}; - if (options.defaults) { - object.libraryPackage = ""; - object.common = null; - } - if (message.libraryPackage != null && message.hasOwnProperty("libraryPackage")) - object.libraryPackage = message.libraryPackage; - var keys2; - if (message.serviceClassNames && (keys2 = Object.keys(message.serviceClassNames)).length) { - object.serviceClassNames = {}; - for (var j = 0; j < keys2.length; ++j) - object.serviceClassNames[keys2[j]] = message.serviceClassNames[keys2[j]]; - } - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - return object; - }; + /** + * Creates a plain object from a ListWorkflowRevisionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsResponse + * @static + * @param {google.cloud.workflows.v1.ListWorkflowRevisionsResponse} message ListWorkflowRevisionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListWorkflowRevisionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.workflows = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.workflows && message.workflows.length) { + object.workflows = []; + for (var j = 0; j < message.workflows.length; ++j) + object.workflows[j] = $root.google.cloud.workflows.v1.Workflow.toObject(message.workflows[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; - /** - * Converts this JavaSettings to JSON. - * @function toJSON - * @memberof google.api.JavaSettings - * @instance - * @returns {Object.} JSON object - */ - JavaSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this ListWorkflowRevisionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListWorkflowRevisionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Gets the default type url for JavaSettings - * @function getTypeUrl - * @memberof google.api.JavaSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - JavaSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.JavaSettings"; - }; + /** + * Gets the default type url for ListWorkflowRevisionsResponse + * @function getTypeUrl + * @memberof google.cloud.workflows.v1.ListWorkflowRevisionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListWorkflowRevisionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1.ListWorkflowRevisionsResponse"; + }; - return JavaSettings; - })(); + return ListWorkflowRevisionsResponse; + })(); - api.CppSettings = (function() { + /** + * ExecutionHistoryLevel enum. + * @name google.cloud.workflows.v1.ExecutionHistoryLevel + * @enum {number} + * @property {number} EXECUTION_HISTORY_LEVEL_UNSPECIFIED=0 EXECUTION_HISTORY_LEVEL_UNSPECIFIED value + * @property {number} EXECUTION_HISTORY_BASIC=1 EXECUTION_HISTORY_BASIC value + * @property {number} EXECUTION_HISTORY_DETAILED=2 EXECUTION_HISTORY_DETAILED value + */ + v1.ExecutionHistoryLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EXECUTION_HISTORY_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "EXECUTION_HISTORY_BASIC"] = 1; + values[valuesById[2] = "EXECUTION_HISTORY_DETAILED"] = 2; + return values; + })(); - /** - * Properties of a CppSettings. - * @memberof google.api - * @interface ICppSettings - * @property {google.api.ICommonLanguageSettings|null} [common] CppSettings common - */ + return v1; + })(); - /** - * Constructs a new CppSettings. - * @memberof google.api - * @classdesc Represents a CppSettings. - * @implements ICppSettings - * @constructor - * @param {google.api.ICppSettings=} [properties] Properties to set - */ - function CppSettings(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]]; - } + workflows.v1beta = (function() { - /** - * CppSettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.CppSettings - * @instance - */ - CppSettings.prototype.common = null; + /** + * Namespace v1beta. + * @memberof google.cloud.workflows + * @namespace + */ + var v1beta = {}; - /** - * Creates a new CppSettings instance using the specified properties. - * @function create - * @memberof google.api.CppSettings - * @static - * @param {google.api.ICppSettings=} [properties] Properties to set - * @returns {google.api.CppSettings} CppSettings instance - */ - CppSettings.create = function create(properties) { - return new CppSettings(properties); - }; + v1beta.Workflows = (function() { - /** - * Encodes the specified CppSettings message. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. - * @function encode - * @memberof google.api.CppSettings - * @static - * @param {google.api.ICppSettings} message CppSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CppSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * Constructs a new Workflows service. + * @memberof google.cloud.workflows.v1beta + * @classdesc Represents a Workflows + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Workflows(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } - /** - * Encodes the specified CppSettings message, length delimited. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.CppSettings - * @static - * @param {google.api.ICppSettings} message CppSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CppSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + (Workflows.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Workflows; - /** - * Decodes a CppSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.CppSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.CppSettings} CppSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CppSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CppSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates new Workflows service using the specified rpc implementation. + * @function create + * @memberof google.cloud.workflows.v1beta.Workflows + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Workflows} RPC service. Useful where requests and/or responses are streamed. + */ + Workflows.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; - /** - * Decodes a CppSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.CppSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.CppSettings} CppSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CppSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Callback as used by {@link google.cloud.workflows.v1beta.Workflows|listWorkflows}. + * @memberof google.cloud.workflows.v1beta.Workflows + * @typedef ListWorkflowsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.workflows.v1beta.ListWorkflowsResponse} [response] ListWorkflowsResponse + */ - /** - * Verifies a CppSettings message. - * @function verify - * @memberof google.api.CppSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CppSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - return null; - }; + /** + * Calls ListWorkflows. + * @function listWorkflows + * @memberof google.cloud.workflows.v1beta.Workflows + * @instance + * @param {google.cloud.workflows.v1beta.IListWorkflowsRequest} request ListWorkflowsRequest message or plain object + * @param {google.cloud.workflows.v1beta.Workflows.ListWorkflowsCallback} callback Node-style callback called with the error, if any, and ListWorkflowsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Workflows.prototype.listWorkflows = function listWorkflows(request, callback) { + return this.rpcCall(listWorkflows, $root.google.cloud.workflows.v1beta.ListWorkflowsRequest, $root.google.cloud.workflows.v1beta.ListWorkflowsResponse, request, callback); + }, "name", { value: "ListWorkflows" }); - /** - * Creates a CppSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.CppSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.CppSettings} CppSettings - */ - CppSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.CppSettings) - return object; - var message = new $root.google.api.CppSettings(); - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.CppSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - return message; - }; + /** + * Calls ListWorkflows. + * @function listWorkflows + * @memberof google.cloud.workflows.v1beta.Workflows + * @instance + * @param {google.cloud.workflows.v1beta.IListWorkflowsRequest} request ListWorkflowsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Creates a plain object from a CppSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.CppSettings - * @static - * @param {google.api.CppSettings} message CppSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CppSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - return object; - }; + /** + * Callback as used by {@link google.cloud.workflows.v1beta.Workflows|getWorkflow}. + * @memberof google.cloud.workflows.v1beta.Workflows + * @typedef GetWorkflowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.workflows.v1beta.Workflow} [response] Workflow + */ - /** - * Converts this CppSettings to JSON. - * @function toJSON - * @memberof google.api.CppSettings - * @instance - * @returns {Object.} JSON object - */ - CppSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Calls GetWorkflow. + * @function getWorkflow + * @memberof google.cloud.workflows.v1beta.Workflows + * @instance + * @param {google.cloud.workflows.v1beta.IGetWorkflowRequest} request GetWorkflowRequest message or plain object + * @param {google.cloud.workflows.v1beta.Workflows.GetWorkflowCallback} callback Node-style callback called with the error, if any, and Workflow + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Workflows.prototype.getWorkflow = function getWorkflow(request, callback) { + return this.rpcCall(getWorkflow, $root.google.cloud.workflows.v1beta.GetWorkflowRequest, $root.google.cloud.workflows.v1beta.Workflow, request, callback); + }, "name", { value: "GetWorkflow" }); - /** - * Gets the default type url for CppSettings - * @function getTypeUrl - * @memberof google.api.CppSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CppSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.CppSettings"; - }; + /** + * Calls GetWorkflow. + * @function getWorkflow + * @memberof google.cloud.workflows.v1beta.Workflows + * @instance + * @param {google.cloud.workflows.v1beta.IGetWorkflowRequest} request GetWorkflowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - return CppSettings; - })(); + /** + * Callback as used by {@link google.cloud.workflows.v1beta.Workflows|createWorkflow}. + * @memberof google.cloud.workflows.v1beta.Workflows + * @typedef CreateWorkflowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ - api.PhpSettings = (function() { + /** + * Calls CreateWorkflow. + * @function createWorkflow + * @memberof google.cloud.workflows.v1beta.Workflows + * @instance + * @param {google.cloud.workflows.v1beta.ICreateWorkflowRequest} request CreateWorkflowRequest message or plain object + * @param {google.cloud.workflows.v1beta.Workflows.CreateWorkflowCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Workflows.prototype.createWorkflow = function createWorkflow(request, callback) { + return this.rpcCall(createWorkflow, $root.google.cloud.workflows.v1beta.CreateWorkflowRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateWorkflow" }); - /** - * Properties of a PhpSettings. - * @memberof google.api - * @interface IPhpSettings - * @property {google.api.ICommonLanguageSettings|null} [common] PhpSettings common - */ + /** + * Calls CreateWorkflow. + * @function createWorkflow + * @memberof google.cloud.workflows.v1beta.Workflows + * @instance + * @param {google.cloud.workflows.v1beta.ICreateWorkflowRequest} request CreateWorkflowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Constructs a new PhpSettings. - * @memberof google.api - * @classdesc Represents a PhpSettings. - * @implements IPhpSettings - * @constructor - * @param {google.api.IPhpSettings=} [properties] Properties to set - */ - function PhpSettings(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]]; - } + /** + * Callback as used by {@link google.cloud.workflows.v1beta.Workflows|deleteWorkflow}. + * @memberof google.cloud.workflows.v1beta.Workflows + * @typedef DeleteWorkflowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ - /** - * PhpSettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.PhpSettings - * @instance - */ - PhpSettings.prototype.common = null; + /** + * Calls DeleteWorkflow. + * @function deleteWorkflow + * @memberof google.cloud.workflows.v1beta.Workflows + * @instance + * @param {google.cloud.workflows.v1beta.IDeleteWorkflowRequest} request DeleteWorkflowRequest message or plain object + * @param {google.cloud.workflows.v1beta.Workflows.DeleteWorkflowCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Workflows.prototype.deleteWorkflow = function deleteWorkflow(request, callback) { + return this.rpcCall(deleteWorkflow, $root.google.cloud.workflows.v1beta.DeleteWorkflowRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteWorkflow" }); - /** - * Creates a new PhpSettings instance using the specified properties. - * @function create - * @memberof google.api.PhpSettings - * @static - * @param {google.api.IPhpSettings=} [properties] Properties to set - * @returns {google.api.PhpSettings} PhpSettings instance - */ - PhpSettings.create = function create(properties) { - return new PhpSettings(properties); - }; + /** + * Calls DeleteWorkflow. + * @function deleteWorkflow + * @memberof google.cloud.workflows.v1beta.Workflows + * @instance + * @param {google.cloud.workflows.v1beta.IDeleteWorkflowRequest} request DeleteWorkflowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Encodes the specified PhpSettings message. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. - * @function encode - * @memberof google.api.PhpSettings - * @static - * @param {google.api.IPhpSettings} message PhpSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PhpSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * Callback as used by {@link google.cloud.workflows.v1beta.Workflows|updateWorkflow}. + * @memberof google.cloud.workflows.v1beta.Workflows + * @typedef UpdateWorkflowCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ - /** - * Encodes the specified PhpSettings message, length delimited. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.PhpSettings - * @static - * @param {google.api.IPhpSettings} message PhpSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PhpSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Calls UpdateWorkflow. + * @function updateWorkflow + * @memberof google.cloud.workflows.v1beta.Workflows + * @instance + * @param {google.cloud.workflows.v1beta.IUpdateWorkflowRequest} request UpdateWorkflowRequest message or plain object + * @param {google.cloud.workflows.v1beta.Workflows.UpdateWorkflowCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Workflows.prototype.updateWorkflow = function updateWorkflow(request, callback) { + return this.rpcCall(updateWorkflow, $root.google.cloud.workflows.v1beta.UpdateWorkflowRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateWorkflow" }); - /** - * Decodes a PhpSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.PhpSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.PhpSettings} PhpSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PhpSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PhpSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; + /** + * Calls UpdateWorkflow. + * @function updateWorkflow + * @memberof google.cloud.workflows.v1beta.Workflows + * @instance + * @param {google.cloud.workflows.v1beta.IUpdateWorkflowRequest} request UpdateWorkflowRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Workflows; + })(); + + v1beta.Workflow = (function() { + + /** + * Properties of a Workflow. + * @memberof google.cloud.workflows.v1beta + * @interface IWorkflow + * @property {string|null} [name] Workflow name + * @property {string|null} [description] Workflow description + * @property {google.cloud.workflows.v1beta.Workflow.State|null} [state] Workflow state + * @property {string|null} [revisionId] Workflow revisionId + * @property {google.protobuf.ITimestamp|null} [createTime] Workflow createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] Workflow updateTime + * @property {google.protobuf.ITimestamp|null} [revisionCreateTime] Workflow revisionCreateTime + * @property {Object.|null} [labels] Workflow labels + * @property {string|null} [serviceAccount] Workflow serviceAccount + * @property {string|null} [sourceContents] Workflow sourceContents + */ + + /** + * Constructs a new Workflow. + * @memberof google.cloud.workflows.v1beta + * @classdesc Represents a Workflow. + * @implements IWorkflow + * @constructor + * @param {google.cloud.workflows.v1beta.IWorkflow=} [properties] Properties to set + */ + function Workflow(properties) { + this.labels = {}; + 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]]; } - } - return message; - }; - /** - * Decodes a PhpSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.PhpSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.PhpSettings} PhpSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PhpSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Workflow name. + * @member {string} name + * @memberof google.cloud.workflows.v1beta.Workflow + * @instance + */ + Workflow.prototype.name = ""; - /** - * Verifies a PhpSettings message. - * @function verify - * @memberof google.api.PhpSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PhpSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - return null; - }; + /** + * Workflow description. + * @member {string} description + * @memberof google.cloud.workflows.v1beta.Workflow + * @instance + */ + Workflow.prototype.description = ""; - /** - * Creates a PhpSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.PhpSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.PhpSettings} PhpSettings - */ - PhpSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.PhpSettings) - return object; - var message = new $root.google.api.PhpSettings(); - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.PhpSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - return message; - }; + /** + * Workflow state. + * @member {google.cloud.workflows.v1beta.Workflow.State} state + * @memberof google.cloud.workflows.v1beta.Workflow + * @instance + */ + Workflow.prototype.state = 0; - /** - * Creates a plain object from a PhpSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.PhpSettings - * @static - * @param {google.api.PhpSettings} message PhpSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PhpSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - return object; - }; + /** + * Workflow revisionId. + * @member {string} revisionId + * @memberof google.cloud.workflows.v1beta.Workflow + * @instance + */ + Workflow.prototype.revisionId = ""; - /** - * Converts this PhpSettings to JSON. - * @function toJSON - * @memberof google.api.PhpSettings - * @instance - * @returns {Object.} JSON object - */ - PhpSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Workflow createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.workflows.v1beta.Workflow + * @instance + */ + Workflow.prototype.createTime = null; - /** - * Gets the default type url for PhpSettings - * @function getTypeUrl - * @memberof google.api.PhpSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PhpSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.PhpSettings"; - }; + /** + * Workflow updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.workflows.v1beta.Workflow + * @instance + */ + Workflow.prototype.updateTime = null; - return PhpSettings; - })(); + /** + * Workflow revisionCreateTime. + * @member {google.protobuf.ITimestamp|null|undefined} revisionCreateTime + * @memberof google.cloud.workflows.v1beta.Workflow + * @instance + */ + Workflow.prototype.revisionCreateTime = null; - api.PythonSettings = (function() { + /** + * Workflow labels. + * @member {Object.} labels + * @memberof google.cloud.workflows.v1beta.Workflow + * @instance + */ + Workflow.prototype.labels = $util.emptyObject; - /** - * Properties of a PythonSettings. - * @memberof google.api - * @interface IPythonSettings - * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common - */ + /** + * Workflow serviceAccount. + * @member {string} serviceAccount + * @memberof google.cloud.workflows.v1beta.Workflow + * @instance + */ + Workflow.prototype.serviceAccount = ""; - /** - * Constructs a new PythonSettings. - * @memberof google.api - * @classdesc Represents a PythonSettings. - * @implements IPythonSettings - * @constructor - * @param {google.api.IPythonSettings=} [properties] Properties to set - */ - function PythonSettings(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]]; - } + /** + * Workflow sourceContents. + * @member {string|null|undefined} sourceContents + * @memberof google.cloud.workflows.v1beta.Workflow + * @instance + */ + Workflow.prototype.sourceContents = null; - /** - * PythonSettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.PythonSettings - * @instance - */ - PythonSettings.prototype.common = null; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; - /** - * Creates a new PythonSettings instance using the specified properties. - * @function create - * @memberof google.api.PythonSettings - * @static - * @param {google.api.IPythonSettings=} [properties] Properties to set - * @returns {google.api.PythonSettings} PythonSettings instance - */ - PythonSettings.create = function create(properties) { - return new PythonSettings(properties); - }; + /** + * Workflow sourceCode. + * @member {"sourceContents"|undefined} sourceCode + * @memberof google.cloud.workflows.v1beta.Workflow + * @instance + */ + Object.defineProperty(Workflow.prototype, "sourceCode", { + get: $util.oneOfGetter($oneOfFields = ["sourceContents"]), + set: $util.oneOfSetter($oneOfFields) + }); - /** - * Encodes the specified PythonSettings message. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. - * @function encode - * @memberof google.api.PythonSettings - * @static - * @param {google.api.IPythonSettings} message PythonSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PythonSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * Creates a new Workflow instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1beta.Workflow + * @static + * @param {google.cloud.workflows.v1beta.IWorkflow=} [properties] Properties to set + * @returns {google.cloud.workflows.v1beta.Workflow} Workflow instance + */ + Workflow.create = function create(properties) { + return new Workflow(properties); + }; - /** - * Encodes the specified PythonSettings message, length delimited. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.PythonSettings - * @static - * @param {google.api.IPythonSettings} message PythonSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PythonSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified Workflow message. Does not implicitly {@link google.cloud.workflows.v1beta.Workflow.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1beta.Workflow + * @static + * @param {google.cloud.workflows.v1beta.IWorkflow} message Workflow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Workflow.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); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.revisionId != null && Object.hasOwnProperty.call(message, "revisionId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.revisionId); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.revisionCreateTime != null && Object.hasOwnProperty.call(message, "revisionCreateTime")) + $root.google.protobuf.Timestamp.encode(message.revisionCreateTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.serviceAccount != null && Object.hasOwnProperty.call(message, "serviceAccount")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.serviceAccount); + if (message.sourceContents != null && Object.hasOwnProperty.call(message, "sourceContents")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.sourceContents); + return writer; + }; - /** - * Decodes a PythonSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.PythonSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.PythonSettings} PythonSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PythonSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; + /** + * Encodes the specified Workflow message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.Workflow.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1beta.Workflow + * @static + * @param {google.cloud.workflows.v1beta.IWorkflow} message Workflow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Workflow.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Workflow message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1beta.Workflow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1beta.Workflow} Workflow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Workflow.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1beta.Workflow(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.state = reader.int32(); + break; + } + case 4: { + message.revisionId = reader.string(); + break; + } + case 5: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.revisionCreateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + case 9: { + message.serviceAccount = reader.string(); + break; + } + case 10: { + message.sourceContents = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + return message; + }; - /** - * Decodes a PythonSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.PythonSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.PythonSettings} PythonSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PythonSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a Workflow message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1beta.Workflow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1beta.Workflow} Workflow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Workflow.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a PythonSettings message. - * @function verify - * @memberof google.api.PythonSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PythonSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - return null; - }; + /** + * Verifies a Workflow message. + * @function verify + * @memberof google.cloud.workflows.v1beta.Workflow + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Workflow.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + break; + } + if (message.revisionId != null && message.hasOwnProperty("revisionId")) + if (!$util.isString(message.revisionId)) + return "revisionId: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.revisionCreateTime != null && message.hasOwnProperty("revisionCreateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.revisionCreateTime); + if (error) + return "revisionCreateTime." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.serviceAccount != null && message.hasOwnProperty("serviceAccount")) + if (!$util.isString(message.serviceAccount)) + return "serviceAccount: string expected"; + if (message.sourceContents != null && message.hasOwnProperty("sourceContents")) { + properties.sourceCode = 1; + if (!$util.isString(message.sourceContents)) + return "sourceContents: string expected"; + } + return null; + }; - /** - * Creates a PythonSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.PythonSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.PythonSettings} PythonSettings - */ - PythonSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.PythonSettings) - return object; - var message = new $root.google.api.PythonSettings(); - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.PythonSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - return message; - }; + /** + * Creates a Workflow message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1beta.Workflow + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1beta.Workflow} Workflow + */ + Workflow.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1beta.Workflow) + return object; + var message = new $root.google.cloud.workflows.v1beta.Workflow(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ACTIVE": + case 1: + message.state = 1; + break; + } + if (object.revisionId != null) + message.revisionId = String(object.revisionId); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.workflows.v1beta.Workflow.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.workflows.v1beta.Workflow.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.revisionCreateTime != null) { + if (typeof object.revisionCreateTime !== "object") + throw TypeError(".google.cloud.workflows.v1beta.Workflow.revisionCreateTime: object expected"); + message.revisionCreateTime = $root.google.protobuf.Timestamp.fromObject(object.revisionCreateTime); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.cloud.workflows.v1beta.Workflow.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.serviceAccount != null) + message.serviceAccount = String(object.serviceAccount); + if (object.sourceContents != null) + message.sourceContents = String(object.sourceContents); + return message; + }; - /** - * Creates a plain object from a PythonSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.PythonSettings - * @static - * @param {google.api.PythonSettings} message PythonSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PythonSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - return object; - }; + /** + * Creates a plain object from a Workflow message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1beta.Workflow + * @static + * @param {google.cloud.workflows.v1beta.Workflow} message Workflow + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Workflow.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.revisionId = ""; + object.createTime = null; + object.updateTime = null; + object.revisionCreateTime = null; + object.serviceAccount = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.workflows.v1beta.Workflow.State[message.state] === undefined ? message.state : $root.google.cloud.workflows.v1beta.Workflow.State[message.state] : message.state; + if (message.revisionId != null && message.hasOwnProperty("revisionId")) + object.revisionId = message.revisionId; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.revisionCreateTime != null && message.hasOwnProperty("revisionCreateTime")) + object.revisionCreateTime = $root.google.protobuf.Timestamp.toObject(message.revisionCreateTime, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.serviceAccount != null && message.hasOwnProperty("serviceAccount")) + object.serviceAccount = message.serviceAccount; + if (message.sourceContents != null && message.hasOwnProperty("sourceContents")) { + object.sourceContents = message.sourceContents; + if (options.oneofs) + object.sourceCode = "sourceContents"; + } + return object; + }; - /** - * Converts this PythonSettings to JSON. - * @function toJSON - * @memberof google.api.PythonSettings - * @instance - * @returns {Object.} JSON object - */ - PythonSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this Workflow to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1beta.Workflow + * @instance + * @returns {Object.} JSON object + */ + Workflow.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Gets the default type url for PythonSettings - * @function getTypeUrl - * @memberof google.api.PythonSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PythonSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.PythonSettings"; - }; + /** + * Gets the default type url for Workflow + * @function getTypeUrl + * @memberof google.cloud.workflows.v1beta.Workflow + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Workflow.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1beta.Workflow"; + }; - return PythonSettings; - })(); + /** + * State enum. + * @name google.cloud.workflows.v1beta.Workflow.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ACTIVE=1 ACTIVE value + */ + Workflow.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACTIVE"] = 1; + return values; + })(); - api.NodeSettings = (function() { + return Workflow; + })(); - /** - * Properties of a NodeSettings. - * @memberof google.api - * @interface INodeSettings - * @property {google.api.ICommonLanguageSettings|null} [common] NodeSettings common - */ + v1beta.ListWorkflowsRequest = (function() { - /** - * Constructs a new NodeSettings. - * @memberof google.api - * @classdesc Represents a NodeSettings. - * @implements INodeSettings - * @constructor - * @param {google.api.INodeSettings=} [properties] Properties to set - */ - function NodeSettings(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]]; - } + /** + * Properties of a ListWorkflowsRequest. + * @memberof google.cloud.workflows.v1beta + * @interface IListWorkflowsRequest + * @property {string|null} [parent] ListWorkflowsRequest parent + * @property {number|null} [pageSize] ListWorkflowsRequest pageSize + * @property {string|null} [pageToken] ListWorkflowsRequest pageToken + * @property {string|null} [filter] ListWorkflowsRequest filter + * @property {string|null} [orderBy] ListWorkflowsRequest orderBy + */ - /** - * NodeSettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.NodeSettings - * @instance - */ - NodeSettings.prototype.common = null; + /** + * Constructs a new ListWorkflowsRequest. + * @memberof google.cloud.workflows.v1beta + * @classdesc Represents a ListWorkflowsRequest. + * @implements IListWorkflowsRequest + * @constructor + * @param {google.cloud.workflows.v1beta.IListWorkflowsRequest=} [properties] Properties to set + */ + function ListWorkflowsRequest(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]]; + } - /** - * Creates a new NodeSettings instance using the specified properties. - * @function create - * @memberof google.api.NodeSettings - * @static - * @param {google.api.INodeSettings=} [properties] Properties to set - * @returns {google.api.NodeSettings} NodeSettings instance - */ - NodeSettings.create = function create(properties) { - return new NodeSettings(properties); - }; + /** + * ListWorkflowsRequest parent. + * @member {string} parent + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @instance + */ + ListWorkflowsRequest.prototype.parent = ""; - /** - * Encodes the specified NodeSettings message. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. - * @function encode - * @memberof google.api.NodeSettings - * @static - * @param {google.api.INodeSettings} message NodeSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NodeSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * ListWorkflowsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @instance + */ + ListWorkflowsRequest.prototype.pageSize = 0; - /** - * Encodes the specified NodeSettings message, length delimited. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.NodeSettings - * @static - * @param {google.api.INodeSettings} message NodeSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NodeSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * ListWorkflowsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @instance + */ + ListWorkflowsRequest.prototype.pageToken = ""; - /** - * Decodes a NodeSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.NodeSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.NodeSettings} NodeSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NodeSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.NodeSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * ListWorkflowsRequest filter. + * @member {string} filter + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @instance + */ + ListWorkflowsRequest.prototype.filter = ""; - /** - * Decodes a NodeSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.NodeSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.NodeSettings} NodeSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NodeSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * ListWorkflowsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @instance + */ + ListWorkflowsRequest.prototype.orderBy = ""; - /** - * Verifies a NodeSettings message. - * @function verify - * @memberof google.api.NodeSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - NodeSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - return null; - }; + /** + * Creates a new ListWorkflowsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @static + * @param {google.cloud.workflows.v1beta.IListWorkflowsRequest=} [properties] Properties to set + * @returns {google.cloud.workflows.v1beta.ListWorkflowsRequest} ListWorkflowsRequest instance + */ + ListWorkflowsRequest.create = function create(properties) { + return new ListWorkflowsRequest(properties); + }; - /** - * Creates a NodeSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.NodeSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.NodeSettings} NodeSettings - */ - NodeSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.NodeSettings) - return object; - var message = new $root.google.api.NodeSettings(); - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.NodeSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - return message; - }; + /** + * Encodes the specified ListWorkflowsRequest message. Does not implicitly {@link google.cloud.workflows.v1beta.ListWorkflowsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @static + * @param {google.cloud.workflows.v1beta.IListWorkflowsRequest} message ListWorkflowsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWorkflowsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.orderBy); + return writer; + }; - /** - * Creates a plain object from a NodeSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.NodeSettings - * @static - * @param {google.api.NodeSettings} message NodeSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NodeSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - return object; - }; + /** + * Encodes the specified ListWorkflowsRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.ListWorkflowsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @static + * @param {google.cloud.workflows.v1beta.IListWorkflowsRequest} message ListWorkflowsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWorkflowsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Converts this NodeSettings to JSON. - * @function toJSON - * @memberof google.api.NodeSettings - * @instance - * @returns {Object.} JSON object - */ - NodeSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Decodes a ListWorkflowsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1beta.ListWorkflowsRequest} ListWorkflowsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWorkflowsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1beta.ListWorkflowsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Gets the default type url for NodeSettings - * @function getTypeUrl - * @memberof google.api.NodeSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - NodeSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.NodeSettings"; - }; + /** + * Decodes a ListWorkflowsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1beta.ListWorkflowsRequest} ListWorkflowsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWorkflowsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - return NodeSettings; - })(); + /** + * Verifies a ListWorkflowsRequest message. + * @function verify + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListWorkflowsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; - api.DotnetSettings = (function() { + /** + * Creates a ListWorkflowsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1beta.ListWorkflowsRequest} ListWorkflowsRequest + */ + ListWorkflowsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1beta.ListWorkflowsRequest) + return object; + var message = new $root.google.cloud.workflows.v1beta.ListWorkflowsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; - /** - * Properties of a DotnetSettings. - * @memberof google.api - * @interface IDotnetSettings - * @property {google.api.ICommonLanguageSettings|null} [common] DotnetSettings common - * @property {Object.|null} [renamedServices] DotnetSettings renamedServices - * @property {Object.|null} [renamedResources] DotnetSettings renamedResources - * @property {Array.|null} [ignoredResources] DotnetSettings ignoredResources - * @property {Array.|null} [forcedNamespaceAliases] DotnetSettings forcedNamespaceAliases - * @property {Array.|null} [handwrittenSignatures] DotnetSettings handwrittenSignatures - */ + /** + * Creates a plain object from a ListWorkflowsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @static + * @param {google.cloud.workflows.v1beta.ListWorkflowsRequest} message ListWorkflowsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListWorkflowsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; - /** - * Constructs a new DotnetSettings. - * @memberof google.api - * @classdesc Represents a DotnetSettings. - * @implements IDotnetSettings - * @constructor - * @param {google.api.IDotnetSettings=} [properties] Properties to set - */ - function DotnetSettings(properties) { - this.renamedServices = {}; - this.renamedResources = {}; - this.ignoredResources = []; - this.forcedNamespaceAliases = []; - this.handwrittenSignatures = []; - 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]]; - } + /** + * Converts this ListWorkflowsRequest to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @instance + * @returns {Object.} JSON object + */ + ListWorkflowsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * DotnetSettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.DotnetSettings - * @instance - */ - DotnetSettings.prototype.common = null; + /** + * Gets the default type url for ListWorkflowsRequest + * @function getTypeUrl + * @memberof google.cloud.workflows.v1beta.ListWorkflowsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListWorkflowsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1beta.ListWorkflowsRequest"; + }; - /** - * DotnetSettings renamedServices. - * @member {Object.} renamedServices - * @memberof google.api.DotnetSettings - * @instance - */ - DotnetSettings.prototype.renamedServices = $util.emptyObject; + return ListWorkflowsRequest; + })(); - /** - * DotnetSettings renamedResources. - * @member {Object.} renamedResources - * @memberof google.api.DotnetSettings - * @instance - */ - DotnetSettings.prototype.renamedResources = $util.emptyObject; + v1beta.ListWorkflowsResponse = (function() { - /** - * DotnetSettings ignoredResources. - * @member {Array.} ignoredResources - * @memberof google.api.DotnetSettings - * @instance - */ - DotnetSettings.prototype.ignoredResources = $util.emptyArray; + /** + * Properties of a ListWorkflowsResponse. + * @memberof google.cloud.workflows.v1beta + * @interface IListWorkflowsResponse + * @property {Array.|null} [workflows] ListWorkflowsResponse workflows + * @property {string|null} [nextPageToken] ListWorkflowsResponse nextPageToken + * @property {Array.|null} [unreachable] ListWorkflowsResponse unreachable + */ - /** - * DotnetSettings forcedNamespaceAliases. - * @member {Array.} forcedNamespaceAliases - * @memberof google.api.DotnetSettings - * @instance - */ - DotnetSettings.prototype.forcedNamespaceAliases = $util.emptyArray; + /** + * Constructs a new ListWorkflowsResponse. + * @memberof google.cloud.workflows.v1beta + * @classdesc Represents a ListWorkflowsResponse. + * @implements IListWorkflowsResponse + * @constructor + * @param {google.cloud.workflows.v1beta.IListWorkflowsResponse=} [properties] Properties to set + */ + function ListWorkflowsResponse(properties) { + this.workflows = []; + this.unreachable = []; + 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]]; + } - /** - * DotnetSettings handwrittenSignatures. - * @member {Array.} handwrittenSignatures - * @memberof google.api.DotnetSettings - * @instance - */ - DotnetSettings.prototype.handwrittenSignatures = $util.emptyArray; + /** + * ListWorkflowsResponse workflows. + * @member {Array.} workflows + * @memberof google.cloud.workflows.v1beta.ListWorkflowsResponse + * @instance + */ + ListWorkflowsResponse.prototype.workflows = $util.emptyArray; - /** - * Creates a new DotnetSettings instance using the specified properties. - * @function create - * @memberof google.api.DotnetSettings - * @static - * @param {google.api.IDotnetSettings=} [properties] Properties to set - * @returns {google.api.DotnetSettings} DotnetSettings instance - */ - DotnetSettings.create = function create(properties) { - return new DotnetSettings(properties); - }; + /** + * ListWorkflowsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.workflows.v1beta.ListWorkflowsResponse + * @instance + */ + ListWorkflowsResponse.prototype.nextPageToken = ""; - /** - * Encodes the specified DotnetSettings message. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. - * @function encode - * @memberof google.api.DotnetSettings - * @static - * @param {google.api.IDotnetSettings} message DotnetSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DotnetSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) - for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); - if (message.renamedResources != null && Object.hasOwnProperty.call(message, "renamedResources")) - for (var keys = Object.keys(message.renamedResources), i = 0; i < keys.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedResources[keys[i]]).ldelim(); - if (message.ignoredResources != null && message.ignoredResources.length) - for (var i = 0; i < message.ignoredResources.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.ignoredResources[i]); - if (message.forcedNamespaceAliases != null && message.forcedNamespaceAliases.length) - for (var i = 0; i < message.forcedNamespaceAliases.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.forcedNamespaceAliases[i]); - if (message.handwrittenSignatures != null && message.handwrittenSignatures.length) - for (var i = 0; i < message.handwrittenSignatures.length; ++i) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.handwrittenSignatures[i]); - return writer; - }; + /** + * ListWorkflowsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.workflows.v1beta.ListWorkflowsResponse + * @instance + */ + ListWorkflowsResponse.prototype.unreachable = $util.emptyArray; - /** - * Encodes the specified DotnetSettings message, length delimited. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.DotnetSettings - * @static - * @param {google.api.IDotnetSettings} message DotnetSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DotnetSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a new ListWorkflowsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1beta.ListWorkflowsResponse + * @static + * @param {google.cloud.workflows.v1beta.IListWorkflowsResponse=} [properties] Properties to set + * @returns {google.cloud.workflows.v1beta.ListWorkflowsResponse} ListWorkflowsResponse instance + */ + ListWorkflowsResponse.create = function create(properties) { + return new ListWorkflowsResponse(properties); + }; - /** - * Decodes a DotnetSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.DotnetSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.DotnetSettings} DotnetSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DotnetSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.DotnetSettings(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; - } - case 2: { - if (message.renamedServices === $util.emptyObject) - message.renamedServices = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); + /** + * Encodes the specified ListWorkflowsResponse message. Does not implicitly {@link google.cloud.workflows.v1beta.ListWorkflowsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1beta.ListWorkflowsResponse + * @static + * @param {google.cloud.workflows.v1beta.IListWorkflowsResponse} message ListWorkflowsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWorkflowsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.workflows != null && message.workflows.length) + for (var i = 0; i < message.workflows.length; ++i) + $root.google.cloud.workflows.v1beta.Workflow.encode(message.workflows[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListWorkflowsResponse message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.ListWorkflowsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1beta.ListWorkflowsResponse + * @static + * @param {google.cloud.workflows.v1beta.IListWorkflowsResponse} message ListWorkflowsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListWorkflowsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListWorkflowsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1beta.ListWorkflowsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1beta.ListWorkflowsResponse} ListWorkflowsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWorkflowsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1beta.ListWorkflowsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.workflows && message.workflows.length)) + message.workflows = []; + message.workflows.push($root.google.cloud.workflows.v1beta.Workflow.decode(reader, reader.uint32())); break; - case 2: - value = reader.string(); + } + case 2: { + message.nextPageToken = reader.string(); break; - default: - reader.skipType(tag2 & 7); + } + case 3: { + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); break; } + default: + reader.skipType(tag & 7); + break; } - message.renamedServices[key] = value; - break; } - case 3: { - if (message.renamedResources === $util.emptyObject) - message.renamedResources = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } + return message; + }; + + /** + * Decodes a ListWorkflowsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1beta.ListWorkflowsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1beta.ListWorkflowsResponse} ListWorkflowsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListWorkflowsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListWorkflowsResponse message. + * @function verify + * @memberof google.cloud.workflows.v1beta.ListWorkflowsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListWorkflowsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.workflows != null && message.hasOwnProperty("workflows")) { + if (!Array.isArray(message.workflows)) + return "workflows: array expected"; + for (var i = 0; i < message.workflows.length; ++i) { + var error = $root.google.cloud.workflows.v1beta.Workflow.verify(message.workflows[i]); + if (error) + return "workflows." + error; } - message.renamedResources[key] = value; - break; } - case 4: { - if (!(message.ignoredResources && message.ignoredResources.length)) - message.ignoredResources = []; - message.ignoredResources.push(reader.string()); - break; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; } - case 5: { - if (!(message.forcedNamespaceAliases && message.forcedNamespaceAliases.length)) - message.forcedNamespaceAliases = []; - message.forcedNamespaceAliases.push(reader.string()); - break; + return null; + }; + + /** + * Creates a ListWorkflowsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1beta.ListWorkflowsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1beta.ListWorkflowsResponse} ListWorkflowsResponse + */ + ListWorkflowsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1beta.ListWorkflowsResponse) + return object; + var message = new $root.google.cloud.workflows.v1beta.ListWorkflowsResponse(); + if (object.workflows) { + if (!Array.isArray(object.workflows)) + throw TypeError(".google.cloud.workflows.v1beta.ListWorkflowsResponse.workflows: array expected"); + message.workflows = []; + for (var i = 0; i < object.workflows.length; ++i) { + if (typeof object.workflows[i] !== "object") + throw TypeError(".google.cloud.workflows.v1beta.ListWorkflowsResponse.workflows: object expected"); + message.workflows[i] = $root.google.cloud.workflows.v1beta.Workflow.fromObject(object.workflows[i]); + } } - case 6: { - if (!(message.handwrittenSignatures && message.handwrittenSignatures.length)) - message.handwrittenSignatures = []; - message.handwrittenSignatures.push(reader.string()); - break; + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.workflows.v1beta.ListWorkflowsResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DotnetSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.DotnetSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.DotnetSettings} DotnetSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DotnetSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return message; + }; - /** - * Verifies a DotnetSettings message. - * @function verify - * @memberof google.api.DotnetSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DotnetSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { - if (!$util.isObject(message.renamedServices)) - return "renamedServices: object expected"; - var key = Object.keys(message.renamedServices); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.renamedServices[key[i]])) - return "renamedServices: string{k:string} expected"; - } - if (message.renamedResources != null && message.hasOwnProperty("renamedResources")) { - if (!$util.isObject(message.renamedResources)) - return "renamedResources: object expected"; - var key = Object.keys(message.renamedResources); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.renamedResources[key[i]])) - return "renamedResources: string{k:string} expected"; - } - if (message.ignoredResources != null && message.hasOwnProperty("ignoredResources")) { - if (!Array.isArray(message.ignoredResources)) - return "ignoredResources: array expected"; - for (var i = 0; i < message.ignoredResources.length; ++i) - if (!$util.isString(message.ignoredResources[i])) - return "ignoredResources: string[] expected"; - } - if (message.forcedNamespaceAliases != null && message.hasOwnProperty("forcedNamespaceAliases")) { - if (!Array.isArray(message.forcedNamespaceAliases)) - return "forcedNamespaceAliases: array expected"; - for (var i = 0; i < message.forcedNamespaceAliases.length; ++i) - if (!$util.isString(message.forcedNamespaceAliases[i])) - return "forcedNamespaceAliases: string[] expected"; - } - if (message.handwrittenSignatures != null && message.hasOwnProperty("handwrittenSignatures")) { - if (!Array.isArray(message.handwrittenSignatures)) - return "handwrittenSignatures: array expected"; - for (var i = 0; i < message.handwrittenSignatures.length; ++i) - if (!$util.isString(message.handwrittenSignatures[i])) - return "handwrittenSignatures: string[] expected"; - } - return null; - }; + /** + * Creates a plain object from a ListWorkflowsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1beta.ListWorkflowsResponse + * @static + * @param {google.cloud.workflows.v1beta.ListWorkflowsResponse} message ListWorkflowsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListWorkflowsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.workflows = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.workflows && message.workflows.length) { + object.workflows = []; + for (var j = 0; j < message.workflows.length; ++j) + object.workflows[j] = $root.google.cloud.workflows.v1beta.Workflow.toObject(message.workflows[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; - /** - * Creates a DotnetSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.DotnetSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.DotnetSettings} DotnetSettings - */ - DotnetSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.DotnetSettings) - return object; - var message = new $root.google.api.DotnetSettings(); - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.DotnetSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - if (object.renamedServices) { - if (typeof object.renamedServices !== "object") - throw TypeError(".google.api.DotnetSettings.renamedServices: object expected"); - message.renamedServices = {}; - for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) - message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); - } - if (object.renamedResources) { - if (typeof object.renamedResources !== "object") - throw TypeError(".google.api.DotnetSettings.renamedResources: object expected"); - message.renamedResources = {}; - for (var keys = Object.keys(object.renamedResources), i = 0; i < keys.length; ++i) - message.renamedResources[keys[i]] = String(object.renamedResources[keys[i]]); - } - if (object.ignoredResources) { - if (!Array.isArray(object.ignoredResources)) - throw TypeError(".google.api.DotnetSettings.ignoredResources: array expected"); - message.ignoredResources = []; - for (var i = 0; i < object.ignoredResources.length; ++i) - message.ignoredResources[i] = String(object.ignoredResources[i]); - } - if (object.forcedNamespaceAliases) { - if (!Array.isArray(object.forcedNamespaceAliases)) - throw TypeError(".google.api.DotnetSettings.forcedNamespaceAliases: array expected"); - message.forcedNamespaceAliases = []; - for (var i = 0; i < object.forcedNamespaceAliases.length; ++i) - message.forcedNamespaceAliases[i] = String(object.forcedNamespaceAliases[i]); - } - if (object.handwrittenSignatures) { - if (!Array.isArray(object.handwrittenSignatures)) - throw TypeError(".google.api.DotnetSettings.handwrittenSignatures: array expected"); - message.handwrittenSignatures = []; - for (var i = 0; i < object.handwrittenSignatures.length; ++i) - message.handwrittenSignatures[i] = String(object.handwrittenSignatures[i]); - } - return message; - }; + /** + * Converts this ListWorkflowsResponse to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1beta.ListWorkflowsResponse + * @instance + * @returns {Object.} JSON object + */ + ListWorkflowsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a plain object from a DotnetSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.DotnetSettings - * @static - * @param {google.api.DotnetSettings} message DotnetSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DotnetSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.ignoredResources = []; - object.forcedNamespaceAliases = []; - object.handwrittenSignatures = []; - } - if (options.objects || options.defaults) { - object.renamedServices = {}; - object.renamedResources = {}; - } - if (options.defaults) - object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - var keys2; - if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { - object.renamedServices = {}; - for (var j = 0; j < keys2.length; ++j) - object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; - } - if (message.renamedResources && (keys2 = Object.keys(message.renamedResources)).length) { - object.renamedResources = {}; - for (var j = 0; j < keys2.length; ++j) - object.renamedResources[keys2[j]] = message.renamedResources[keys2[j]]; - } - if (message.ignoredResources && message.ignoredResources.length) { - object.ignoredResources = []; - for (var j = 0; j < message.ignoredResources.length; ++j) - object.ignoredResources[j] = message.ignoredResources[j]; - } - if (message.forcedNamespaceAliases && message.forcedNamespaceAliases.length) { - object.forcedNamespaceAliases = []; - for (var j = 0; j < message.forcedNamespaceAliases.length; ++j) - object.forcedNamespaceAliases[j] = message.forcedNamespaceAliases[j]; - } - if (message.handwrittenSignatures && message.handwrittenSignatures.length) { - object.handwrittenSignatures = []; - for (var j = 0; j < message.handwrittenSignatures.length; ++j) - object.handwrittenSignatures[j] = message.handwrittenSignatures[j]; - } - return object; - }; + /** + * Gets the default type url for ListWorkflowsResponse + * @function getTypeUrl + * @memberof google.cloud.workflows.v1beta.ListWorkflowsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListWorkflowsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1beta.ListWorkflowsResponse"; + }; - /** - * Converts this DotnetSettings to JSON. - * @function toJSON - * @memberof google.api.DotnetSettings - * @instance - * @returns {Object.} JSON object - */ - DotnetSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return ListWorkflowsResponse; + })(); - /** - * Gets the default type url for DotnetSettings - * @function getTypeUrl - * @memberof google.api.DotnetSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DotnetSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.DotnetSettings"; - }; + v1beta.GetWorkflowRequest = (function() { - return DotnetSettings; - })(); + /** + * Properties of a GetWorkflowRequest. + * @memberof google.cloud.workflows.v1beta + * @interface IGetWorkflowRequest + * @property {string|null} [name] GetWorkflowRequest name + */ - api.RubySettings = (function() { + /** + * Constructs a new GetWorkflowRequest. + * @memberof google.cloud.workflows.v1beta + * @classdesc Represents a GetWorkflowRequest. + * @implements IGetWorkflowRequest + * @constructor + * @param {google.cloud.workflows.v1beta.IGetWorkflowRequest=} [properties] Properties to set + */ + function GetWorkflowRequest(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]]; + } - /** - * Properties of a RubySettings. - * @memberof google.api - * @interface IRubySettings - * @property {google.api.ICommonLanguageSettings|null} [common] RubySettings common - */ + /** + * GetWorkflowRequest name. + * @member {string} name + * @memberof google.cloud.workflows.v1beta.GetWorkflowRequest + * @instance + */ + GetWorkflowRequest.prototype.name = ""; - /** - * Constructs a new RubySettings. - * @memberof google.api - * @classdesc Represents a RubySettings. - * @implements IRubySettings - * @constructor - * @param {google.api.IRubySettings=} [properties] Properties to set - */ - function RubySettings(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]]; - } + /** + * Creates a new GetWorkflowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1beta.GetWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.IGetWorkflowRequest=} [properties] Properties to set + * @returns {google.cloud.workflows.v1beta.GetWorkflowRequest} GetWorkflowRequest instance + */ + GetWorkflowRequest.create = function create(properties) { + return new GetWorkflowRequest(properties); + }; - /** - * RubySettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.RubySettings - * @instance - */ - RubySettings.prototype.common = null; + /** + * Encodes the specified GetWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1beta.GetWorkflowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1beta.GetWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.IGetWorkflowRequest} message GetWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetWorkflowRequest.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; + }; - /** - * Creates a new RubySettings instance using the specified properties. - * @function create - * @memberof google.api.RubySettings - * @static - * @param {google.api.IRubySettings=} [properties] Properties to set - * @returns {google.api.RubySettings} RubySettings instance - */ - RubySettings.create = function create(properties) { - return new RubySettings(properties); - }; + /** + * Encodes the specified GetWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.GetWorkflowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1beta.GetWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.IGetWorkflowRequest} message GetWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetWorkflowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Encodes the specified RubySettings message. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. - * @function encode - * @memberof google.api.RubySettings - * @static - * @param {google.api.IRubySettings} message RubySettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RubySettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * Decodes a GetWorkflowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1beta.GetWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1beta.GetWorkflowRequest} GetWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetWorkflowRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1beta.GetWorkflowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified RubySettings message, length delimited. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.RubySettings - * @static - * @param {google.api.IRubySettings} message RubySettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RubySettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Decodes a GetWorkflowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1beta.GetWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1beta.GetWorkflowRequest} GetWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetWorkflowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Decodes a RubySettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.RubySettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.RubySettings} RubySettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RubySettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.RubySettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Verifies a GetWorkflowRequest message. + * @function verify + * @memberof google.cloud.workflows.v1beta.GetWorkflowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetWorkflowRequest.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; + }; - /** - * Decodes a RubySettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.RubySettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.RubySettings} RubySettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RubySettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates a GetWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1beta.GetWorkflowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1beta.GetWorkflowRequest} GetWorkflowRequest + */ + GetWorkflowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1beta.GetWorkflowRequest) + return object; + var message = new $root.google.cloud.workflows.v1beta.GetWorkflowRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; - /** - * Verifies a RubySettings message. - * @function verify - * @memberof google.api.RubySettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RubySettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - return null; - }; + /** + * Creates a plain object from a GetWorkflowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1beta.GetWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.GetWorkflowRequest} message GetWorkflowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetWorkflowRequest.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; + }; - /** - * Creates a RubySettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.RubySettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.RubySettings} RubySettings - */ - RubySettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.RubySettings) - return object; - var message = new $root.google.api.RubySettings(); - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.RubySettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - return message; - }; + /** + * Converts this GetWorkflowRequest to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1beta.GetWorkflowRequest + * @instance + * @returns {Object.} JSON object + */ + GetWorkflowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Creates a plain object from a RubySettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.RubySettings - * @static - * @param {google.api.RubySettings} message RubySettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RubySettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - return object; - }; + /** + * Gets the default type url for GetWorkflowRequest + * @function getTypeUrl + * @memberof google.cloud.workflows.v1beta.GetWorkflowRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetWorkflowRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1beta.GetWorkflowRequest"; + }; - /** - * Converts this RubySettings to JSON. - * @function toJSON - * @memberof google.api.RubySettings - * @instance - * @returns {Object.} JSON object - */ - RubySettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return GetWorkflowRequest; + })(); - /** - * Gets the default type url for RubySettings - * @function getTypeUrl - * @memberof google.api.RubySettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RubySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.RubySettings"; - }; + v1beta.CreateWorkflowRequest = (function() { - return RubySettings; - })(); + /** + * Properties of a CreateWorkflowRequest. + * @memberof google.cloud.workflows.v1beta + * @interface ICreateWorkflowRequest + * @property {string|null} [parent] CreateWorkflowRequest parent + * @property {google.cloud.workflows.v1beta.IWorkflow|null} [workflow] CreateWorkflowRequest workflow + * @property {string|null} [workflowId] CreateWorkflowRequest workflowId + */ - api.GoSettings = (function() { + /** + * Constructs a new CreateWorkflowRequest. + * @memberof google.cloud.workflows.v1beta + * @classdesc Represents a CreateWorkflowRequest. + * @implements ICreateWorkflowRequest + * @constructor + * @param {google.cloud.workflows.v1beta.ICreateWorkflowRequest=} [properties] Properties to set + */ + function CreateWorkflowRequest(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]]; + } - /** - * Properties of a GoSettings. - * @memberof google.api - * @interface IGoSettings - * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common - */ + /** + * CreateWorkflowRequest parent. + * @member {string} parent + * @memberof google.cloud.workflows.v1beta.CreateWorkflowRequest + * @instance + */ + CreateWorkflowRequest.prototype.parent = ""; - /** - * Constructs a new GoSettings. - * @memberof google.api - * @classdesc Represents a GoSettings. - * @implements IGoSettings - * @constructor - * @param {google.api.IGoSettings=} [properties] Properties to set - */ - function GoSettings(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]]; - } + /** + * CreateWorkflowRequest workflow. + * @member {google.cloud.workflows.v1beta.IWorkflow|null|undefined} workflow + * @memberof google.cloud.workflows.v1beta.CreateWorkflowRequest + * @instance + */ + CreateWorkflowRequest.prototype.workflow = null; - /** - * GoSettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.GoSettings - * @instance - */ - GoSettings.prototype.common = null; + /** + * CreateWorkflowRequest workflowId. + * @member {string} workflowId + * @memberof google.cloud.workflows.v1beta.CreateWorkflowRequest + * @instance + */ + CreateWorkflowRequest.prototype.workflowId = ""; - /** - * Creates a new GoSettings instance using the specified properties. - * @function create - * @memberof google.api.GoSettings - * @static - * @param {google.api.IGoSettings=} [properties] Properties to set - * @returns {google.api.GoSettings} GoSettings instance - */ - GoSettings.create = function create(properties) { - return new GoSettings(properties); - }; + /** + * Creates a new CreateWorkflowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1beta.CreateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.ICreateWorkflowRequest=} [properties] Properties to set + * @returns {google.cloud.workflows.v1beta.CreateWorkflowRequest} CreateWorkflowRequest instance + */ + CreateWorkflowRequest.create = function create(properties) { + return new CreateWorkflowRequest(properties); + }; - /** - * Encodes the specified GoSettings message. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. - * @function encode - * @memberof google.api.GoSettings - * @static - * @param {google.api.IGoSettings} message GoSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GoSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + /** + * Encodes the specified CreateWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1beta.CreateWorkflowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1beta.CreateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.ICreateWorkflowRequest} message CreateWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateWorkflowRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.workflow != null && Object.hasOwnProperty.call(message, "workflow")) + $root.google.cloud.workflows.v1beta.Workflow.encode(message.workflow, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.workflowId != null && Object.hasOwnProperty.call(message, "workflowId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.workflowId); + return writer; + }; - /** - * Encodes the specified GoSettings message, length delimited. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.GoSettings - * @static - * @param {google.api.IGoSettings} message GoSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GoSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified CreateWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.CreateWorkflowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1beta.CreateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.ICreateWorkflowRequest} message CreateWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateWorkflowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a GoSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.GoSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.GoSettings} GoSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GoSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; + /** + * Decodes a CreateWorkflowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1beta.CreateWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1beta.CreateWorkflowRequest} CreateWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateWorkflowRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1beta.CreateWorkflowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.workflow = $root.google.cloud.workflows.v1beta.Workflow.decode(reader, reader.uint32()); + break; + } + case 3: { + message.workflowId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GoSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.GoSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.GoSettings} GoSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GoSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return message; + }; - /** - * Verifies a GoSettings message. - * @function verify - * @memberof google.api.GoSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GoSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - return null; - }; + /** + * Decodes a CreateWorkflowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1beta.CreateWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1beta.CreateWorkflowRequest} CreateWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateWorkflowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a GoSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.GoSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.GoSettings} GoSettings - */ - GoSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.GoSettings) - return object; - var message = new $root.google.api.GoSettings(); - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.GoSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - return message; - }; + /** + * Verifies a CreateWorkflowRequest message. + * @function verify + * @memberof google.cloud.workflows.v1beta.CreateWorkflowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateWorkflowRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.workflow != null && message.hasOwnProperty("workflow")) { + var error = $root.google.cloud.workflows.v1beta.Workflow.verify(message.workflow); + if (error) + return "workflow." + error; + } + if (message.workflowId != null && message.hasOwnProperty("workflowId")) + if (!$util.isString(message.workflowId)) + return "workflowId: string expected"; + return null; + }; - /** - * Creates a plain object from a GoSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.GoSettings - * @static - * @param {google.api.GoSettings} message GoSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GoSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - return object; - }; + /** + * Creates a CreateWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1beta.CreateWorkflowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1beta.CreateWorkflowRequest} CreateWorkflowRequest + */ + CreateWorkflowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1beta.CreateWorkflowRequest) + return object; + var message = new $root.google.cloud.workflows.v1beta.CreateWorkflowRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.workflow != null) { + if (typeof object.workflow !== "object") + throw TypeError(".google.cloud.workflows.v1beta.CreateWorkflowRequest.workflow: object expected"); + message.workflow = $root.google.cloud.workflows.v1beta.Workflow.fromObject(object.workflow); + } + if (object.workflowId != null) + message.workflowId = String(object.workflowId); + return message; + }; - /** - * Converts this GoSettings to JSON. - * @function toJSON - * @memberof google.api.GoSettings - * @instance - * @returns {Object.} JSON object - */ - GoSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a CreateWorkflowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1beta.CreateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.CreateWorkflowRequest} message CreateWorkflowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateWorkflowRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.workflow = null; + object.workflowId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.workflow != null && message.hasOwnProperty("workflow")) + object.workflow = $root.google.cloud.workflows.v1beta.Workflow.toObject(message.workflow, options); + if (message.workflowId != null && message.hasOwnProperty("workflowId")) + object.workflowId = message.workflowId; + return object; + }; - /** - * Gets the default type url for GoSettings - * @function getTypeUrl - * @memberof google.api.GoSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GoSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.GoSettings"; - }; + /** + * Converts this CreateWorkflowRequest to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1beta.CreateWorkflowRequest + * @instance + * @returns {Object.} JSON object + */ + CreateWorkflowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return GoSettings; - })(); + /** + * Gets the default type url for CreateWorkflowRequest + * @function getTypeUrl + * @memberof google.cloud.workflows.v1beta.CreateWorkflowRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateWorkflowRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1beta.CreateWorkflowRequest"; + }; - api.MethodSettings = (function() { + return CreateWorkflowRequest; + })(); - /** - * Properties of a MethodSettings. - * @memberof google.api - * @interface IMethodSettings - * @property {string|null} [selector] MethodSettings selector - * @property {google.api.MethodSettings.ILongRunning|null} [longRunning] MethodSettings longRunning - * @property {Array.|null} [autoPopulatedFields] MethodSettings autoPopulatedFields - */ + v1beta.DeleteWorkflowRequest = (function() { - /** - * Constructs a new MethodSettings. - * @memberof google.api - * @classdesc Represents a MethodSettings. - * @implements IMethodSettings - * @constructor - * @param {google.api.IMethodSettings=} [properties] Properties to set - */ - function MethodSettings(properties) { - this.autoPopulatedFields = []; - 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]]; - } + /** + * Properties of a DeleteWorkflowRequest. + * @memberof google.cloud.workflows.v1beta + * @interface IDeleteWorkflowRequest + * @property {string|null} [name] DeleteWorkflowRequest name + */ - /** - * MethodSettings selector. - * @member {string} selector - * @memberof google.api.MethodSettings - * @instance - */ - MethodSettings.prototype.selector = ""; + /** + * Constructs a new DeleteWorkflowRequest. + * @memberof google.cloud.workflows.v1beta + * @classdesc Represents a DeleteWorkflowRequest. + * @implements IDeleteWorkflowRequest + * @constructor + * @param {google.cloud.workflows.v1beta.IDeleteWorkflowRequest=} [properties] Properties to set + */ + function DeleteWorkflowRequest(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]]; + } - /** - * MethodSettings longRunning. - * @member {google.api.MethodSettings.ILongRunning|null|undefined} longRunning - * @memberof google.api.MethodSettings - * @instance - */ - MethodSettings.prototype.longRunning = null; + /** + * DeleteWorkflowRequest name. + * @member {string} name + * @memberof google.cloud.workflows.v1beta.DeleteWorkflowRequest + * @instance + */ + DeleteWorkflowRequest.prototype.name = ""; - /** - * MethodSettings autoPopulatedFields. - * @member {Array.} autoPopulatedFields - * @memberof google.api.MethodSettings - * @instance - */ - MethodSettings.prototype.autoPopulatedFields = $util.emptyArray; + /** + * Creates a new DeleteWorkflowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1beta.DeleteWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.IDeleteWorkflowRequest=} [properties] Properties to set + * @returns {google.cloud.workflows.v1beta.DeleteWorkflowRequest} DeleteWorkflowRequest instance + */ + DeleteWorkflowRequest.create = function create(properties) { + return new DeleteWorkflowRequest(properties); + }; - /** - * Creates a new MethodSettings instance using the specified properties. - * @function create - * @memberof google.api.MethodSettings - * @static - * @param {google.api.IMethodSettings=} [properties] Properties to set - * @returns {google.api.MethodSettings} MethodSettings instance - */ - MethodSettings.create = function create(properties) { - return new MethodSettings(properties); - }; + /** + * Encodes the specified DeleteWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1beta.DeleteWorkflowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1beta.DeleteWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.IDeleteWorkflowRequest} message DeleteWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteWorkflowRequest.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 MethodSettings message. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. - * @function encode - * @memberof google.api.MethodSettings - * @static - * @param {google.api.IMethodSettings} message MethodSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); - if (message.longRunning != null && Object.hasOwnProperty.call(message, "longRunning")) - $root.google.api.MethodSettings.LongRunning.encode(message.longRunning, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.autoPopulatedFields != null && message.autoPopulatedFields.length) - for (var i = 0; i < message.autoPopulatedFields.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.autoPopulatedFields[i]); - return writer; - }; + /** + * Encodes the specified DeleteWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.DeleteWorkflowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1beta.DeleteWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.IDeleteWorkflowRequest} message DeleteWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteWorkflowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Encodes the specified MethodSettings message, length delimited. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.MethodSettings - * @static - * @param {google.api.IMethodSettings} message MethodSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MethodSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.MethodSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.MethodSettings} MethodSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MethodSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.selector = reader.string(); - break; - } - case 2: { - message.longRunning = $root.google.api.MethodSettings.LongRunning.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.autoPopulatedFields && message.autoPopulatedFields.length)) - message.autoPopulatedFields = []; - message.autoPopulatedFields.push(reader.string()); - break; + /** + * Decodes a DeleteWorkflowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1beta.DeleteWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1beta.DeleteWorkflowRequest} DeleteWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteWorkflowRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1beta.DeleteWorkflowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + return message; + }; - /** - * Decodes a MethodSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.MethodSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.MethodSettings} MethodSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a DeleteWorkflowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1beta.DeleteWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1beta.DeleteWorkflowRequest} DeleteWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteWorkflowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a MethodSettings message. - * @function verify - * @memberof google.api.MethodSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MethodSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.selector != null && message.hasOwnProperty("selector")) - if (!$util.isString(message.selector)) - return "selector: string expected"; - if (message.longRunning != null && message.hasOwnProperty("longRunning")) { - var error = $root.google.api.MethodSettings.LongRunning.verify(message.longRunning); - if (error) - return "longRunning." + error; - } - if (message.autoPopulatedFields != null && message.hasOwnProperty("autoPopulatedFields")) { - if (!Array.isArray(message.autoPopulatedFields)) - return "autoPopulatedFields: array expected"; - for (var i = 0; i < message.autoPopulatedFields.length; ++i) - if (!$util.isString(message.autoPopulatedFields[i])) - return "autoPopulatedFields: string[] expected"; - } - return null; - }; + /** + * Verifies a DeleteWorkflowRequest message. + * @function verify + * @memberof google.cloud.workflows.v1beta.DeleteWorkflowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteWorkflowRequest.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 MethodSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.MethodSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.MethodSettings} MethodSettings - */ - MethodSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.MethodSettings) - return object; - var message = new $root.google.api.MethodSettings(); - if (object.selector != null) - message.selector = String(object.selector); - if (object.longRunning != null) { - if (typeof object.longRunning !== "object") - throw TypeError(".google.api.MethodSettings.longRunning: object expected"); - message.longRunning = $root.google.api.MethodSettings.LongRunning.fromObject(object.longRunning); - } - if (object.autoPopulatedFields) { - if (!Array.isArray(object.autoPopulatedFields)) - throw TypeError(".google.api.MethodSettings.autoPopulatedFields: array expected"); - message.autoPopulatedFields = []; - for (var i = 0; i < object.autoPopulatedFields.length; ++i) - message.autoPopulatedFields[i] = String(object.autoPopulatedFields[i]); - } - return message; - }; + /** + * Creates a DeleteWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1beta.DeleteWorkflowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1beta.DeleteWorkflowRequest} DeleteWorkflowRequest + */ + DeleteWorkflowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1beta.DeleteWorkflowRequest) + return object; + var message = new $root.google.cloud.workflows.v1beta.DeleteWorkflowRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; - /** - * Creates a plain object from a MethodSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.MethodSettings - * @static - * @param {google.api.MethodSettings} message MethodSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MethodSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.autoPopulatedFields = []; - if (options.defaults) { - object.selector = ""; - object.longRunning = null; - } - if (message.selector != null && message.hasOwnProperty("selector")) - object.selector = message.selector; - if (message.longRunning != null && message.hasOwnProperty("longRunning")) - object.longRunning = $root.google.api.MethodSettings.LongRunning.toObject(message.longRunning, options); - if (message.autoPopulatedFields && message.autoPopulatedFields.length) { - object.autoPopulatedFields = []; - for (var j = 0; j < message.autoPopulatedFields.length; ++j) - object.autoPopulatedFields[j] = message.autoPopulatedFields[j]; - } - return object; - }; + /** + * Creates a plain object from a DeleteWorkflowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1beta.DeleteWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.DeleteWorkflowRequest} message DeleteWorkflowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteWorkflowRequest.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 MethodSettings to JSON. - * @function toJSON - * @memberof google.api.MethodSettings - * @instance - * @returns {Object.} JSON object - */ - MethodSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this DeleteWorkflowRequest to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1beta.DeleteWorkflowRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteWorkflowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Gets the default type url for MethodSettings - * @function getTypeUrl - * @memberof google.api.MethodSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MethodSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.MethodSettings"; - }; + /** + * Gets the default type url for DeleteWorkflowRequest + * @function getTypeUrl + * @memberof google.cloud.workflows.v1beta.DeleteWorkflowRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteWorkflowRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1beta.DeleteWorkflowRequest"; + }; - MethodSettings.LongRunning = (function() { + return DeleteWorkflowRequest; + })(); - /** - * Properties of a LongRunning. - * @memberof google.api.MethodSettings - * @interface ILongRunning - * @property {google.protobuf.IDuration|null} [initialPollDelay] LongRunning initialPollDelay - * @property {number|null} [pollDelayMultiplier] LongRunning pollDelayMultiplier - * @property {google.protobuf.IDuration|null} [maxPollDelay] LongRunning maxPollDelay - * @property {google.protobuf.IDuration|null} [totalPollTimeout] LongRunning totalPollTimeout - */ + v1beta.UpdateWorkflowRequest = (function() { - /** - * Constructs a new LongRunning. - * @memberof google.api.MethodSettings - * @classdesc Represents a LongRunning. - * @implements ILongRunning - * @constructor - * @param {google.api.MethodSettings.ILongRunning=} [properties] Properties to set - */ - function LongRunning(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]]; - } + /** + * Properties of an UpdateWorkflowRequest. + * @memberof google.cloud.workflows.v1beta + * @interface IUpdateWorkflowRequest + * @property {google.cloud.workflows.v1beta.IWorkflow|null} [workflow] UpdateWorkflowRequest workflow + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateWorkflowRequest updateMask + */ - /** - * LongRunning initialPollDelay. - * @member {google.protobuf.IDuration|null|undefined} initialPollDelay - * @memberof google.api.MethodSettings.LongRunning - * @instance - */ - LongRunning.prototype.initialPollDelay = null; + /** + * Constructs a new UpdateWorkflowRequest. + * @memberof google.cloud.workflows.v1beta + * @classdesc Represents an UpdateWorkflowRequest. + * @implements IUpdateWorkflowRequest + * @constructor + * @param {google.cloud.workflows.v1beta.IUpdateWorkflowRequest=} [properties] Properties to set + */ + function UpdateWorkflowRequest(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]]; + } - /** - * LongRunning pollDelayMultiplier. - * @member {number} pollDelayMultiplier - * @memberof google.api.MethodSettings.LongRunning - * @instance - */ - LongRunning.prototype.pollDelayMultiplier = 0; + /** + * UpdateWorkflowRequest workflow. + * @member {google.cloud.workflows.v1beta.IWorkflow|null|undefined} workflow + * @memberof google.cloud.workflows.v1beta.UpdateWorkflowRequest + * @instance + */ + UpdateWorkflowRequest.prototype.workflow = null; - /** - * LongRunning maxPollDelay. - * @member {google.protobuf.IDuration|null|undefined} maxPollDelay - * @memberof google.api.MethodSettings.LongRunning - * @instance - */ - LongRunning.prototype.maxPollDelay = null; + /** + * UpdateWorkflowRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.workflows.v1beta.UpdateWorkflowRequest + * @instance + */ + UpdateWorkflowRequest.prototype.updateMask = null; - /** - * LongRunning totalPollTimeout. - * @member {google.protobuf.IDuration|null|undefined} totalPollTimeout - * @memberof google.api.MethodSettings.LongRunning - * @instance - */ - LongRunning.prototype.totalPollTimeout = null; - - /** - * Creates a new LongRunning instance using the specified properties. - * @function create - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {google.api.MethodSettings.ILongRunning=} [properties] Properties to set - * @returns {google.api.MethodSettings.LongRunning} LongRunning instance - */ - LongRunning.create = function create(properties) { - return new LongRunning(properties); - }; + /** + * Creates a new UpdateWorkflowRequest instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1beta.UpdateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.IUpdateWorkflowRequest=} [properties] Properties to set + * @returns {google.cloud.workflows.v1beta.UpdateWorkflowRequest} UpdateWorkflowRequest instance + */ + UpdateWorkflowRequest.create = function create(properties) { + return new UpdateWorkflowRequest(properties); + }; - /** - * Encodes the specified LongRunning message. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. - * @function encode - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {google.api.MethodSettings.ILongRunning} message LongRunning message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LongRunning.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.initialPollDelay != null && Object.hasOwnProperty.call(message, "initialPollDelay")) - $root.google.protobuf.Duration.encode(message.initialPollDelay, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pollDelayMultiplier != null && Object.hasOwnProperty.call(message, "pollDelayMultiplier")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.pollDelayMultiplier); - if (message.maxPollDelay != null && Object.hasOwnProperty.call(message, "maxPollDelay")) - $root.google.protobuf.Duration.encode(message.maxPollDelay, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.totalPollTimeout != null && Object.hasOwnProperty.call(message, "totalPollTimeout")) - $root.google.protobuf.Duration.encode(message.totalPollTimeout, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; + /** + * Encodes the specified UpdateWorkflowRequest message. Does not implicitly {@link google.cloud.workflows.v1beta.UpdateWorkflowRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1beta.UpdateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.IUpdateWorkflowRequest} message UpdateWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateWorkflowRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.workflow != null && Object.hasOwnProperty.call(message, "workflow")) + $root.google.cloud.workflows.v1beta.Workflow.encode(message.workflow, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; - /** - * Encodes the specified LongRunning message, length delimited. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {google.api.MethodSettings.ILongRunning} message LongRunning message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LongRunning.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified UpdateWorkflowRequest message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.UpdateWorkflowRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1beta.UpdateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.IUpdateWorkflowRequest} message UpdateWorkflowRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateWorkflowRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a LongRunning message from the specified reader or buffer. - * @function decode - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.MethodSettings.LongRunning} LongRunning - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LongRunning.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MethodSettings.LongRunning(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.initialPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - case 2: { - message.pollDelayMultiplier = reader.float(); - break; - } - case 3: { - message.maxPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + /** + * Decodes an UpdateWorkflowRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1beta.UpdateWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1beta.UpdateWorkflowRequest} UpdateWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateWorkflowRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1beta.UpdateWorkflowRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) break; - } - case 4: { - message.totalPollTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + switch (tag >>> 3) { + case 1: { + message.workflow = $root.google.cloud.workflows.v1beta.Workflow.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); break; } - default: - reader.skipType(tag & 7); - break; } - } - return message; - }; + return message; + }; - /** - * Decodes a LongRunning message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.MethodSettings.LongRunning} LongRunning - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LongRunning.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes an UpdateWorkflowRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1beta.UpdateWorkflowRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1beta.UpdateWorkflowRequest} UpdateWorkflowRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateWorkflowRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a LongRunning message. - * @function verify - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LongRunning.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.initialPollDelay != null && message.hasOwnProperty("initialPollDelay")) { - var error = $root.google.protobuf.Duration.verify(message.initialPollDelay); - if (error) - return "initialPollDelay." + error; - } - if (message.pollDelayMultiplier != null && message.hasOwnProperty("pollDelayMultiplier")) - if (typeof message.pollDelayMultiplier !== "number") - return "pollDelayMultiplier: number expected"; - if (message.maxPollDelay != null && message.hasOwnProperty("maxPollDelay")) { - var error = $root.google.protobuf.Duration.verify(message.maxPollDelay); - if (error) - return "maxPollDelay." + error; - } - if (message.totalPollTimeout != null && message.hasOwnProperty("totalPollTimeout")) { - var error = $root.google.protobuf.Duration.verify(message.totalPollTimeout); - if (error) - return "totalPollTimeout." + error; - } - return null; - }; + /** + * Verifies an UpdateWorkflowRequest message. + * @function verify + * @memberof google.cloud.workflows.v1beta.UpdateWorkflowRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateWorkflowRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.workflow != null && message.hasOwnProperty("workflow")) { + var error = $root.google.cloud.workflows.v1beta.Workflow.verify(message.workflow); + if (error) + return "workflow." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; - /** - * Creates a LongRunning message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {Object.} object Plain object - * @returns {google.api.MethodSettings.LongRunning} LongRunning - */ - LongRunning.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.MethodSettings.LongRunning) + /** + * Creates an UpdateWorkflowRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1beta.UpdateWorkflowRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1beta.UpdateWorkflowRequest} UpdateWorkflowRequest + */ + UpdateWorkflowRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1beta.UpdateWorkflowRequest) + return object; + var message = new $root.google.cloud.workflows.v1beta.UpdateWorkflowRequest(); + if (object.workflow != null) { + if (typeof object.workflow !== "object") + throw TypeError(".google.cloud.workflows.v1beta.UpdateWorkflowRequest.workflow: object expected"); + message.workflow = $root.google.cloud.workflows.v1beta.Workflow.fromObject(object.workflow); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.workflows.v1beta.UpdateWorkflowRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateWorkflowRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1beta.UpdateWorkflowRequest + * @static + * @param {google.cloud.workflows.v1beta.UpdateWorkflowRequest} message UpdateWorkflowRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateWorkflowRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.workflow = null; + object.updateMask = null; + } + if (message.workflow != null && message.hasOwnProperty("workflow")) + object.workflow = $root.google.cloud.workflows.v1beta.Workflow.toObject(message.workflow, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); return object; - var message = new $root.google.api.MethodSettings.LongRunning(); - if (object.initialPollDelay != null) { - if (typeof object.initialPollDelay !== "object") - throw TypeError(".google.api.MethodSettings.LongRunning.initialPollDelay: object expected"); - message.initialPollDelay = $root.google.protobuf.Duration.fromObject(object.initialPollDelay); - } - if (object.pollDelayMultiplier != null) - message.pollDelayMultiplier = Number(object.pollDelayMultiplier); - if (object.maxPollDelay != null) { - if (typeof object.maxPollDelay !== "object") - throw TypeError(".google.api.MethodSettings.LongRunning.maxPollDelay: object expected"); - message.maxPollDelay = $root.google.protobuf.Duration.fromObject(object.maxPollDelay); - } - if (object.totalPollTimeout != null) { - if (typeof object.totalPollTimeout !== "object") - throw TypeError(".google.api.MethodSettings.LongRunning.totalPollTimeout: object expected"); - message.totalPollTimeout = $root.google.protobuf.Duration.fromObject(object.totalPollTimeout); - } - return message; - }; + }; - /** - * Creates a plain object from a LongRunning message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {google.api.MethodSettings.LongRunning} message LongRunning - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LongRunning.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.initialPollDelay = null; - object.pollDelayMultiplier = 0; - object.maxPollDelay = null; - object.totalPollTimeout = null; - } - if (message.initialPollDelay != null && message.hasOwnProperty("initialPollDelay")) - object.initialPollDelay = $root.google.protobuf.Duration.toObject(message.initialPollDelay, options); - if (message.pollDelayMultiplier != null && message.hasOwnProperty("pollDelayMultiplier")) - object.pollDelayMultiplier = options.json && !isFinite(message.pollDelayMultiplier) ? String(message.pollDelayMultiplier) : message.pollDelayMultiplier; - if (message.maxPollDelay != null && message.hasOwnProperty("maxPollDelay")) - object.maxPollDelay = $root.google.protobuf.Duration.toObject(message.maxPollDelay, options); - if (message.totalPollTimeout != null && message.hasOwnProperty("totalPollTimeout")) - object.totalPollTimeout = $root.google.protobuf.Duration.toObject(message.totalPollTimeout, options); - return object; - }; + /** + * Converts this UpdateWorkflowRequest to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1beta.UpdateWorkflowRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateWorkflowRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this LongRunning to JSON. - * @function toJSON - * @memberof google.api.MethodSettings.LongRunning - * @instance - * @returns {Object.} JSON object - */ - LongRunning.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Gets the default type url for UpdateWorkflowRequest + * @function getTypeUrl + * @memberof google.cloud.workflows.v1beta.UpdateWorkflowRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateWorkflowRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1beta.UpdateWorkflowRequest"; + }; - /** - * Gets the default type url for LongRunning - * @function getTypeUrl - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LongRunning.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.MethodSettings.LongRunning"; - }; + return UpdateWorkflowRequest; + })(); - return LongRunning; - })(); + v1beta.OperationMetadata = (function() { - return MethodSettings; - })(); + /** + * Properties of an OperationMetadata. + * @memberof google.cloud.workflows.v1beta + * @interface IOperationMetadata + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [endTime] OperationMetadata endTime + * @property {string|null} [target] OperationMetadata target + * @property {string|null} [verb] OperationMetadata verb + * @property {string|null} [apiVersion] OperationMetadata apiVersion + */ - /** - * ClientLibraryOrganization enum. - * @name google.api.ClientLibraryOrganization - * @enum {number} - * @property {number} CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED=0 CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED value - * @property {number} CLOUD=1 CLOUD value - * @property {number} ADS=2 ADS value - * @property {number} PHOTOS=3 PHOTOS value - * @property {number} STREET_VIEW=4 STREET_VIEW value - * @property {number} SHOPPING=5 SHOPPING value - * @property {number} GEO=6 GEO value - * @property {number} GENERATIVE_AI=7 GENERATIVE_AI value - */ - api.ClientLibraryOrganization = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED"] = 0; - values[valuesById[1] = "CLOUD"] = 1; - values[valuesById[2] = "ADS"] = 2; - values[valuesById[3] = "PHOTOS"] = 3; - values[valuesById[4] = "STREET_VIEW"] = 4; - values[valuesById[5] = "SHOPPING"] = 5; - values[valuesById[6] = "GEO"] = 6; - values[valuesById[7] = "GENERATIVE_AI"] = 7; - return values; - })(); + /** + * Constructs a new OperationMetadata. + * @memberof google.cloud.workflows.v1beta + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata + * @constructor + * @param {google.cloud.workflows.v1beta.IOperationMetadata=} [properties] Properties to set + */ + function OperationMetadata(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]]; + } - /** - * ClientLibraryDestination enum. - * @name google.api.ClientLibraryDestination - * @enum {number} - * @property {number} CLIENT_LIBRARY_DESTINATION_UNSPECIFIED=0 CLIENT_LIBRARY_DESTINATION_UNSPECIFIED value - * @property {number} GITHUB=10 GITHUB value - * @property {number} PACKAGE_MANAGER=20 PACKAGE_MANAGER value - */ - api.ClientLibraryDestination = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED"] = 0; - values[valuesById[10] = "GITHUB"] = 10; - values[valuesById[20] = "PACKAGE_MANAGER"] = 20; - return values; - })(); + /** + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @instance + */ + OperationMetadata.prototype.createTime = null; - /** - * LaunchStage enum. - * @name google.api.LaunchStage - * @enum {number} - * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value - * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value - * @property {number} PRELAUNCH=7 PRELAUNCH value - * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value - * @property {number} ALPHA=2 ALPHA value - * @property {number} BETA=3 BETA value - * @property {number} GA=4 GA value - * @property {number} DEPRECATED=5 DEPRECATED value - */ - api.LaunchStage = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; - values[valuesById[6] = "UNIMPLEMENTED"] = 6; - values[valuesById[7] = "PRELAUNCH"] = 7; - values[valuesById[1] = "EARLY_ACCESS"] = 1; - values[valuesById[2] = "ALPHA"] = 2; - values[valuesById[3] = "BETA"] = 3; - values[valuesById[4] = "GA"] = 4; - values[valuesById[5] = "DEPRECATED"] = 5; - return values; + /** + * OperationMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @instance + */ + OperationMetadata.prototype.endTime = null; + + /** + * OperationMetadata target. + * @member {string} target + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @instance + */ + OperationMetadata.prototype.target = ""; + + /** + * OperationMetadata verb. + * @member {string} verb + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @instance + */ + OperationMetadata.prototype.verb = ""; + + /** + * OperationMetadata apiVersion. + * @member {string} apiVersion + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @instance + */ + OperationMetadata.prototype.apiVersion = ""; + + /** + * Creates a new OperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @static + * @param {google.cloud.workflows.v1beta.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.workflows.v1beta.OperationMetadata} OperationMetadata instance + */ + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); + }; + + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.workflows.v1beta.OperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @static + * @param {google.cloud.workflows.v1beta.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.target != null && Object.hasOwnProperty.call(message, "target")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.target); + if (message.verb != null && Object.hasOwnProperty.call(message, "verb")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.verb); + if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.apiVersion); + return writer; + }; + + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.workflows.v1beta.OperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @static + * @param {google.cloud.workflows.v1beta.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.workflows.v1beta.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.workflows.v1beta.OperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.target = reader.string(); + break; + } + case 4: { + message.verb = reader.string(); + break; + } + case 5: { + message.apiVersion = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.workflows.v1beta.OperationMetadata} OperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationMetadata message. + * @function verify + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.target != null && message.hasOwnProperty("target")) + if (!$util.isString(message.target)) + return "target: string expected"; + if (message.verb != null && message.hasOwnProperty("verb")) + if (!$util.isString(message.verb)) + return "verb: string expected"; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + if (!$util.isString(message.apiVersion)) + return "apiVersion: string expected"; + return null; + }; + + /** + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.workflows.v1beta.OperationMetadata} OperationMetadata + */ + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.workflows.v1beta.OperationMetadata) + return object; + var message = new $root.google.cloud.workflows.v1beta.OperationMetadata(); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.workflows.v1beta.OperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.workflows.v1beta.OperationMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + if (object.target != null) + message.target = String(object.target); + if (object.verb != null) + message.verb = String(object.verb); + if (object.apiVersion != null) + message.apiVersion = String(object.apiVersion); + return message; + }; + + /** + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @static + * @param {google.cloud.workflows.v1beta.OperationMetadata} message OperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.createTime = null; + object.endTime = null; + object.target = ""; + object.verb = ""; + object.apiVersion = ""; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.target != null && message.hasOwnProperty("target")) + object.target = message.target; + if (message.verb != null && message.hasOwnProperty("verb")) + object.verb = message.verb; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + object.apiVersion = message.apiVersion; + return object; + }; + + /** + * Converts this OperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @instance + * @returns {Object.} JSON object + */ + OperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OperationMetadata + * @function getTypeUrl + * @memberof google.cloud.workflows.v1beta.OperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.workflows.v1beta.OperationMetadata"; + }; + + return OperationMetadata; + })(); + + return v1beta; + })(); + + return workflows; })(); + return cloud; + })(); + + google.api = (function() { + /** - * FieldBehavior enum. - * @name google.api.FieldBehavior - * @enum {number} - * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value - * @property {number} OPTIONAL=1 OPTIONAL value - * @property {number} REQUIRED=2 REQUIRED value - * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value - * @property {number} INPUT_ONLY=4 INPUT_ONLY value - * @property {number} IMMUTABLE=5 IMMUTABLE value - * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value - * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value - * @property {number} IDENTIFIER=8 IDENTIFIER value + * Namespace api. + * @memberof google + * @namespace */ - api.FieldBehavior = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; - values[valuesById[1] = "OPTIONAL"] = 1; - values[valuesById[2] = "REQUIRED"] = 2; - values[valuesById[3] = "OUTPUT_ONLY"] = 3; - values[valuesById[4] = "INPUT_ONLY"] = 4; - values[valuesById[5] = "IMMUTABLE"] = 5; - values[valuesById[6] = "UNORDERED_LIST"] = 6; - values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; - values[valuesById[8] = "IDENTIFIER"] = 8; - return values; - })(); + var api = {}; - api.ResourceDescriptor = (function() { + api.Http = (function() { /** - * Properties of a ResourceDescriptor. + * Properties of a Http. * @memberof google.api - * @interface IResourceDescriptor - * @property {string|null} [type] ResourceDescriptor type - * @property {Array.|null} [pattern] ResourceDescriptor pattern - * @property {string|null} [nameField] ResourceDescriptor nameField - * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history - * @property {string|null} [plural] ResourceDescriptor plural - * @property {string|null} [singular] ResourceDescriptor singular - * @property {Array.|null} [style] ResourceDescriptor style + * @interface IHttp + * @property {Array.|null} [rules] Http rules + * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion */ /** - * Constructs a new ResourceDescriptor. + * Constructs a new Http. * @memberof google.api - * @classdesc Represents a ResourceDescriptor. - * @implements IResourceDescriptor + * @classdesc Represents a Http. + * @implements IHttp * @constructor - * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @param {google.api.IHttp=} [properties] Properties to set */ - function ResourceDescriptor(properties) { - this.pattern = []; - this.style = []; + function Http(properties) { + this.rules = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11089,175 +12398,94 @@ } /** - * ResourceDescriptor type. - * @member {string} type - * @memberof google.api.ResourceDescriptor + * Http rules. + * @member {Array.} rules + * @memberof google.api.Http * @instance */ - ResourceDescriptor.prototype.type = ""; + Http.prototype.rules = $util.emptyArray; /** - * ResourceDescriptor pattern. - * @member {Array.} pattern - * @memberof google.api.ResourceDescriptor + * Http fullyDecodeReservedExpansion. + * @member {boolean} fullyDecodeReservedExpansion + * @memberof google.api.Http * @instance */ - ResourceDescriptor.prototype.pattern = $util.emptyArray; + Http.prototype.fullyDecodeReservedExpansion = false; /** - * ResourceDescriptor nameField. - * @member {string} nameField - * @memberof google.api.ResourceDescriptor - * @instance + * Creates a new Http instance using the specified properties. + * @function create + * @memberof google.api.Http + * @static + * @param {google.api.IHttp=} [properties] Properties to set + * @returns {google.api.Http} Http instance */ - ResourceDescriptor.prototype.nameField = ""; + Http.create = function create(properties) { + return new Http(properties); + }; /** - * ResourceDescriptor history. - * @member {google.api.ResourceDescriptor.History} history - * @memberof google.api.ResourceDescriptor - * @instance + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encode + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - ResourceDescriptor.prototype.history = 0; + Http.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rules != null && message.rules.length) + for (var i = 0; i < message.rules.length; ++i) + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); + return writer; + }; /** - * ResourceDescriptor plural. - * @member {string} plural - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.plural = ""; - - /** - * ResourceDescriptor singular. - * @member {string} singular - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.singular = ""; - - /** - * ResourceDescriptor style. - * @member {Array.} style - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.style = $util.emptyArray; - - /** - * Creates a new ResourceDescriptor instance using the specified properties. - * @function create - * @memberof google.api.ResourceDescriptor - * @static - * @param {google.api.IResourceDescriptor=} [properties] Properties to set - * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance - */ - ResourceDescriptor.create = function create(properties) { - return new ResourceDescriptor(properties); - }; - - /** - * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. - * @function encode - * @memberof google.api.ResourceDescriptor - * @static - * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceDescriptor.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.pattern != null && message.pattern.length) - for (var i = 0; i < message.pattern.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); - if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); - if (message.history != null && Object.hasOwnProperty.call(message, "history")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); - if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); - if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); - if (message.style != null && message.style.length) { - writer.uint32(/* id 10, wireType 2 =*/82).fork(); - for (var i = 0; i < message.style.length; ++i) - writer.int32(message.style[i]); - writer.ldelim(); - } - return writer; - }; - - /** - * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. * @function encodeDelimited - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static - * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {google.api.IHttp} message Http message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + Http.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ResourceDescriptor message from the specified reader or buffer. + * Decodes a Http message from the specified reader or buffer. * @function decode - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @returns {google.api.Http} Http * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceDescriptor.decode = function decode(reader, length, error) { + Http.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - message.type = reader.string(); + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); break; } case 2: { - if (!(message.pattern && message.pattern.length)) - message.pattern = []; - message.pattern.push(reader.string()); - break; - } - case 3: { - message.nameField = reader.string(); - break; - } - case 4: { - message.history = reader.int32(); - break; - } - case 5: { - message.plural = reader.string(); - break; - } - case 6: { - message.singular = reader.string(); - break; - } - case 10: { - if (!(message.style && message.style.length)) - message.style = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.style.push(reader.int32()); - } else - message.style.push(reader.int32()); + message.fullyDecodeReservedExpansion = reader.bool(); break; } default: @@ -11269,271 +12497,158 @@ }; /** - * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * Decodes a Http message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @returns {google.api.Http} Http * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + Http.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ResourceDescriptor message. + * Verifies a Http message. * @function verify - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ResourceDescriptor.verify = function verify(message) { + Http.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.pattern != null && message.hasOwnProperty("pattern")) { - if (!Array.isArray(message.pattern)) - return "pattern: array expected"; - for (var i = 0; i < message.pattern.length; ++i) - if (!$util.isString(message.pattern[i])) - return "pattern: string[] expected"; - } - if (message.nameField != null && message.hasOwnProperty("nameField")) - if (!$util.isString(message.nameField)) - return "nameField: string expected"; - if (message.history != null && message.hasOwnProperty("history")) - switch (message.history) { - default: - return "history: enum value expected"; - case 0: - case 1: - case 2: - break; + if (message.rules != null && message.hasOwnProperty("rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (var i = 0; i < message.rules.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.rules[i]); + if (error) + return "rules." + error; } - if (message.plural != null && message.hasOwnProperty("plural")) - if (!$util.isString(message.plural)) - return "plural: string expected"; - if (message.singular != null && message.hasOwnProperty("singular")) - if (!$util.isString(message.singular)) - return "singular: string expected"; - if (message.style != null && message.hasOwnProperty("style")) { - if (!Array.isArray(message.style)) - return "style: array expected"; - for (var i = 0; i < message.style.length; ++i) - switch (message.style[i]) { - default: - return "style: enum value[] expected"; - case 0: - case 1: - break; - } } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (typeof message.fullyDecodeReservedExpansion !== "boolean") + return "fullyDecodeReservedExpansion: boolean expected"; return null; }; /** - * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * Creates a Http message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static * @param {Object.} object Plain object - * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @returns {google.api.Http} Http */ - ResourceDescriptor.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.ResourceDescriptor) + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) return object; - var message = new $root.google.api.ResourceDescriptor(); - if (object.type != null) - message.type = String(object.type); - if (object.pattern) { - if (!Array.isArray(object.pattern)) - throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); - message.pattern = []; - for (var i = 0; i < object.pattern.length; ++i) - message.pattern[i] = String(object.pattern[i]); - } - if (object.nameField != null) - message.nameField = String(object.nameField); - switch (object.history) { - default: - if (typeof object.history === "number") { - message.history = object.history; - break; + var message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (var i = 0; i < object.rules.length; ++i) { + if (typeof object.rules[i] !== "object") + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); } - break; - case "HISTORY_UNSPECIFIED": - case 0: - message.history = 0; - break; - case "ORIGINALLY_SINGLE_PATTERN": - case 1: - message.history = 1; - break; - case "FUTURE_MULTI_PATTERN": - case 2: - message.history = 2; - break; - } - if (object.plural != null) - message.plural = String(object.plural); - if (object.singular != null) - message.singular = String(object.singular); - if (object.style) { - if (!Array.isArray(object.style)) - throw TypeError(".google.api.ResourceDescriptor.style: array expected"); - message.style = []; - for (var i = 0; i < object.style.length; ++i) - switch (object.style[i]) { - default: - if (typeof object.style[i] === "number") { - message.style[i] = object.style[i]; - break; - } - case "STYLE_UNSPECIFIED": - case 0: - message.style[i] = 0; - break; - case "DECLARATIVE_FRIENDLY": - case 1: - message.style[i] = 1; - break; - } } + if (object.fullyDecodeReservedExpansion != null) + message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); return message; }; /** - * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * Creates a plain object from a Http message. Also converts values to other types if specified. * @function toObject - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static - * @param {google.api.ResourceDescriptor} message ResourceDescriptor + * @param {google.api.Http} message Http * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ResourceDescriptor.toObject = function toObject(message, options) { + Http.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.pattern = []; - object.style = []; - } - if (options.defaults) { - object.type = ""; - object.nameField = ""; - object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; - object.plural = ""; - object.singular = ""; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.pattern && message.pattern.length) { - object.pattern = []; - for (var j = 0; j < message.pattern.length; ++j) - object.pattern[j] = message.pattern[j]; - } - if (message.nameField != null && message.hasOwnProperty("nameField")) - object.nameField = message.nameField; - if (message.history != null && message.hasOwnProperty("history")) - object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; - if (message.plural != null && message.hasOwnProperty("plural")) - object.plural = message.plural; - if (message.singular != null && message.hasOwnProperty("singular")) - object.singular = message.singular; - if (message.style && message.style.length) { - object.style = []; - for (var j = 0; j < message.style.length; ++j) - object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + if (options.arrays || options.defaults) + object.rules = []; + if (options.defaults) + object.fullyDecodeReservedExpansion = false; + if (message.rules && message.rules.length) { + object.rules = []; + for (var j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; return object; }; /** - * Converts this ResourceDescriptor to JSON. + * Converts this Http to JSON. * @function toJSON - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @instance * @returns {Object.} JSON object */ - ResourceDescriptor.prototype.toJSON = function toJSON() { + Http.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ResourceDescriptor + * Gets the default type url for Http * @function getTypeUrl - * @memberof google.api.ResourceDescriptor + * @memberof google.api.Http * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Http.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.api.ResourceDescriptor"; + return typeUrlPrefix + "/google.api.Http"; }; - /** - * History enum. - * @name google.api.ResourceDescriptor.History - * @enum {number} - * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value - * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value - * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value - */ - ResourceDescriptor.History = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; - values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; - values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; - return values; - })(); - - /** - * Style enum. - * @name google.api.ResourceDescriptor.Style - * @enum {number} - * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value - * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value - */ - ResourceDescriptor.Style = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; - values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; - return values; - })(); - - return ResourceDescriptor; + return Http; })(); - api.ResourceReference = (function() { + api.HttpRule = (function() { /** - * Properties of a ResourceReference. + * Properties of a HttpRule. * @memberof google.api - * @interface IResourceReference - * @property {string|null} [type] ResourceReference type - * @property {string|null} [childType] ResourceReference childType + * @interface IHttpRule + * @property {string|null} [selector] HttpRule selector + * @property {string|null} [get] HttpRule get + * @property {string|null} [put] HttpRule put + * @property {string|null} [post] HttpRule post + * @property {string|null} ["delete"] HttpRule delete + * @property {string|null} [patch] HttpRule patch + * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom + * @property {string|null} [body] HttpRule body + * @property {string|null} [responseBody] HttpRule responseBody + * @property {Array.|null} [additionalBindings] HttpRule additionalBindings */ /** - * Constructs a new ResourceReference. + * Constructs a new HttpRule. * @memberof google.api - * @classdesc Represents a ResourceReference. - * @implements IResourceReference + * @classdesc Represents a HttpRule. + * @implements IHttpRule * @constructor - * @param {google.api.IResourceReference=} [properties] Properties to set + * @param {google.api.IHttpRule=} [properties] Properties to set */ - function ResourceReference(properties) { + function HttpRule(properties) { + this.additionalBindings = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11541,321 +12656,220 @@ } /** - * ResourceReference type. - * @member {string} type - * @memberof google.api.ResourceReference + * HttpRule selector. + * @member {string} selector + * @memberof google.api.HttpRule * @instance */ - ResourceReference.prototype.type = ""; + HttpRule.prototype.selector = ""; /** - * ResourceReference childType. - * @member {string} childType - * @memberof google.api.ResourceReference + * HttpRule get. + * @member {string|null|undefined} get + * @memberof google.api.HttpRule * @instance */ - ResourceReference.prototype.childType = ""; + HttpRule.prototype.get = null; /** - * Creates a new ResourceReference instance using the specified properties. - * @function create - * @memberof google.api.ResourceReference - * @static - * @param {google.api.IResourceReference=} [properties] Properties to set - * @returns {google.api.ResourceReference} ResourceReference instance + * HttpRule put. + * @member {string|null|undefined} put + * @memberof google.api.HttpRule + * @instance */ - ResourceReference.create = function create(properties) { - return new ResourceReference(properties); - }; + HttpRule.prototype.put = null; /** - * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. - * @function encode - * @memberof google.api.ResourceReference - * @static - * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * HttpRule post. + * @member {string|null|undefined} post + * @memberof google.api.HttpRule + * @instance */ - ResourceReference.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); - return writer; - }; + HttpRule.prototype.post = null; /** - * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.ResourceReference - * @static - * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * HttpRule delete. + * @member {string|null|undefined} delete + * @memberof google.api.HttpRule + * @instance */ - ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + HttpRule.prototype["delete"] = null; /** - * Decodes a ResourceReference message from the specified reader or buffer. - * @function decode - * @memberof google.api.ResourceReference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.ResourceReference} ResourceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * HttpRule patch. + * @member {string|null|undefined} patch + * @memberof google.api.HttpRule + * @instance */ - ResourceReference.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.type = reader.string(); - break; - } - case 2: { - message.childType = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + HttpRule.prototype.patch = null; /** - * Decodes a ResourceReference message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.ResourceReference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.ResourceReference} ResourceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * HttpRule custom. + * @member {google.api.ICustomHttpPattern|null|undefined} custom + * @memberof google.api.HttpRule + * @instance */ - ResourceReference.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + HttpRule.prototype.custom = null; /** - * Verifies a ResourceReference message. - * @function verify - * @memberof google.api.ResourceReference - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResourceReference.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.childType != null && message.hasOwnProperty("childType")) - if (!$util.isString(message.childType)) - return "childType: string expected"; - return null; - }; - - /** - * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.ResourceReference - * @static - * @param {Object.} object Plain object - * @returns {google.api.ResourceReference} ResourceReference - */ - ResourceReference.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.ResourceReference) - return object; - var message = new $root.google.api.ResourceReference(); - if (object.type != null) - message.type = String(object.type); - if (object.childType != null) - message.childType = String(object.childType); - return message; - }; - - /** - * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.ResourceReference - * @static - * @param {google.api.ResourceReference} message ResourceReference - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResourceReference.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.type = ""; - object.childType = ""; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.childType != null && message.hasOwnProperty("childType")) - object.childType = message.childType; - return object; - }; - - /** - * Converts this ResourceReference to JSON. - * @function toJSON - * @memberof google.api.ResourceReference + * HttpRule body. + * @member {string} body + * @memberof google.api.HttpRule * @instance - * @returns {Object.} JSON object */ - ResourceReference.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + HttpRule.prototype.body = ""; /** - * Gets the default type url for ResourceReference - * @function getTypeUrl - * @memberof google.api.ResourceReference - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url + * HttpRule responseBody. + * @member {string} responseBody + * @memberof google.api.HttpRule + * @instance */ - ResourceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.ResourceReference"; - }; - - return ResourceReference; - })(); - - return api; - })(); - - google.protobuf = (function() { - - /** - * Namespace protobuf. - * @memberof google - * @namespace - */ - var protobuf = {}; - - protobuf.FileDescriptorSet = (function() { + HttpRule.prototype.responseBody = ""; /** - * Properties of a FileDescriptorSet. - * @memberof google.protobuf - * @interface IFileDescriptorSet - * @property {Array.|null} [file] FileDescriptorSet file + * HttpRule additionalBindings. + * @member {Array.} additionalBindings + * @memberof google.api.HttpRule + * @instance */ + HttpRule.prototype.additionalBindings = $util.emptyArray; - /** - * Constructs a new FileDescriptorSet. - * @memberof google.protobuf - * @classdesc Represents a FileDescriptorSet. - * @implements IFileDescriptorSet - * @constructor - * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set - */ - function FileDescriptorSet(properties) { - this.file = []; - 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]]; - } + // OneOf field names bound to virtual getters and setters + var $oneOfFields; /** - * FileDescriptorSet file. - * @member {Array.} file - * @memberof google.protobuf.FileDescriptorSet + * HttpRule pattern. + * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern + * @memberof google.api.HttpRule * @instance */ - FileDescriptorSet.prototype.file = $util.emptyArray; + Object.defineProperty(HttpRule.prototype, "pattern", { + get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), + set: $util.oneOfSetter($oneOfFields) + }); /** - * Creates a new FileDescriptorSet instance using the specified properties. + * Creates a new HttpRule instance using the specified properties. * @function create - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.api.HttpRule * @static - * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance + * @param {google.api.IHttpRule=} [properties] Properties to set + * @returns {google.api.HttpRule} HttpRule instance */ - FileDescriptorSet.create = function create(properties) { - return new FileDescriptorSet(properties); + HttpRule.create = function create(properties) { + return new HttpRule(properties); }; /** - * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. * @function encode - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.api.HttpRule * @static - * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FileDescriptorSet.encode = function encode(message, writer) { + HttpRule.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.file != null && message.file.length) - for (var i = 0; i < message.file.length; ++i) - $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && Object.hasOwnProperty.call(message, "get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && Object.hasOwnProperty.call(message, "put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && Object.hasOwnProperty.call(message, "post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) + $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.additionalBindings != null && message.additionalBindings.length) + for (var i = 0; i < message.additionalBindings.length; ++i) + $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); return writer; }; /** - * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.api.HttpRule * @static - * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FileDescriptorSet message from the specified reader or buffer. + * Decodes a HttpRule message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.api.HttpRule * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @returns {google.api.HttpRule} HttpRule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FileDescriptorSet.decode = function decode(reader, length, error) { + HttpRule.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - if (!(message.file && message.file.length)) - message.file = []; - message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + message.selector = reader.string(); + break; + } + case 2: { + message.get = reader.string(); + break; + } + case 3: { + message.put = reader.string(); + break; + } + case 4: { + message.post = reader.string(); + break; + } + case 5: { + message["delete"] = reader.string(); + break; + } + case 6: { + message.patch = reader.string(); + break; + } + case 8: { + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + } + case 7: { + message.body = reader.string(); + break; + } + case 12: { + message.responseBody = reader.string(); + break; + } + case 11: { + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); break; } default: @@ -11867,190 +12881,255 @@ }; /** - * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * Decodes a HttpRule message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.api.HttpRule * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @returns {google.api.HttpRule} HttpRule * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { + HttpRule.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FileDescriptorSet message. + * Verifies a HttpRule message. * @function verify - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.api.HttpRule * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FileDescriptorSet.verify = function verify(message) { + HttpRule.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.file != null && message.hasOwnProperty("file")) { - if (!Array.isArray(message.file)) - return "file: array expected"; - for (var i = 0; i < message.file.length; ++i) { - var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); + var properties = {}; + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.get != null && message.hasOwnProperty("get")) { + properties.pattern = 1; + if (!$util.isString(message.get)) + return "get: string expected"; + } + if (message.put != null && message.hasOwnProperty("put")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.put)) + return "put: string expected"; + } + if (message.post != null && message.hasOwnProperty("post")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.post)) + return "post: string expected"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.patch)) + return "patch: string expected"; + } + if (message.custom != null && message.hasOwnProperty("custom")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + { + var error = $root.google.api.CustomHttpPattern.verify(message.custom); if (error) - return "file." + error; + return "custom." + error; + } + } + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + if (!$util.isString(message.responseBody)) + return "responseBody: string expected"; + if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { + if (!Array.isArray(message.additionalBindings)) + return "additionalBindings: array expected"; + for (var i = 0; i < message.additionalBindings.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); + if (error) + return "additionalBindings." + error; } } return null; }; /** - * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.api.HttpRule * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @returns {google.api.HttpRule} HttpRule */ - FileDescriptorSet.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileDescriptorSet) + HttpRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpRule) return object; - var message = new $root.google.protobuf.FileDescriptorSet(); - if (object.file) { - if (!Array.isArray(object.file)) - throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); - message.file = []; - for (var i = 0; i < object.file.length; ++i) { - if (typeof object.file[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); - message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); + var message = new $root.google.api.HttpRule(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.get != null) + message.get = String(object.get); + if (object.put != null) + message.put = String(object.put); + if (object.post != null) + message.post = String(object.post); + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.patch != null) + message.patch = String(object.patch); + if (object.custom != null) { + if (typeof object.custom !== "object") + throw TypeError(".google.api.HttpRule.custom: object expected"); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + } + if (object.body != null) + message.body = String(object.body); + if (object.responseBody != null) + message.responseBody = String(object.responseBody); + if (object.additionalBindings) { + if (!Array.isArray(object.additionalBindings)) + throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); + message.additionalBindings = []; + for (var i = 0; i < object.additionalBindings.length; ++i) { + if (typeof object.additionalBindings[i] !== "object") + throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); + message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); } } return message; }; /** - * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.api.HttpRule * @static - * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet + * @param {google.api.HttpRule} message HttpRule * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FileDescriptorSet.toObject = function toObject(message, options) { + HttpRule.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.file = []; - if (message.file && message.file.length) { - object.file = []; - for (var j = 0; j < message.file.length; ++j) - object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); + object.additionalBindings = []; + if (options.defaults) { + object.selector = ""; + object.body = ""; + object.responseBody = ""; + } + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.get != null && message.hasOwnProperty("get")) { + object.get = message.get; + if (options.oneofs) + object.pattern = "get"; + } + if (message.put != null && message.hasOwnProperty("put")) { + object.put = message.put; + if (options.oneofs) + object.pattern = "put"; + } + if (message.post != null && message.hasOwnProperty("post")) { + object.post = message.post; + if (options.oneofs) + object.pattern = "post"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.pattern = "delete"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + object.patch = message.patch; + if (options.oneofs) + object.pattern = "patch"; } + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.custom != null && message.hasOwnProperty("custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); + if (options.oneofs) + object.pattern = "custom"; + } + if (message.additionalBindings && message.additionalBindings.length) { + object.additionalBindings = []; + for (var j = 0; j < message.additionalBindings.length; ++j) + object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + } + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + object.responseBody = message.responseBody; return object; }; /** - * Converts this FileDescriptorSet to JSON. + * Converts this HttpRule to JSON. * @function toJSON - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.api.HttpRule * @instance * @returns {Object.} JSON object */ - FileDescriptorSet.prototype.toJSON = function toJSON() { + HttpRule.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for FileDescriptorSet + * Gets the default type url for HttpRule * @function getTypeUrl - * @memberof google.protobuf.FileDescriptorSet + * @memberof google.api.HttpRule * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - FileDescriptorSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + HttpRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.FileDescriptorSet"; + return typeUrlPrefix + "/google.api.HttpRule"; }; - return FileDescriptorSet; - })(); - - /** - * Edition enum. - * @name google.protobuf.Edition - * @enum {number} - * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value - * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value - * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value - * @property {number} EDITION_2023=1000 EDITION_2023 value - * @property {number} EDITION_2024=1001 EDITION_2024 value - * @property {number} EDITION_1_TEST_ONLY=1 EDITION_1_TEST_ONLY value - * @property {number} EDITION_2_TEST_ONLY=2 EDITION_2_TEST_ONLY value - * @property {number} EDITION_99997_TEST_ONLY=99997 EDITION_99997_TEST_ONLY value - * @property {number} EDITION_99998_TEST_ONLY=99998 EDITION_99998_TEST_ONLY value - * @property {number} EDITION_99999_TEST_ONLY=99999 EDITION_99999_TEST_ONLY value - * @property {number} EDITION_MAX=2147483647 EDITION_MAX value - */ - protobuf.Edition = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "EDITION_UNKNOWN"] = 0; - values[valuesById[998] = "EDITION_PROTO2"] = 998; - values[valuesById[999] = "EDITION_PROTO3"] = 999; - values[valuesById[1000] = "EDITION_2023"] = 1000; - values[valuesById[1001] = "EDITION_2024"] = 1001; - values[valuesById[1] = "EDITION_1_TEST_ONLY"] = 1; - values[valuesById[2] = "EDITION_2_TEST_ONLY"] = 2; - values[valuesById[99997] = "EDITION_99997_TEST_ONLY"] = 99997; - values[valuesById[99998] = "EDITION_99998_TEST_ONLY"] = 99998; - values[valuesById[99999] = "EDITION_99999_TEST_ONLY"] = 99999; - values[valuesById[2147483647] = "EDITION_MAX"] = 2147483647; - return values; + return HttpRule; })(); - protobuf.FileDescriptorProto = (function() { + api.CustomHttpPattern = (function() { /** - * Properties of a FileDescriptorProto. - * @memberof google.protobuf - * @interface IFileDescriptorProto - * @property {string|null} [name] FileDescriptorProto name - * @property {string|null} ["package"] FileDescriptorProto package - * @property {Array.|null} [dependency] FileDescriptorProto dependency - * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency - * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency - * @property {Array.|null} [messageType] FileDescriptorProto messageType - * @property {Array.|null} [enumType] FileDescriptorProto enumType - * @property {Array.|null} [service] FileDescriptorProto service - * @property {Array.|null} [extension] FileDescriptorProto extension - * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options - * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo - * @property {string|null} [syntax] FileDescriptorProto syntax - * @property {google.protobuf.Edition|null} [edition] FileDescriptorProto edition + * Properties of a CustomHttpPattern. + * @memberof google.api + * @interface ICustomHttpPattern + * @property {string|null} [kind] CustomHttpPattern kind + * @property {string|null} [path] CustomHttpPattern path */ /** - * Constructs a new FileDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a FileDescriptorProto. - * @implements IFileDescriptorProto + * Constructs a new CustomHttpPattern. + * @memberof google.api + * @classdesc Represents a CustomHttpPattern. + * @implements ICustomHttpPattern * @constructor - * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set */ - function FileDescriptorProto(properties) { - this.dependency = []; - this.publicDependency = []; - this.weakDependency = []; - this.messageType = []; - this.enumType = []; - this.service = []; - this.extension = []; + function CustomHttpPattern(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12058,276 +13137,91 @@ } /** - * FileDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.name = ""; - - /** - * FileDescriptorProto package. - * @member {string} package - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype["package"] = ""; - - /** - * FileDescriptorProto dependency. - * @member {Array.} dependency - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.dependency = $util.emptyArray; - - /** - * FileDescriptorProto publicDependency. - * @member {Array.} publicDependency - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.publicDependency = $util.emptyArray; - - /** - * FileDescriptorProto weakDependency. - * @member {Array.} weakDependency - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.weakDependency = $util.emptyArray; - - /** - * FileDescriptorProto messageType. - * @member {Array.} messageType - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.messageType = $util.emptyArray; - - /** - * FileDescriptorProto enumType. - * @member {Array.} enumType - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.enumType = $util.emptyArray; - - /** - * FileDescriptorProto service. - * @member {Array.} service - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.service = $util.emptyArray; - - /** - * FileDescriptorProto extension. - * @member {Array.} extension - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.extension = $util.emptyArray; - - /** - * FileDescriptorProto options. - * @member {google.protobuf.IFileOptions|null|undefined} options - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.options = null; - - /** - * FileDescriptorProto sourceCodeInfo. - * @member {google.protobuf.ISourceCodeInfo|null|undefined} sourceCodeInfo - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.sourceCodeInfo = null; - - /** - * FileDescriptorProto syntax. - * @member {string} syntax - * @memberof google.protobuf.FileDescriptorProto + * CustomHttpPattern kind. + * @member {string} kind + * @memberof google.api.CustomHttpPattern * @instance */ - FileDescriptorProto.prototype.syntax = ""; + CustomHttpPattern.prototype.kind = ""; /** - * FileDescriptorProto edition. - * @member {google.protobuf.Edition} edition - * @memberof google.protobuf.FileDescriptorProto + * CustomHttpPattern path. + * @member {string} path + * @memberof google.api.CustomHttpPattern * @instance */ - FileDescriptorProto.prototype.edition = 0; + CustomHttpPattern.prototype.path = ""; /** - * Creates a new FileDescriptorProto instance using the specified properties. + * Creates a new CustomHttpPattern instance using the specified properties. * @function create - * @memberof google.protobuf.FileDescriptorProto + * @memberof google.api.CustomHttpPattern * @static - * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance */ - FileDescriptorProto.create = function create(properties) { - return new FileDescriptorProto(properties); + CustomHttpPattern.create = function create(properties) { + return new CustomHttpPattern(properties); }; /** - * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. * @function encode - * @memberof google.protobuf.FileDescriptorProto + * @memberof google.api.CustomHttpPattern * @static - * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FileDescriptorProto.encode = function encode(message, writer) { + CustomHttpPattern.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); - if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]); - if (message.dependency != null && message.dependency.length) - for (var i = 0; i < message.dependency.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); - if (message.messageType != null && message.messageType.length) - for (var i = 0; i < message.messageType.length; ++i) - $root.google.protobuf.DescriptorProto.encode(message.messageType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.enumType != null && message.enumType.length) - for (var i = 0; i < message.enumType.length; ++i) - $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.service != null && message.service.length) - for (var i = 0; i < message.service.length; ++i) - $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.extension != null && message.extension.length) - for (var i = 0; i < message.extension.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) - $root.google.protobuf.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.publicDependency != null && message.publicDependency.length) - for (var i = 0; i < message.publicDependency.length; ++i) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.publicDependency[i]); - if (message.weakDependency != null && message.weakDependency.length) - for (var i = 0; i < message.weakDependency.length; ++i) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); - if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); - if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); return writer; }; /** - * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FileDescriptorProto + * @memberof google.api.CustomHttpPattern * @static - * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FileDescriptorProto message from the specified reader or buffer. + * Decodes a CustomHttpPattern message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FileDescriptorProto + * @memberof google.api.CustomHttpPattern * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @returns {google.api.CustomHttpPattern} CustomHttpPattern * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FileDescriptorProto.decode = function decode(reader, length, error) { + CustomHttpPattern.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - message.name = reader.string(); + message.kind = reader.string(); break; } case 2: { - message["package"] = reader.string(); - break; - } - case 3: { - if (!(message.dependency && message.dependency.length)) - message.dependency = []; - message.dependency.push(reader.string()); - break; - } - case 10: { - if (!(message.publicDependency && message.publicDependency.length)) - message.publicDependency = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.publicDependency.push(reader.int32()); - } else - message.publicDependency.push(reader.int32()); - break; - } - case 11: { - if (!(message.weakDependency && message.weakDependency.length)) - message.weakDependency = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.weakDependency.push(reader.int32()); - } else - message.weakDependency.push(reader.int32()); - break; - } - case 4: { - if (!(message.messageType && message.messageType.length)) - message.messageType = []; - message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); - break; - } - case 5: { - if (!(message.enumType && message.enumType.length)) - message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 6: { - if (!(message.service && message.service.length)) - message.service = []; - message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 7: { - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 8: { - message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); - break; - } - case 9: { - message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); - break; - } - case 12: { - message.syntax = reader.string(); - break; - } - case 14: { - message.edition = reader.int32(); + message.path = reader.string(); break; } default: @@ -12339,416 +13233,134 @@ }; /** - * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FileDescriptorProto + * @memberof google.api.CustomHttpPattern * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @returns {google.api.CustomHttpPattern} CustomHttpPattern * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FileDescriptorProto message. + * Verifies a CustomHttpPattern message. * @function verify - * @memberof google.protobuf.FileDescriptorProto + * @memberof google.api.CustomHttpPattern * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FileDescriptorProto.verify = function verify(message) { + CustomHttpPattern.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"; - if (message["package"] != null && message.hasOwnProperty("package")) - if (!$util.isString(message["package"])) - return "package: string expected"; - if (message.dependency != null && message.hasOwnProperty("dependency")) { - if (!Array.isArray(message.dependency)) - return "dependency: array expected"; - for (var i = 0; i < message.dependency.length; ++i) - if (!$util.isString(message.dependency[i])) - return "dependency: string[] expected"; - } - if (message.publicDependency != null && message.hasOwnProperty("publicDependency")) { - if (!Array.isArray(message.publicDependency)) - return "publicDependency: array expected"; - for (var i = 0; i < message.publicDependency.length; ++i) - if (!$util.isInteger(message.publicDependency[i])) - return "publicDependency: integer[] expected"; - } - if (message.weakDependency != null && message.hasOwnProperty("weakDependency")) { - if (!Array.isArray(message.weakDependency)) - return "weakDependency: array expected"; - for (var i = 0; i < message.weakDependency.length; ++i) - if (!$util.isInteger(message.weakDependency[i])) - return "weakDependency: integer[] expected"; - } - if (message.messageType != null && message.hasOwnProperty("messageType")) { - if (!Array.isArray(message.messageType)) - return "messageType: array expected"; - for (var i = 0; i < message.messageType.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i]); - if (error) - return "messageType." + error; - } - } - if (message.enumType != null && message.hasOwnProperty("enumType")) { - if (!Array.isArray(message.enumType)) - return "enumType: array expected"; - for (var i = 0; i < message.enumType.length; ++i) { - var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); - if (error) - return "enumType." + error; - } - } - if (message.service != null && message.hasOwnProperty("service")) { - if (!Array.isArray(message.service)) - return "service: array expected"; - for (var i = 0; i < message.service.length; ++i) { - var error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); - if (error) - return "service." + error; - } - } - if (message.extension != null && message.hasOwnProperty("extension")) { - if (!Array.isArray(message.extension)) - return "extension: array expected"; - for (var i = 0; i < message.extension.length; ++i) { - var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); - if (error) - return "extension." + error; - } - } - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.FileOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) { - var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo); - if (error) - return "sourceCodeInfo." + error; - } - if (message.syntax != null && message.hasOwnProperty("syntax")) - if (!$util.isString(message.syntax)) - return "syntax: string expected"; - if (message.edition != null && message.hasOwnProperty("edition")) - switch (message.edition) { - default: - return "edition: enum value expected"; - case 0: - case 998: - case 999: - case 1000: - case 1001: - case 1: - case 2: - case 99997: - case 99998: - case 99999: - case 2147483647: - break; - } + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; return null; }; /** - * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FileDescriptorProto + * @memberof google.api.CustomHttpPattern * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @returns {google.api.CustomHttpPattern} CustomHttpPattern */ - FileDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileDescriptorProto) + CustomHttpPattern.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CustomHttpPattern) return object; - var message = new $root.google.protobuf.FileDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object["package"] != null) - message["package"] = String(object["package"]); - if (object.dependency) { - if (!Array.isArray(object.dependency)) - throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); - message.dependency = []; - for (var i = 0; i < object.dependency.length; ++i) - message.dependency[i] = String(object.dependency[i]); - } - if (object.publicDependency) { - if (!Array.isArray(object.publicDependency)) - throw TypeError(".google.protobuf.FileDescriptorProto.publicDependency: array expected"); - message.publicDependency = []; - for (var i = 0; i < object.publicDependency.length; ++i) - message.publicDependency[i] = object.publicDependency[i] | 0; - } - if (object.weakDependency) { - if (!Array.isArray(object.weakDependency)) - throw TypeError(".google.protobuf.FileDescriptorProto.weakDependency: array expected"); - message.weakDependency = []; - for (var i = 0; i < object.weakDependency.length; ++i) - message.weakDependency[i] = object.weakDependency[i] | 0; - } - if (object.messageType) { - if (!Array.isArray(object.messageType)) - throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); - message.messageType = []; - for (var i = 0; i < object.messageType.length; ++i) { - if (typeof object.messageType[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); - message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i]); - } - } - if (object.enumType) { - if (!Array.isArray(object.enumType)) - throw TypeError(".google.protobuf.FileDescriptorProto.enumType: array expected"); - message.enumType = []; - for (var i = 0; i < object.enumType.length; ++i) { - if (typeof object.enumType[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); - message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); - } - } - if (object.service) { - if (!Array.isArray(object.service)) - throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); - message.service = []; - for (var i = 0; i < object.service.length; ++i) { - if (typeof object.service[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); - message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); - } - } - if (object.extension) { - if (!Array.isArray(object.extension)) - throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); - message.extension = []; - for (var i = 0; i < object.extension.length; ++i) { - if (typeof object.extension[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); - message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.FileOptions.fromObject(object.options); + var message = new $root.google.api.CustomHttpPattern(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomHttpPattern.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.path = ""; } - if (object.sourceCodeInfo != null) { - if (typeof object.sourceCodeInfo !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); - message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo); + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this CustomHttpPattern to JSON. + * @function toJSON + * @memberof google.api.CustomHttpPattern + * @instance + * @returns {Object.} JSON object + */ + CustomHttpPattern.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CustomHttpPattern + * @function getTypeUrl + * @memberof google.api.CustomHttpPattern + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomHttpPattern.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } - if (object.syntax != null) - message.syntax = String(object.syntax); - switch (object.edition) { - default: - if (typeof object.edition === "number") { - message.edition = object.edition; - break; - } - break; - case "EDITION_UNKNOWN": - case 0: - message.edition = 0; - break; - case "EDITION_PROTO2": - case 998: - message.edition = 998; - break; - case "EDITION_PROTO3": - case 999: - message.edition = 999; - break; - case "EDITION_2023": - case 1000: - message.edition = 1000; - break; - case "EDITION_2024": - case 1001: - message.edition = 1001; - break; - case "EDITION_1_TEST_ONLY": - case 1: - message.edition = 1; - break; - case "EDITION_2_TEST_ONLY": - case 2: - message.edition = 2; - break; - case "EDITION_99997_TEST_ONLY": - case 99997: - message.edition = 99997; - break; - case "EDITION_99998_TEST_ONLY": - case 99998: - message.edition = 99998; - break; - case "EDITION_99999_TEST_ONLY": - case 99999: - message.edition = 99999; - break; - case "EDITION_MAX": - case 2147483647: - message.edition = 2147483647; - break; - } - return message; - }; - - /** - * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FileDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.dependency = []; - object.messageType = []; - object.enumType = []; - object.service = []; - object.extension = []; - object.publicDependency = []; - object.weakDependency = []; - } - if (options.defaults) { - object.name = ""; - object["package"] = ""; - object.options = null; - object.sourceCodeInfo = null; - object.syntax = ""; - object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message["package"] != null && message.hasOwnProperty("package")) - object["package"] = message["package"]; - if (message.dependency && message.dependency.length) { - object.dependency = []; - for (var j = 0; j < message.dependency.length; ++j) - object.dependency[j] = message.dependency[j]; - } - if (message.messageType && message.messageType.length) { - object.messageType = []; - for (var j = 0; j < message.messageType.length; ++j) - object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options); - } - if (message.enumType && message.enumType.length) { - object.enumType = []; - for (var j = 0; j < message.enumType.length; ++j) - object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); - } - if (message.service && message.service.length) { - object.service = []; - for (var j = 0; j < message.service.length; ++j) - object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); - } - if (message.extension && message.extension.length) { - object.extension = []; - for (var j = 0; j < message.extension.length; ++j) - object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); - if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) - object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options); - if (message.publicDependency && message.publicDependency.length) { - object.publicDependency = []; - for (var j = 0; j < message.publicDependency.length; ++j) - object.publicDependency[j] = message.publicDependency[j]; - } - if (message.weakDependency && message.weakDependency.length) { - object.weakDependency = []; - for (var j = 0; j < message.weakDependency.length; ++j) - object.weakDependency[j] = message.weakDependency[j]; - } - if (message.syntax != null && message.hasOwnProperty("syntax")) - object.syntax = message.syntax; - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; - return object; - }; - - /** - * Converts this FileDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.FileDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - FileDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FileDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FileDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FileDescriptorProto"; + return typeUrlPrefix + "/google.api.CustomHttpPattern"; }; - return FileDescriptorProto; + return CustomHttpPattern; })(); - protobuf.DescriptorProto = (function() { + api.CommonLanguageSettings = (function() { /** - * Properties of a DescriptorProto. - * @memberof google.protobuf - * @interface IDescriptorProto - * @property {string|null} [name] DescriptorProto name - * @property {Array.|null} [field] DescriptorProto field - * @property {Array.|null} [extension] DescriptorProto extension - * @property {Array.|null} [nestedType] DescriptorProto nestedType - * @property {Array.|null} [enumType] DescriptorProto enumType - * @property {Array.|null} [extensionRange] DescriptorProto extensionRange - * @property {Array.|null} [oneofDecl] DescriptorProto oneofDecl - * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options - * @property {Array.|null} [reservedRange] DescriptorProto reservedRange - * @property {Array.|null} [reservedName] DescriptorProto reservedName + * Properties of a CommonLanguageSettings. + * @memberof google.api + * @interface ICommonLanguageSettings + * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri + * @property {Array.|null} [destinations] CommonLanguageSettings destinations + * @property {google.api.ISelectiveGapicGeneration|null} [selectiveGapicGeneration] CommonLanguageSettings selectiveGapicGeneration */ /** - * Constructs a new DescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a DescriptorProto. - * @implements IDescriptorProto + * Constructs a new CommonLanguageSettings. + * @memberof google.api + * @classdesc Represents a CommonLanguageSettings. + * @implements ICommonLanguageSettings * @constructor - * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + * @param {google.api.ICommonLanguageSettings=} [properties] Properties to set */ - function DescriptorProto(properties) { - this.field = []; - this.extension = []; - this.nestedType = []; - this.enumType = []; - this.extensionRange = []; - this.oneofDecl = []; - this.reservedRange = []; - this.reservedName = []; + function CommonLanguageSettings(properties) { + this.destinations = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -12756,227 +13368,116 @@ } /** - * DescriptorProto name. - * @member {string} name - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.name = ""; - - /** - * DescriptorProto field. - * @member {Array.} field - * @memberof google.protobuf.DescriptorProto + * CommonLanguageSettings referenceDocsUri. + * @member {string} referenceDocsUri + * @memberof google.api.CommonLanguageSettings * @instance */ - DescriptorProto.prototype.field = $util.emptyArray; + CommonLanguageSettings.prototype.referenceDocsUri = ""; /** - * DescriptorProto extension. - * @member {Array.} extension - * @memberof google.protobuf.DescriptorProto + * CommonLanguageSettings destinations. + * @member {Array.} destinations + * @memberof google.api.CommonLanguageSettings * @instance */ - DescriptorProto.prototype.extension = $util.emptyArray; + CommonLanguageSettings.prototype.destinations = $util.emptyArray; /** - * DescriptorProto nestedType. - * @member {Array.} nestedType - * @memberof google.protobuf.DescriptorProto + * CommonLanguageSettings selectiveGapicGeneration. + * @member {google.api.ISelectiveGapicGeneration|null|undefined} selectiveGapicGeneration + * @memberof google.api.CommonLanguageSettings * @instance */ - DescriptorProto.prototype.nestedType = $util.emptyArray; + CommonLanguageSettings.prototype.selectiveGapicGeneration = null; /** - * DescriptorProto enumType. - * @member {Array.} enumType - * @memberof google.protobuf.DescriptorProto - * @instance + * Creates a new CommonLanguageSettings instance using the specified properties. + * @function create + * @memberof google.api.CommonLanguageSettings + * @static + * @param {google.api.ICommonLanguageSettings=} [properties] Properties to set + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings instance */ - DescriptorProto.prototype.enumType = $util.emptyArray; + CommonLanguageSettings.create = function create(properties) { + return new CommonLanguageSettings(properties); + }; /** - * DescriptorProto extensionRange. - * @member {Array.} extensionRange - * @memberof google.protobuf.DescriptorProto - * @instance + * Encodes the specified CommonLanguageSettings message. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. + * @function encode + * @memberof google.api.CommonLanguageSettings + * @static + * @param {google.api.ICommonLanguageSettings} message CommonLanguageSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - DescriptorProto.prototype.extensionRange = $util.emptyArray; - - /** - * DescriptorProto oneofDecl. - * @member {Array.} oneofDecl - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.oneofDecl = $util.emptyArray; - - /** - * DescriptorProto options. - * @member {google.protobuf.IMessageOptions|null|undefined} options - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.options = null; - - /** - * DescriptorProto reservedRange. - * @member {Array.} reservedRange - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.reservedRange = $util.emptyArray; - - /** - * DescriptorProto reservedName. - * @member {Array.} reservedName - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.reservedName = $util.emptyArray; - - /** - * Creates a new DescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.DescriptorProto - * @static - * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.DescriptorProto} DescriptorProto instance - */ - DescriptorProto.create = function create(properties) { - return new DescriptorProto(properties); - }; - - /** - * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.DescriptorProto - * @static - * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DescriptorProto.encode = function encode(message, writer) { + CommonLanguageSettings.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); - if (message.field != null && message.field.length) - for (var i = 0; i < message.field.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.nestedType != null && message.nestedType.length) - for (var i = 0; i < message.nestedType.length; ++i) - $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.enumType != null && message.enumType.length) - for (var i = 0; i < message.enumType.length; ++i) - $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.extensionRange != null && message.extensionRange.length) - for (var i = 0; i < message.extensionRange.length; ++i) - $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.extension != null && message.extension.length) - for (var i = 0; i < message.extension.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.oneofDecl != null && message.oneofDecl.length) - for (var i = 0; i < message.oneofDecl.length; ++i) - $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.reservedRange != null && message.reservedRange.length) - for (var i = 0; i < message.reservedRange.length; ++i) - $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.reservedName != null && message.reservedName.length) - for (var i = 0; i < message.reservedName.length; ++i) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + if (message.referenceDocsUri != null && Object.hasOwnProperty.call(message, "referenceDocsUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.referenceDocsUri); + if (message.destinations != null && message.destinations.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.destinations.length; ++i) + writer.int32(message.destinations[i]); + writer.ldelim(); + } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * Encodes the specified CommonLanguageSettings message, length delimited. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.DescriptorProto + * @memberof google.api.CommonLanguageSettings * @static - * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {google.api.ICommonLanguageSettings} message CommonLanguageSettings message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + CommonLanguageSettings.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DescriptorProto message from the specified reader or buffer. + * Decodes a CommonLanguageSettings message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.DescriptorProto + * @memberof google.api.CommonLanguageSettings * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DescriptorProto.decode = function decode(reader, length, error) { + CommonLanguageSettings.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CommonLanguageSettings(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - message.name = reader.string(); + message.referenceDocsUri = reader.string(); break; } case 2: { - if (!(message.field && message.field.length)) - message.field = []; - message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 6: { - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + if (!(message.destinations && message.destinations.length)) + message.destinations = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.destinations.push(reader.int32()); + } else + message.destinations.push(reader.int32()); break; } case 3: { - if (!(message.nestedType && message.nestedType.length)) - message.nestedType = []; - message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); - break; - } - case 4: { - if (!(message.enumType && message.enumType.length)) - message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 5: { - if (!(message.extensionRange && message.extensionRange.length)) - message.extensionRange = []; - message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); - break; - } - case 8: { - if (!(message.oneofDecl && message.oneofDecl.length)) - message.oneofDecl = []; - message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 7: { - message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); - break; - } - case 9: { - if (!(message.reservedRange && message.reservedRange.length)) - message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); - break; - } - case 10: { - if (!(message.reservedName && message.reservedName.length)) - message.reservedName = []; - message.reservedName.push(reader.string()); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32()); break; } default: @@ -12988,1484 +13489,11117 @@ }; /** - * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * Decodes a CommonLanguageSettings message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.DescriptorProto + * @memberof google.api.CommonLanguageSettings * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DescriptorProto.decodeDelimited = function decodeDelimited(reader) { + CommonLanguageSettings.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DescriptorProto message. + * Verifies a CommonLanguageSettings message. * @function verify - * @memberof google.protobuf.DescriptorProto + * @memberof google.api.CommonLanguageSettings * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DescriptorProto.verify = function verify(message) { + CommonLanguageSettings.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"; - if (message.field != null && message.hasOwnProperty("field")) { - if (!Array.isArray(message.field)) - return "field: array expected"; - for (var i = 0; i < message.field.length; ++i) { - var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); - if (error) - return "field." + error; - } - } - if (message.extension != null && message.hasOwnProperty("extension")) { - if (!Array.isArray(message.extension)) - return "extension: array expected"; - for (var i = 0; i < message.extension.length; ++i) { - var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); - if (error) - return "extension." + error; - } - } - if (message.nestedType != null && message.hasOwnProperty("nestedType")) { - if (!Array.isArray(message.nestedType)) - return "nestedType: array expected"; - for (var i = 0; i < message.nestedType.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i]); - if (error) - return "nestedType." + error; - } - } - if (message.enumType != null && message.hasOwnProperty("enumType")) { - if (!Array.isArray(message.enumType)) - return "enumType: array expected"; - for (var i = 0; i < message.enumType.length; ++i) { - var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); - if (error) - return "enumType." + error; - } - } - if (message.extensionRange != null && message.hasOwnProperty("extensionRange")) { - if (!Array.isArray(message.extensionRange)) - return "extensionRange: array expected"; - for (var i = 0; i < message.extensionRange.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i]); - if (error) - return "extensionRange." + error; - } - } - if (message.oneofDecl != null && message.hasOwnProperty("oneofDecl")) { - if (!Array.isArray(message.oneofDecl)) - return "oneofDecl: array expected"; - for (var i = 0; i < message.oneofDecl.length; ++i) { - var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i]); - if (error) - return "oneofDecl." + error; - } + if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) + if (!$util.isString(message.referenceDocsUri)) + return "referenceDocsUri: string expected"; + if (message.destinations != null && message.hasOwnProperty("destinations")) { + if (!Array.isArray(message.destinations)) + return "destinations: array expected"; + for (var i = 0; i < message.destinations.length; ++i) + switch (message.destinations[i]) { + default: + return "destinations: enum value[] expected"; + case 0: + case 10: + case 20: + break; + } } - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.MessageOptions.verify(message.options); + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { + var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration); if (error) - return "options." + error; - } - if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { - if (!Array.isArray(message.reservedRange)) - return "reservedRange: array expected"; - for (var i = 0; i < message.reservedRange.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i]); - if (error) - return "reservedRange." + error; - } - } - if (message.reservedName != null && message.hasOwnProperty("reservedName")) { - if (!Array.isArray(message.reservedName)) - return "reservedName: array expected"; - for (var i = 0; i < message.reservedName.length; ++i) - if (!$util.isString(message.reservedName[i])) - return "reservedName: string[] expected"; + return "selectiveGapicGeneration." + error; } return null; }; /** - * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * Creates a CommonLanguageSettings message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.DescriptorProto + * @memberof google.api.CommonLanguageSettings * @static * @param {Object.} object Plain object - * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings */ - DescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DescriptorProto) + CommonLanguageSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CommonLanguageSettings) return object; - var message = new $root.google.protobuf.DescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.field) { - if (!Array.isArray(object.field)) - throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); - message.field = []; - for (var i = 0; i < object.field.length; ++i) { - if (typeof object.field[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); - message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); - } - } - if (object.extension) { - if (!Array.isArray(object.extension)) - throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); - message.extension = []; - for (var i = 0; i < object.extension.length; ++i) { - if (typeof object.extension[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); - message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); - } - } - if (object.nestedType) { - if (!Array.isArray(object.nestedType)) - throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); - message.nestedType = []; - for (var i = 0; i < object.nestedType.length; ++i) { - if (typeof object.nestedType[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); - message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i]); - } - } - if (object.enumType) { - if (!Array.isArray(object.enumType)) - throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); - message.enumType = []; - for (var i = 0; i < object.enumType.length; ++i) { - if (typeof object.enumType[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); - message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); - } - } - if (object.extensionRange) { - if (!Array.isArray(object.extensionRange)) - throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); - message.extensionRange = []; - for (var i = 0; i < object.extensionRange.length; ++i) { - if (typeof object.extensionRange[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); - message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i]); - } - } - if (object.oneofDecl) { - if (!Array.isArray(object.oneofDecl)) - throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); - message.oneofDecl = []; - for (var i = 0; i < object.oneofDecl.length; ++i) { - if (typeof object.oneofDecl[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); - message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); - message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); - } - if (object.reservedRange) { - if (!Array.isArray(object.reservedRange)) - throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); - message.reservedRange = []; - for (var i = 0; i < object.reservedRange.length; ++i) { - if (typeof object.reservedRange[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); - message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i]); - } + var message = new $root.google.api.CommonLanguageSettings(); + if (object.referenceDocsUri != null) + message.referenceDocsUri = String(object.referenceDocsUri); + if (object.destinations) { + if (!Array.isArray(object.destinations)) + throw TypeError(".google.api.CommonLanguageSettings.destinations: array expected"); + message.destinations = []; + for (var i = 0; i < object.destinations.length; ++i) + switch (object.destinations[i]) { + default: + if (typeof object.destinations[i] === "number") { + message.destinations[i] = object.destinations[i]; + break; + } + case "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": + case 0: + message.destinations[i] = 0; + break; + case "GITHUB": + case 10: + message.destinations[i] = 10; + break; + case "PACKAGE_MANAGER": + case 20: + message.destinations[i] = 20; + break; + } } - if (object.reservedName) { - if (!Array.isArray(object.reservedName)) - throw TypeError(".google.protobuf.DescriptorProto.reservedName: array expected"); - message.reservedName = []; - for (var i = 0; i < object.reservedName.length; ++i) - message.reservedName[i] = String(object.reservedName[i]); + if (object.selectiveGapicGeneration != null) { + if (typeof object.selectiveGapicGeneration !== "object") + throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration); } return message; }; /** - * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * Creates a plain object from a CommonLanguageSettings message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.DescriptorProto + * @memberof google.api.CommonLanguageSettings * @static - * @param {google.protobuf.DescriptorProto} message DescriptorProto + * @param {google.api.CommonLanguageSettings} message CommonLanguageSettings * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DescriptorProto.toObject = function toObject(message, options) { + CommonLanguageSettings.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.field = []; - object.nestedType = []; - object.enumType = []; - object.extensionRange = []; - object.extension = []; - object.oneofDecl = []; - object.reservedRange = []; - object.reservedName = []; - } + if (options.arrays || options.defaults) + object.destinations = []; if (options.defaults) { - object.name = ""; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.field && message.field.length) { - object.field = []; - for (var j = 0; j < message.field.length; ++j) - object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); - } - if (message.nestedType && message.nestedType.length) { - object.nestedType = []; - for (var j = 0; j < message.nestedType.length; ++j) - object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options); - } - if (message.enumType && message.enumType.length) { - object.enumType = []; - for (var j = 0; j < message.enumType.length; ++j) - object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); - } - if (message.extensionRange && message.extensionRange.length) { - object.extensionRange = []; - for (var j = 0; j < message.extensionRange.length; ++j) - object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options); - } - if (message.extension && message.extension.length) { - object.extension = []; - for (var j = 0; j < message.extension.length; ++j) - object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); - if (message.oneofDecl && message.oneofDecl.length) { - object.oneofDecl = []; - for (var j = 0; j < message.oneofDecl.length; ++j) - object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options); - } - if (message.reservedRange && message.reservedRange.length) { - object.reservedRange = []; - for (var j = 0; j < message.reservedRange.length; ++j) - object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options); + object.referenceDocsUri = ""; + object.selectiveGapicGeneration = null; } - if (message.reservedName && message.reservedName.length) { - object.reservedName = []; - for (var j = 0; j < message.reservedName.length; ++j) - object.reservedName[j] = message.reservedName[j]; + if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) + object.referenceDocsUri = message.referenceDocsUri; + if (message.destinations && message.destinations.length) { + object.destinations = []; + for (var j = 0; j < message.destinations.length; ++j) + object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) + object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options); return object; }; /** - * Converts this DescriptorProto to JSON. + * Converts this CommonLanguageSettings to JSON. * @function toJSON - * @memberof google.protobuf.DescriptorProto + * @memberof google.api.CommonLanguageSettings * @instance * @returns {Object.} JSON object */ - DescriptorProto.prototype.toJSON = function toJSON() { + CommonLanguageSettings.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for DescriptorProto + * Gets the default type url for CommonLanguageSettings * @function getTypeUrl - * @memberof google.protobuf.DescriptorProto + * @memberof google.api.CommonLanguageSettings * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - DescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + CommonLanguageSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.DescriptorProto"; + return typeUrlPrefix + "/google.api.CommonLanguageSettings"; }; - DescriptorProto.ExtensionRange = (function() { - - /** - * Properties of an ExtensionRange. - * @memberof google.protobuf.DescriptorProto - * @interface IExtensionRange - * @property {number|null} [start] ExtensionRange start - * @property {number|null} [end] ExtensionRange end - * @property {google.protobuf.IExtensionRangeOptions|null} [options] ExtensionRange options - */ - - /** - * Constructs a new ExtensionRange. - * @memberof google.protobuf.DescriptorProto - * @classdesc Represents an ExtensionRange. - * @implements IExtensionRange - * @constructor - * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set - */ - function ExtensionRange(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]]; - } + return CommonLanguageSettings; + })(); - /** - * ExtensionRange start. - * @member {number} start - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - */ - ExtensionRange.prototype.start = 0; + api.ClientLibrarySettings = (function() { - /** - * ExtensionRange end. - * @member {number} end - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - */ - ExtensionRange.prototype.end = 0; + /** + * Properties of a ClientLibrarySettings. + * @memberof google.api + * @interface IClientLibrarySettings + * @property {string|null} [version] ClientLibrarySettings version + * @property {google.api.LaunchStage|null} [launchStage] ClientLibrarySettings launchStage + * @property {boolean|null} [restNumericEnums] ClientLibrarySettings restNumericEnums + * @property {google.api.IJavaSettings|null} [javaSettings] ClientLibrarySettings javaSettings + * @property {google.api.ICppSettings|null} [cppSettings] ClientLibrarySettings cppSettings + * @property {google.api.IPhpSettings|null} [phpSettings] ClientLibrarySettings phpSettings + * @property {google.api.IPythonSettings|null} [pythonSettings] ClientLibrarySettings pythonSettings + * @property {google.api.INodeSettings|null} [nodeSettings] ClientLibrarySettings nodeSettings + * @property {google.api.IDotnetSettings|null} [dotnetSettings] ClientLibrarySettings dotnetSettings + * @property {google.api.IRubySettings|null} [rubySettings] ClientLibrarySettings rubySettings + * @property {google.api.IGoSettings|null} [goSettings] ClientLibrarySettings goSettings + */ - /** - * ExtensionRange options. - * @member {google.protobuf.IExtensionRangeOptions|null|undefined} options - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - */ - ExtensionRange.prototype.options = null; + /** + * Constructs a new ClientLibrarySettings. + * @memberof google.api + * @classdesc Represents a ClientLibrarySettings. + * @implements IClientLibrarySettings + * @constructor + * @param {google.api.IClientLibrarySettings=} [properties] Properties to set + */ + function ClientLibrarySettings(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]]; + } - /** - * Creates a new ExtensionRange instance using the specified properties. - * @function create - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance - */ - ExtensionRange.create = function create(properties) { - return new ExtensionRange(properties); - }; + /** + * ClientLibrarySettings version. + * @member {string} version + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.version = ""; - /** - * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. - * @function encode - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExtensionRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.start != null && Object.hasOwnProperty.call(message, "start")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; + /** + * ClientLibrarySettings launchStage. + * @member {google.api.LaunchStage} launchStage + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.launchStage = 0; - /** - * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * ClientLibrarySettings restNumericEnums. + * @member {boolean} restNumericEnums + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.restNumericEnums = false; - /** - * Decodes an ExtensionRange message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExtensionRange.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.start = reader.int32(); - break; - } - case 2: { - message.end = reader.int32(); - break; - } - case 3: { - message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * ClientLibrarySettings javaSettings. + * @member {google.api.IJavaSettings|null|undefined} javaSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.javaSettings = null; - /** - * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExtensionRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * ClientLibrarySettings cppSettings. + * @member {google.api.ICppSettings|null|undefined} cppSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.cppSettings = null; - /** - * Verifies an ExtensionRange message. - * @function verify - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExtensionRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.start != null && message.hasOwnProperty("start")) - if (!$util.isInteger(message.start)) - return "start: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options); - if (error) - return "options." + error; - } - return null; - }; + /** + * ClientLibrarySettings phpSettings. + * @member {google.api.IPhpSettings|null|undefined} phpSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.phpSettings = null; - /** - * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange - */ - ExtensionRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) - return object; - var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); - if (object.start != null) - message.start = object.start | 0; - if (object.end != null) - message.end = object.end | 0; - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); - message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options); - } - return message; - }; + /** + * ClientLibrarySettings pythonSettings. + * @member {google.api.IPythonSettings|null|undefined} pythonSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.pythonSettings = null; - /** - * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExtensionRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.start = 0; - object.end = 0; - object.options = null; - } - if (message.start != null && message.hasOwnProperty("start")) - object.start = message.start; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options); - return object; - }; - - /** - * Converts this ExtensionRange to JSON. - * @function toJSON - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - * @returns {Object.} JSON object - */ - ExtensionRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExtensionRange - * @function getTypeUrl - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExtensionRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.DescriptorProto.ExtensionRange"; - }; - - return ExtensionRange; - })(); - - DescriptorProto.ReservedRange = (function() { - - /** - * Properties of a ReservedRange. - * @memberof google.protobuf.DescriptorProto - * @interface IReservedRange - * @property {number|null} [start] ReservedRange start - * @property {number|null} [end] ReservedRange end - */ + /** + * ClientLibrarySettings nodeSettings. + * @member {google.api.INodeSettings|null|undefined} nodeSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.nodeSettings = null; - /** - * Constructs a new ReservedRange. - * @memberof google.protobuf.DescriptorProto - * @classdesc Represents a ReservedRange. - * @implements IReservedRange - * @constructor - * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set - */ - function ReservedRange(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]]; - } + /** + * ClientLibrarySettings dotnetSettings. + * @member {google.api.IDotnetSettings|null|undefined} dotnetSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.dotnetSettings = null; - /** - * ReservedRange start. - * @member {number} start - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @instance - */ - ReservedRange.prototype.start = 0; + /** + * ClientLibrarySettings rubySettings. + * @member {google.api.IRubySettings|null|undefined} rubySettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.rubySettings = null; - /** - * ReservedRange end. - * @member {number} end - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @instance - */ - ReservedRange.prototype.end = 0; + /** + * ClientLibrarySettings goSettings. + * @member {google.api.IGoSettings|null|undefined} goSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.goSettings = null; - /** - * Creates a new ReservedRange instance using the specified properties. - * @function create - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance - */ - ReservedRange.create = function create(properties) { - return new ReservedRange(properties); - }; + /** + * Creates a new ClientLibrarySettings instance using the specified properties. + * @function create + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.IClientLibrarySettings=} [properties] Properties to set + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings instance + */ + ClientLibrarySettings.create = function create(properties) { + return new ClientLibrarySettings(properties); + }; - /** - * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. - * @function encode - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReservedRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.start != null && Object.hasOwnProperty.call(message, "start")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); - return writer; - }; + /** + * Encodes the specified ClientLibrarySettings message. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. + * @function encode + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.IClientLibrarySettings} message ClientLibrarySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientLibrarySettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.launchStage); + if (message.restNumericEnums != null && Object.hasOwnProperty.call(message, "restNumericEnums")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.restNumericEnums); + if (message.javaSettings != null && Object.hasOwnProperty.call(message, "javaSettings")) + $root.google.api.JavaSettings.encode(message.javaSettings, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.cppSettings != null && Object.hasOwnProperty.call(message, "cppSettings")) + $root.google.api.CppSettings.encode(message.cppSettings, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.phpSettings != null && Object.hasOwnProperty.call(message, "phpSettings")) + $root.google.api.PhpSettings.encode(message.phpSettings, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.pythonSettings != null && Object.hasOwnProperty.call(message, "pythonSettings")) + $root.google.api.PythonSettings.encode(message.pythonSettings, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.nodeSettings != null && Object.hasOwnProperty.call(message, "nodeSettings")) + $root.google.api.NodeSettings.encode(message.nodeSettings, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + if (message.dotnetSettings != null && Object.hasOwnProperty.call(message, "dotnetSettings")) + $root.google.api.DotnetSettings.encode(message.dotnetSettings, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); + if (message.rubySettings != null && Object.hasOwnProperty.call(message, "rubySettings")) + $root.google.api.RubySettings.encode(message.rubySettings, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); + if (message.goSettings != null && Object.hasOwnProperty.call(message, "goSettings")) + $root.google.api.GoSettings.encode(message.goSettings, writer.uint32(/* id 28, wireType 2 =*/226).fork()).ldelim(); + return writer; + }; - /** - * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified ClientLibrarySettings message, length delimited. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.IClientLibrarySettings} message ClientLibrarySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientLibrarySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a ReservedRange message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReservedRange.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) + /** + * Decodes a ClientLibrarySettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.ClientLibrarySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientLibrarySettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ClientLibrarySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.version = reader.string(); break; - switch (tag >>> 3) { - case 1: { - message.start = reader.int32(); - break; - } - case 2: { - message.end = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); + } + case 2: { + message.launchStage = reader.int32(); break; } + case 3: { + message.restNumericEnums = reader.bool(); + break; + } + case 21: { + message.javaSettings = $root.google.api.JavaSettings.decode(reader, reader.uint32()); + break; + } + case 22: { + message.cppSettings = $root.google.api.CppSettings.decode(reader, reader.uint32()); + break; + } + case 23: { + message.phpSettings = $root.google.api.PhpSettings.decode(reader, reader.uint32()); + break; + } + case 24: { + message.pythonSettings = $root.google.api.PythonSettings.decode(reader, reader.uint32()); + break; + } + case 25: { + message.nodeSettings = $root.google.api.NodeSettings.decode(reader, reader.uint32()); + break; + } + case 26: { + message.dotnetSettings = $root.google.api.DotnetSettings.decode(reader, reader.uint32()); + break; + } + case 27: { + message.rubySettings = $root.google.api.RubySettings.decode(reader, reader.uint32()); + break; + } + case 28: { + message.goSettings = $root.google.api.GoSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; } - return message; - }; - - /** - * Decodes a ReservedRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReservedRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReservedRange message. - * @function verify - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReservedRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.start != null && message.hasOwnProperty("start")) - if (!$util.isInteger(message.start)) - return "start: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; - return null; - }; - - /** - * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange - */ - ReservedRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) - return object; - var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); - if (object.start != null) - message.start = object.start | 0; - if (object.end != null) - message.end = object.end | 0; - return message; - }; - - /** - * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReservedRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.start = 0; - object.end = 0; - } - if (message.start != null && message.hasOwnProperty("start")) - object.start = message.start; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; - return object; - }; - - /** - * Converts this ReservedRange to JSON. - * @function toJSON - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @instance - * @returns {Object.} JSON object - */ - ReservedRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReservedRange - * @function getTypeUrl - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.DescriptorProto.ReservedRange"; - }; - - return ReservedRange; - })(); - - return DescriptorProto; - })(); - - protobuf.ExtensionRangeOptions = (function() { - - /** - * Properties of an ExtensionRangeOptions. - * @memberof google.protobuf - * @interface IExtensionRangeOptions - * @property {Array.|null} [uninterpretedOption] ExtensionRangeOptions uninterpretedOption - * @property {Array.|null} [declaration] ExtensionRangeOptions declaration - * @property {google.protobuf.IFeatureSet|null} [features] ExtensionRangeOptions features - * @property {google.protobuf.ExtensionRangeOptions.VerificationState|null} [verification] ExtensionRangeOptions verification - */ - - /** - * Constructs a new ExtensionRangeOptions. - * @memberof google.protobuf - * @classdesc Represents an ExtensionRangeOptions. - * @implements IExtensionRangeOptions - * @constructor - * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set - */ - function ExtensionRangeOptions(properties) { - this.uninterpretedOption = []; - this.declaration = []; - 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]]; - } - - /** - * ExtensionRangeOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.ExtensionRangeOptions - * @instance - */ - ExtensionRangeOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * ExtensionRangeOptions declaration. - * @member {Array.} declaration - * @memberof google.protobuf.ExtensionRangeOptions - * @instance - */ - ExtensionRangeOptions.prototype.declaration = $util.emptyArray; - - /** - * ExtensionRangeOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.ExtensionRangeOptions - * @instance - */ - ExtensionRangeOptions.prototype.features = null; - - /** - * ExtensionRangeOptions verification. - * @member {google.protobuf.ExtensionRangeOptions.VerificationState} verification - * @memberof google.protobuf.ExtensionRangeOptions - * @instance - */ - ExtensionRangeOptions.prototype.verification = 1; + } + return message; + }; /** - * Creates a new ExtensionRangeOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.ExtensionRangeOptions + * Decodes a ClientLibrarySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ClientLibrarySettings * @static - * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set - * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions instance + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ExtensionRangeOptions.create = function create(properties) { - return new ExtensionRangeOptions(properties); + ClientLibrarySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); }; /** - * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.ExtensionRangeOptions + * Verifies a ClientLibrarySettings message. + * @function verify + * @memberof google.api.ClientLibrarySettings * @static - * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ExtensionRangeOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.declaration != null && message.declaration.length) - for (var i = 0; i < message.declaration.length; ++i) - $root.google.protobuf.ExtensionRangeOptions.Declaration.encode(message.declaration[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.verification != null && Object.hasOwnProperty.call(message, "verification")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.verification); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExtensionRangeOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExtensionRangeOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExtensionRangeOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 2: { - if (!(message.declaration && message.declaration.length)) - message.declaration = []; - message.declaration.push($root.google.protobuf.ExtensionRangeOptions.Declaration.decode(reader, reader.uint32())); - break; - } - case 50: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 3: { - message.verification = reader.int32(); - break; - } + ClientLibrarySettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + switch (message.launchStage) { default: - reader.skipType(tag & 7); + return "launchStage: enum value expected"; + case 0: + case 6: + case 7: + case 1: + case 2: + case 3: + case 4: + case 5: break; } + if (message.restNumericEnums != null && message.hasOwnProperty("restNumericEnums")) + if (typeof message.restNumericEnums !== "boolean") + return "restNumericEnums: boolean expected"; + if (message.javaSettings != null && message.hasOwnProperty("javaSettings")) { + var error = $root.google.api.JavaSettings.verify(message.javaSettings); + if (error) + return "javaSettings." + error; } - return message; - }; - - /** - * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExtensionRangeOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExtensionRangeOptions message. - * @function verify - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExtensionRangeOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } + if (message.cppSettings != null && message.hasOwnProperty("cppSettings")) { + var error = $root.google.api.CppSettings.verify(message.cppSettings); + if (error) + return "cppSettings." + error; } - if (message.declaration != null && message.hasOwnProperty("declaration")) { - if (!Array.isArray(message.declaration)) - return "declaration: array expected"; - for (var i = 0; i < message.declaration.length; ++i) { - var error = $root.google.protobuf.ExtensionRangeOptions.Declaration.verify(message.declaration[i]); - if (error) - return "declaration." + error; - } + if (message.phpSettings != null && message.hasOwnProperty("phpSettings")) { + var error = $root.google.api.PhpSettings.verify(message.phpSettings); + if (error) + return "phpSettings." + error; } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (message.pythonSettings != null && message.hasOwnProperty("pythonSettings")) { + var error = $root.google.api.PythonSettings.verify(message.pythonSettings); if (error) - return "features." + error; + return "pythonSettings." + error; + } + if (message.nodeSettings != null && message.hasOwnProperty("nodeSettings")) { + var error = $root.google.api.NodeSettings.verify(message.nodeSettings); + if (error) + return "nodeSettings." + error; + } + if (message.dotnetSettings != null && message.hasOwnProperty("dotnetSettings")) { + var error = $root.google.api.DotnetSettings.verify(message.dotnetSettings); + if (error) + return "dotnetSettings." + error; + } + if (message.rubySettings != null && message.hasOwnProperty("rubySettings")) { + var error = $root.google.api.RubySettings.verify(message.rubySettings); + if (error) + return "rubySettings." + error; + } + if (message.goSettings != null && message.hasOwnProperty("goSettings")) { + var error = $root.google.api.GoSettings.verify(message.goSettings); + if (error) + return "goSettings." + error; } - if (message.verification != null && message.hasOwnProperty("verification")) - switch (message.verification) { - default: - return "verification: enum value expected"; - case 0: - case 1: - break; - } return null; }; /** - * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * Creates a ClientLibrarySettings message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.ExtensionRangeOptions + * @memberof google.api.ClientLibrarySettings * @static * @param {Object.} object Plain object - * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings */ - ExtensionRangeOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ExtensionRangeOptions) + ClientLibrarySettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ClientLibrarySettings) return object; - var message = new $root.google.protobuf.ExtensionRangeOptions(); - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object.declaration) { - if (!Array.isArray(object.declaration)) - throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: array expected"); - message.declaration = []; - for (var i = 0; i < object.declaration.length; ++i) { - if (typeof object.declaration[i] !== "object") - throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: object expected"); - message.declaration[i] = $root.google.protobuf.ExtensionRangeOptions.Declaration.fromObject(object.declaration[i]); - } - } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.ExtensionRangeOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - switch (object.verification) { - case "DECLARATION": - case 0: - message.verification = 0; - break; + var message = new $root.google.api.ClientLibrarySettings(); + if (object.version != null) + message.version = String(object.version); + switch (object.launchStage) { default: - if (typeof object.verification === "number") { - message.verification = object.verification; + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; break; } break; - case "UNVERIFIED": + case "LAUNCH_STAGE_UNSPECIFIED": + case 0: + message.launchStage = 0; + break; + case "UNIMPLEMENTED": + case 6: + message.launchStage = 6; + break; + case "PRELAUNCH": + case 7: + message.launchStage = 7; + break; + case "EARLY_ACCESS": case 1: - message.verification = 1; + message.launchStage = 1; + break; + case "ALPHA": + case 2: + message.launchStage = 2; + break; + case "BETA": + case 3: + message.launchStage = 3; + break; + case "GA": + case 4: + message.launchStage = 4; + break; + case "DEPRECATED": + case 5: + message.launchStage = 5; break; } - return message; - }; - - /** - * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + if (object.restNumericEnums != null) + message.restNumericEnums = Boolean(object.restNumericEnums); + if (object.javaSettings != null) { + if (typeof object.javaSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.javaSettings: object expected"); + message.javaSettings = $root.google.api.JavaSettings.fromObject(object.javaSettings); + } + if (object.cppSettings != null) { + if (typeof object.cppSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.cppSettings: object expected"); + message.cppSettings = $root.google.api.CppSettings.fromObject(object.cppSettings); + } + if (object.phpSettings != null) { + if (typeof object.phpSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.phpSettings: object expected"); + message.phpSettings = $root.google.api.PhpSettings.fromObject(object.phpSettings); + } + if (object.pythonSettings != null) { + if (typeof object.pythonSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.pythonSettings: object expected"); + message.pythonSettings = $root.google.api.PythonSettings.fromObject(object.pythonSettings); + } + if (object.nodeSettings != null) { + if (typeof object.nodeSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.nodeSettings: object expected"); + message.nodeSettings = $root.google.api.NodeSettings.fromObject(object.nodeSettings); + } + if (object.dotnetSettings != null) { + if (typeof object.dotnetSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.dotnetSettings: object expected"); + message.dotnetSettings = $root.google.api.DotnetSettings.fromObject(object.dotnetSettings); + } + if (object.rubySettings != null) { + if (typeof object.rubySettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.rubySettings: object expected"); + message.rubySettings = $root.google.api.RubySettings.fromObject(object.rubySettings); + } + if (object.goSettings != null) { + if (typeof object.goSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.goSettings: object expected"); + message.goSettings = $root.google.api.GoSettings.fromObject(object.goSettings); + } + return message; + }; + + /** + * Creates a plain object from a ClientLibrarySettings message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.ExtensionRangeOptions + * @memberof google.api.ClientLibrarySettings * @static - * @param {google.protobuf.ExtensionRangeOptions} message ExtensionRangeOptions + * @param {google.api.ClientLibrarySettings} message ClientLibrarySettings * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ExtensionRangeOptions.toObject = function toObject(message, options) { + ClientLibrarySettings.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.declaration = []; - object.uninterpretedOption = []; - } if (options.defaults) { - object.verification = options.enums === String ? "UNVERIFIED" : 1; - object.features = null; - } - if (message.declaration && message.declaration.length) { - object.declaration = []; - for (var j = 0; j < message.declaration.length; ++j) - object.declaration[j] = $root.google.protobuf.ExtensionRangeOptions.Declaration.toObject(message.declaration[j], options); - } - if (message.verification != null && message.hasOwnProperty("verification")) - object.verification = options.enums === String ? $root.google.protobuf.ExtensionRangeOptions.VerificationState[message.verification] === undefined ? message.verification : $root.google.protobuf.ExtensionRangeOptions.VerificationState[message.verification] : message.verification; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + object.version = ""; + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; + object.restNumericEnums = false; + object.javaSettings = null; + object.cppSettings = null; + object.phpSettings = null; + object.pythonSettings = null; + object.nodeSettings = null; + object.dotnetSettings = null; + object.rubySettings = null; + object.goSettings = null; } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; + if (message.restNumericEnums != null && message.hasOwnProperty("restNumericEnums")) + object.restNumericEnums = message.restNumericEnums; + if (message.javaSettings != null && message.hasOwnProperty("javaSettings")) + object.javaSettings = $root.google.api.JavaSettings.toObject(message.javaSettings, options); + if (message.cppSettings != null && message.hasOwnProperty("cppSettings")) + object.cppSettings = $root.google.api.CppSettings.toObject(message.cppSettings, options); + if (message.phpSettings != null && message.hasOwnProperty("phpSettings")) + object.phpSettings = $root.google.api.PhpSettings.toObject(message.phpSettings, options); + if (message.pythonSettings != null && message.hasOwnProperty("pythonSettings")) + object.pythonSettings = $root.google.api.PythonSettings.toObject(message.pythonSettings, options); + if (message.nodeSettings != null && message.hasOwnProperty("nodeSettings")) + object.nodeSettings = $root.google.api.NodeSettings.toObject(message.nodeSettings, options); + if (message.dotnetSettings != null && message.hasOwnProperty("dotnetSettings")) + object.dotnetSettings = $root.google.api.DotnetSettings.toObject(message.dotnetSettings, options); + if (message.rubySettings != null && message.hasOwnProperty("rubySettings")) + object.rubySettings = $root.google.api.RubySettings.toObject(message.rubySettings, options); + if (message.goSettings != null && message.hasOwnProperty("goSettings")) + object.goSettings = $root.google.api.GoSettings.toObject(message.goSettings, options); return object; }; /** - * Converts this ExtensionRangeOptions to JSON. + * Converts this ClientLibrarySettings to JSON. * @function toJSON - * @memberof google.protobuf.ExtensionRangeOptions + * @memberof google.api.ClientLibrarySettings * @instance * @returns {Object.} JSON object */ - ExtensionRangeOptions.prototype.toJSON = function toJSON() { + ClientLibrarySettings.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ExtensionRangeOptions + * Gets the default type url for ClientLibrarySettings * @function getTypeUrl - * @memberof google.protobuf.ExtensionRangeOptions + * @memberof google.api.ClientLibrarySettings * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ExtensionRangeOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ClientLibrarySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions"; + return typeUrlPrefix + "/google.api.ClientLibrarySettings"; }; - ExtensionRangeOptions.Declaration = (function() { + return ClientLibrarySettings; + })(); - /** - * Properties of a Declaration. - * @memberof google.protobuf.ExtensionRangeOptions - * @interface IDeclaration - * @property {number|null} [number] Declaration number - * @property {string|null} [fullName] Declaration fullName - * @property {string|null} [type] Declaration type - * @property {boolean|null} [reserved] Declaration reserved - * @property {boolean|null} [repeated] Declaration repeated - */ + api.Publishing = (function() { - /** - * Constructs a new Declaration. - * @memberof google.protobuf.ExtensionRangeOptions - * @classdesc Represents a Declaration. - * @implements IDeclaration - * @constructor - * @param {google.protobuf.ExtensionRangeOptions.IDeclaration=} [properties] Properties to set - */ - function Declaration(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]]; - } + /** + * Properties of a Publishing. + * @memberof google.api + * @interface IPublishing + * @property {Array.|null} [methodSettings] Publishing methodSettings + * @property {string|null} [newIssueUri] Publishing newIssueUri + * @property {string|null} [documentationUri] Publishing documentationUri + * @property {string|null} [apiShortName] Publishing apiShortName + * @property {string|null} [githubLabel] Publishing githubLabel + * @property {Array.|null} [codeownerGithubTeams] Publishing codeownerGithubTeams + * @property {string|null} [docTagPrefix] Publishing docTagPrefix + * @property {google.api.ClientLibraryOrganization|null} [organization] Publishing organization + * @property {Array.|null} [librarySettings] Publishing librarySettings + * @property {string|null} [protoReferenceDocumentationUri] Publishing protoReferenceDocumentationUri + * @property {string|null} [restReferenceDocumentationUri] Publishing restReferenceDocumentationUri + */ - /** - * Declaration number. - * @member {number} number - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @instance - */ - Declaration.prototype.number = 0; + /** + * Constructs a new Publishing. + * @memberof google.api + * @classdesc Represents a Publishing. + * @implements IPublishing + * @constructor + * @param {google.api.IPublishing=} [properties] Properties to set + */ + function Publishing(properties) { + this.methodSettings = []; + this.codeownerGithubTeams = []; + this.librarySettings = []; + 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]]; + } - /** - * Declaration fullName. - * @member {string} fullName - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @instance - */ - Declaration.prototype.fullName = ""; + /** + * Publishing methodSettings. + * @member {Array.} methodSettings + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.methodSettings = $util.emptyArray; - /** - * Declaration type. - * @member {string} type - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @instance - */ - Declaration.prototype.type = ""; + /** + * Publishing newIssueUri. + * @member {string} newIssueUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.newIssueUri = ""; - /** - * Declaration reserved. - * @member {boolean} reserved - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @instance - */ - Declaration.prototype.reserved = false; + /** + * Publishing documentationUri. + * @member {string} documentationUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.documentationUri = ""; - /** - * Declaration repeated. - * @member {boolean} repeated - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @instance - */ - Declaration.prototype.repeated = false; + /** + * Publishing apiShortName. + * @member {string} apiShortName + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.apiShortName = ""; - /** - * Creates a new Declaration instance using the specified properties. - * @function create - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {google.protobuf.ExtensionRangeOptions.IDeclaration=} [properties] Properties to set - * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration instance - */ - Declaration.create = function create(properties) { - return new Declaration(properties); - }; + /** + * Publishing githubLabel. + * @member {string} githubLabel + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.githubLabel = ""; - /** - * Encodes the specified Declaration message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. - * @function encode - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {google.protobuf.ExtensionRangeOptions.IDeclaration} message Declaration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Declaration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.number != null && Object.hasOwnProperty.call(message, "number")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.number); - if (message.fullName != null && Object.hasOwnProperty.call(message, "fullName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.fullName); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.type); - if (message.reserved != null && Object.hasOwnProperty.call(message, "reserved")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.reserved); - if (message.repeated != null && Object.hasOwnProperty.call(message, "repeated")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.repeated); - return writer; - }; + /** + * Publishing codeownerGithubTeams. + * @member {Array.} codeownerGithubTeams + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.codeownerGithubTeams = $util.emptyArray; - /** - * Encodes the specified Declaration message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {google.protobuf.ExtensionRangeOptions.IDeclaration} message Declaration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Declaration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Publishing docTagPrefix. + * @member {string} docTagPrefix + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.docTagPrefix = ""; - /** - * Decodes a Declaration message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Declaration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions.Declaration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.number = reader.int32(); - break; - } - case 2: { - message.fullName = reader.string(); - break; - } - case 3: { - message.type = reader.string(); - break; - } - case 5: { - message.reserved = reader.bool(); - break; - } - case 6: { - message.repeated = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Publishing organization. + * @member {google.api.ClientLibraryOrganization} organization + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.organization = 0; - /** - * Decodes a Declaration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Declaration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Publishing librarySettings. + * @member {Array.} librarySettings + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.librarySettings = $util.emptyArray; - /** - * Verifies a Declaration message. - * @function verify - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Declaration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.number != null && message.hasOwnProperty("number")) - if (!$util.isInteger(message.number)) - return "number: integer expected"; - if (message.fullName != null && message.hasOwnProperty("fullName")) - if (!$util.isString(message.fullName)) - return "fullName: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.reserved != null && message.hasOwnProperty("reserved")) - if (typeof message.reserved !== "boolean") - return "reserved: boolean expected"; - if (message.repeated != null && message.hasOwnProperty("repeated")) - if (typeof message.repeated !== "boolean") - return "repeated: boolean expected"; - return null; - }; + /** + * Publishing protoReferenceDocumentationUri. + * @member {string} protoReferenceDocumentationUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.protoReferenceDocumentationUri = ""; - /** - * Creates a Declaration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration - */ - Declaration.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ExtensionRangeOptions.Declaration) - return object; - var message = new $root.google.protobuf.ExtensionRangeOptions.Declaration(); - if (object.number != null) - message.number = object.number | 0; - if (object.fullName != null) - message.fullName = String(object.fullName); - if (object.type != null) - message.type = String(object.type); - if (object.reserved != null) - message.reserved = Boolean(object.reserved); - if (object.repeated != null) - message.repeated = Boolean(object.repeated); - return message; - }; + /** + * Publishing restReferenceDocumentationUri. + * @member {string} restReferenceDocumentationUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.restReferenceDocumentationUri = ""; - /** - * Creates a plain object from a Declaration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {google.protobuf.ExtensionRangeOptions.Declaration} message Declaration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Declaration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.number = 0; - object.fullName = ""; - object.type = ""; - object.reserved = false; - object.repeated = false; - } - if (message.number != null && message.hasOwnProperty("number")) - object.number = message.number; - if (message.fullName != null && message.hasOwnProperty("fullName")) - object.fullName = message.fullName; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.reserved != null && message.hasOwnProperty("reserved")) - object.reserved = message.reserved; - if (message.repeated != null && message.hasOwnProperty("repeated")) - object.repeated = message.repeated; - return object; - }; + /** + * Creates a new Publishing instance using the specified properties. + * @function create + * @memberof google.api.Publishing + * @static + * @param {google.api.IPublishing=} [properties] Properties to set + * @returns {google.api.Publishing} Publishing instance + */ + Publishing.create = function create(properties) { + return new Publishing(properties); + }; - /** - * Converts this Declaration to JSON. - * @function toJSON - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @instance - * @returns {Object.} JSON object - */ - Declaration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Encodes the specified Publishing message. Does not implicitly {@link google.api.Publishing.verify|verify} messages. + * @function encode + * @memberof google.api.Publishing + * @static + * @param {google.api.IPublishing} message Publishing message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Publishing.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methodSettings != null && message.methodSettings.length) + for (var i = 0; i < message.methodSettings.length; ++i) + $root.google.api.MethodSettings.encode(message.methodSettings[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.newIssueUri != null && Object.hasOwnProperty.call(message, "newIssueUri")) + writer.uint32(/* id 101, wireType 2 =*/810).string(message.newIssueUri); + if (message.documentationUri != null && Object.hasOwnProperty.call(message, "documentationUri")) + writer.uint32(/* id 102, wireType 2 =*/818).string(message.documentationUri); + if (message.apiShortName != null && Object.hasOwnProperty.call(message, "apiShortName")) + writer.uint32(/* id 103, wireType 2 =*/826).string(message.apiShortName); + if (message.githubLabel != null && Object.hasOwnProperty.call(message, "githubLabel")) + writer.uint32(/* id 104, wireType 2 =*/834).string(message.githubLabel); + if (message.codeownerGithubTeams != null && message.codeownerGithubTeams.length) + for (var i = 0; i < message.codeownerGithubTeams.length; ++i) + writer.uint32(/* id 105, wireType 2 =*/842).string(message.codeownerGithubTeams[i]); + if (message.docTagPrefix != null && Object.hasOwnProperty.call(message, "docTagPrefix")) + writer.uint32(/* id 106, wireType 2 =*/850).string(message.docTagPrefix); + if (message.organization != null && Object.hasOwnProperty.call(message, "organization")) + writer.uint32(/* id 107, wireType 0 =*/856).int32(message.organization); + if (message.librarySettings != null && message.librarySettings.length) + for (var i = 0; i < message.librarySettings.length; ++i) + $root.google.api.ClientLibrarySettings.encode(message.librarySettings[i], writer.uint32(/* id 109, wireType 2 =*/874).fork()).ldelim(); + if (message.protoReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "protoReferenceDocumentationUri")) + writer.uint32(/* id 110, wireType 2 =*/882).string(message.protoReferenceDocumentationUri); + if (message.restReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "restReferenceDocumentationUri")) + writer.uint32(/* id 111, wireType 2 =*/890).string(message.restReferenceDocumentationUri); + return writer; + }; + + /** + * Encodes the specified Publishing message, length delimited. Does not implicitly {@link google.api.Publishing.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Publishing + * @static + * @param {google.api.IPublishing} message Publishing message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Publishing.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Publishing message from the specified reader or buffer. + * @function decode + * @memberof google.api.Publishing + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Publishing} Publishing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Publishing.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Publishing(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + if (!(message.methodSettings && message.methodSettings.length)) + message.methodSettings = []; + message.methodSettings.push($root.google.api.MethodSettings.decode(reader, reader.uint32())); + break; + } + case 101: { + message.newIssueUri = reader.string(); + break; + } + case 102: { + message.documentationUri = reader.string(); + break; + } + case 103: { + message.apiShortName = reader.string(); + break; + } + case 104: { + message.githubLabel = reader.string(); + break; + } + case 105: { + if (!(message.codeownerGithubTeams && message.codeownerGithubTeams.length)) + message.codeownerGithubTeams = []; + message.codeownerGithubTeams.push(reader.string()); + break; + } + case 106: { + message.docTagPrefix = reader.string(); + break; + } + case 107: { + message.organization = reader.int32(); + break; + } + case 109: { + if (!(message.librarySettings && message.librarySettings.length)) + message.librarySettings = []; + message.librarySettings.push($root.google.api.ClientLibrarySettings.decode(reader, reader.uint32())); + break; + } + case 110: { + message.protoReferenceDocumentationUri = reader.string(); + break; + } + case 111: { + message.restReferenceDocumentationUri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Publishing message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Publishing + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Publishing} Publishing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Publishing.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Publishing message. + * @function verify + * @memberof google.api.Publishing + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Publishing.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methodSettings != null && message.hasOwnProperty("methodSettings")) { + if (!Array.isArray(message.methodSettings)) + return "methodSettings: array expected"; + for (var i = 0; i < message.methodSettings.length; ++i) { + var error = $root.google.api.MethodSettings.verify(message.methodSettings[i]); + if (error) + return "methodSettings." + error; + } + } + if (message.newIssueUri != null && message.hasOwnProperty("newIssueUri")) + if (!$util.isString(message.newIssueUri)) + return "newIssueUri: string expected"; + if (message.documentationUri != null && message.hasOwnProperty("documentationUri")) + if (!$util.isString(message.documentationUri)) + return "documentationUri: string expected"; + if (message.apiShortName != null && message.hasOwnProperty("apiShortName")) + if (!$util.isString(message.apiShortName)) + return "apiShortName: string expected"; + if (message.githubLabel != null && message.hasOwnProperty("githubLabel")) + if (!$util.isString(message.githubLabel)) + return "githubLabel: string expected"; + if (message.codeownerGithubTeams != null && message.hasOwnProperty("codeownerGithubTeams")) { + if (!Array.isArray(message.codeownerGithubTeams)) + return "codeownerGithubTeams: array expected"; + for (var i = 0; i < message.codeownerGithubTeams.length; ++i) + if (!$util.isString(message.codeownerGithubTeams[i])) + return "codeownerGithubTeams: string[] expected"; + } + if (message.docTagPrefix != null && message.hasOwnProperty("docTagPrefix")) + if (!$util.isString(message.docTagPrefix)) + return "docTagPrefix: string expected"; + if (message.organization != null && message.hasOwnProperty("organization")) + switch (message.organization) { + default: + return "organization: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.librarySettings != null && message.hasOwnProperty("librarySettings")) { + if (!Array.isArray(message.librarySettings)) + return "librarySettings: array expected"; + for (var i = 0; i < message.librarySettings.length; ++i) { + var error = $root.google.api.ClientLibrarySettings.verify(message.librarySettings[i]); + if (error) + return "librarySettings." + error; + } + } + if (message.protoReferenceDocumentationUri != null && message.hasOwnProperty("protoReferenceDocumentationUri")) + if (!$util.isString(message.protoReferenceDocumentationUri)) + return "protoReferenceDocumentationUri: string expected"; + if (message.restReferenceDocumentationUri != null && message.hasOwnProperty("restReferenceDocumentationUri")) + if (!$util.isString(message.restReferenceDocumentationUri)) + return "restReferenceDocumentationUri: string expected"; + return null; + }; + + /** + * Creates a Publishing message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Publishing + * @static + * @param {Object.} object Plain object + * @returns {google.api.Publishing} Publishing + */ + Publishing.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Publishing) + return object; + var message = new $root.google.api.Publishing(); + if (object.methodSettings) { + if (!Array.isArray(object.methodSettings)) + throw TypeError(".google.api.Publishing.methodSettings: array expected"); + message.methodSettings = []; + for (var i = 0; i < object.methodSettings.length; ++i) { + if (typeof object.methodSettings[i] !== "object") + throw TypeError(".google.api.Publishing.methodSettings: object expected"); + message.methodSettings[i] = $root.google.api.MethodSettings.fromObject(object.methodSettings[i]); + } + } + if (object.newIssueUri != null) + message.newIssueUri = String(object.newIssueUri); + if (object.documentationUri != null) + message.documentationUri = String(object.documentationUri); + if (object.apiShortName != null) + message.apiShortName = String(object.apiShortName); + if (object.githubLabel != null) + message.githubLabel = String(object.githubLabel); + if (object.codeownerGithubTeams) { + if (!Array.isArray(object.codeownerGithubTeams)) + throw TypeError(".google.api.Publishing.codeownerGithubTeams: array expected"); + message.codeownerGithubTeams = []; + for (var i = 0; i < object.codeownerGithubTeams.length; ++i) + message.codeownerGithubTeams[i] = String(object.codeownerGithubTeams[i]); + } + if (object.docTagPrefix != null) + message.docTagPrefix = String(object.docTagPrefix); + switch (object.organization) { + default: + if (typeof object.organization === "number") { + message.organization = object.organization; + break; + } + break; + case "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": + case 0: + message.organization = 0; + break; + case "CLOUD": + case 1: + message.organization = 1; + break; + case "ADS": + case 2: + message.organization = 2; + break; + case "PHOTOS": + case 3: + message.organization = 3; + break; + case "STREET_VIEW": + case 4: + message.organization = 4; + break; + case "SHOPPING": + case 5: + message.organization = 5; + break; + case "GEO": + case 6: + message.organization = 6; + break; + case "GENERATIVE_AI": + case 7: + message.organization = 7; + break; + } + if (object.librarySettings) { + if (!Array.isArray(object.librarySettings)) + throw TypeError(".google.api.Publishing.librarySettings: array expected"); + message.librarySettings = []; + for (var i = 0; i < object.librarySettings.length; ++i) { + if (typeof object.librarySettings[i] !== "object") + throw TypeError(".google.api.Publishing.librarySettings: object expected"); + message.librarySettings[i] = $root.google.api.ClientLibrarySettings.fromObject(object.librarySettings[i]); + } + } + if (object.protoReferenceDocumentationUri != null) + message.protoReferenceDocumentationUri = String(object.protoReferenceDocumentationUri); + if (object.restReferenceDocumentationUri != null) + message.restReferenceDocumentationUri = String(object.restReferenceDocumentationUri); + return message; + }; + + /** + * Creates a plain object from a Publishing message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Publishing + * @static + * @param {google.api.Publishing} message Publishing + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Publishing.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.methodSettings = []; + object.codeownerGithubTeams = []; + object.librarySettings = []; + } + if (options.defaults) { + object.newIssueUri = ""; + object.documentationUri = ""; + object.apiShortName = ""; + object.githubLabel = ""; + object.docTagPrefix = ""; + object.organization = options.enums === String ? "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" : 0; + object.protoReferenceDocumentationUri = ""; + object.restReferenceDocumentationUri = ""; + } + if (message.methodSettings && message.methodSettings.length) { + object.methodSettings = []; + for (var j = 0; j < message.methodSettings.length; ++j) + object.methodSettings[j] = $root.google.api.MethodSettings.toObject(message.methodSettings[j], options); + } + if (message.newIssueUri != null && message.hasOwnProperty("newIssueUri")) + object.newIssueUri = message.newIssueUri; + if (message.documentationUri != null && message.hasOwnProperty("documentationUri")) + object.documentationUri = message.documentationUri; + if (message.apiShortName != null && message.hasOwnProperty("apiShortName")) + object.apiShortName = message.apiShortName; + if (message.githubLabel != null && message.hasOwnProperty("githubLabel")) + object.githubLabel = message.githubLabel; + if (message.codeownerGithubTeams && message.codeownerGithubTeams.length) { + object.codeownerGithubTeams = []; + for (var j = 0; j < message.codeownerGithubTeams.length; ++j) + object.codeownerGithubTeams[j] = message.codeownerGithubTeams[j]; + } + if (message.docTagPrefix != null && message.hasOwnProperty("docTagPrefix")) + object.docTagPrefix = message.docTagPrefix; + if (message.organization != null && message.hasOwnProperty("organization")) + object.organization = options.enums === String ? $root.google.api.ClientLibraryOrganization[message.organization] === undefined ? message.organization : $root.google.api.ClientLibraryOrganization[message.organization] : message.organization; + if (message.librarySettings && message.librarySettings.length) { + object.librarySettings = []; + for (var j = 0; j < message.librarySettings.length; ++j) + object.librarySettings[j] = $root.google.api.ClientLibrarySettings.toObject(message.librarySettings[j], options); + } + if (message.protoReferenceDocumentationUri != null && message.hasOwnProperty("protoReferenceDocumentationUri")) + object.protoReferenceDocumentationUri = message.protoReferenceDocumentationUri; + if (message.restReferenceDocumentationUri != null && message.hasOwnProperty("restReferenceDocumentationUri")) + object.restReferenceDocumentationUri = message.restReferenceDocumentationUri; + return object; + }; + + /** + * Converts this Publishing to JSON. + * @function toJSON + * @memberof google.api.Publishing + * @instance + * @returns {Object.} JSON object + */ + Publishing.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Publishing + * @function getTypeUrl + * @memberof google.api.Publishing + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Publishing.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Publishing"; + }; + + return Publishing; + })(); + + api.JavaSettings = (function() { + + /** + * Properties of a JavaSettings. + * @memberof google.api + * @interface IJavaSettings + * @property {string|null} [libraryPackage] JavaSettings libraryPackage + * @property {Object.|null} [serviceClassNames] JavaSettings serviceClassNames + * @property {google.api.ICommonLanguageSettings|null} [common] JavaSettings common + */ + + /** + * Constructs a new JavaSettings. + * @memberof google.api + * @classdesc Represents a JavaSettings. + * @implements IJavaSettings + * @constructor + * @param {google.api.IJavaSettings=} [properties] Properties to set + */ + function JavaSettings(properties) { + this.serviceClassNames = {}; + 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]]; + } + + /** + * JavaSettings libraryPackage. + * @member {string} libraryPackage + * @memberof google.api.JavaSettings + * @instance + */ + JavaSettings.prototype.libraryPackage = ""; + + /** + * JavaSettings serviceClassNames. + * @member {Object.} serviceClassNames + * @memberof google.api.JavaSettings + * @instance + */ + JavaSettings.prototype.serviceClassNames = $util.emptyObject; + + /** + * JavaSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.JavaSettings + * @instance + */ + JavaSettings.prototype.common = null; + + /** + * Creates a new JavaSettings instance using the specified properties. + * @function create + * @memberof google.api.JavaSettings + * @static + * @param {google.api.IJavaSettings=} [properties] Properties to set + * @returns {google.api.JavaSettings} JavaSettings instance + */ + JavaSettings.create = function create(properties) { + return new JavaSettings(properties); + }; + + /** + * Encodes the specified JavaSettings message. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. + * @function encode + * @memberof google.api.JavaSettings + * @static + * @param {google.api.IJavaSettings} message JavaSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + JavaSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.libraryPackage != null && Object.hasOwnProperty.call(message, "libraryPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.libraryPackage); + if (message.serviceClassNames != null && Object.hasOwnProperty.call(message, "serviceClassNames")) + for (var keys = Object.keys(message.serviceClassNames), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.serviceClassNames[keys[i]]).ldelim(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified JavaSettings message, length delimited. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.JavaSettings + * @static + * @param {google.api.IJavaSettings} message JavaSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + JavaSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a JavaSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.JavaSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.JavaSettings} JavaSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + JavaSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.JavaSettings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.libraryPackage = reader.string(); + break; + } + case 2: { + if (message.serviceClassNames === $util.emptyObject) + message.serviceClassNames = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.serviceClassNames[key] = value; + break; + } + case 3: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a JavaSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.JavaSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.JavaSettings} JavaSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + JavaSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a JavaSettings message. + * @function verify + * @memberof google.api.JavaSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + JavaSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.libraryPackage != null && message.hasOwnProperty("libraryPackage")) + if (!$util.isString(message.libraryPackage)) + return "libraryPackage: string expected"; + if (message.serviceClassNames != null && message.hasOwnProperty("serviceClassNames")) { + if (!$util.isObject(message.serviceClassNames)) + return "serviceClassNames: object expected"; + var key = Object.keys(message.serviceClassNames); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.serviceClassNames[key[i]])) + return "serviceClassNames: string{k:string} expected"; + } + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a JavaSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.JavaSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.JavaSettings} JavaSettings + */ + JavaSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.JavaSettings) + return object; + var message = new $root.google.api.JavaSettings(); + if (object.libraryPackage != null) + message.libraryPackage = String(object.libraryPackage); + if (object.serviceClassNames) { + if (typeof object.serviceClassNames !== "object") + throw TypeError(".google.api.JavaSettings.serviceClassNames: object expected"); + message.serviceClassNames = {}; + for (var keys = Object.keys(object.serviceClassNames), i = 0; i < keys.length; ++i) + message.serviceClassNames[keys[i]] = String(object.serviceClassNames[keys[i]]); + } + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.JavaSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a JavaSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.JavaSettings + * @static + * @param {google.api.JavaSettings} message JavaSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + JavaSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.serviceClassNames = {}; + if (options.defaults) { + object.libraryPackage = ""; + object.common = null; + } + if (message.libraryPackage != null && message.hasOwnProperty("libraryPackage")) + object.libraryPackage = message.libraryPackage; + var keys2; + if (message.serviceClassNames && (keys2 = Object.keys(message.serviceClassNames)).length) { + object.serviceClassNames = {}; + for (var j = 0; j < keys2.length; ++j) + object.serviceClassNames[keys2[j]] = message.serviceClassNames[keys2[j]]; + } + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this JavaSettings to JSON. + * @function toJSON + * @memberof google.api.JavaSettings + * @instance + * @returns {Object.} JSON object + */ + JavaSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for JavaSettings + * @function getTypeUrl + * @memberof google.api.JavaSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + JavaSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.JavaSettings"; + }; + + return JavaSettings; + })(); + + api.CppSettings = (function() { + + /** + * Properties of a CppSettings. + * @memberof google.api + * @interface ICppSettings + * @property {google.api.ICommonLanguageSettings|null} [common] CppSettings common + */ + + /** + * Constructs a new CppSettings. + * @memberof google.api + * @classdesc Represents a CppSettings. + * @implements ICppSettings + * @constructor + * @param {google.api.ICppSettings=} [properties] Properties to set + */ + function CppSettings(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]]; + } + + /** + * CppSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.CppSettings + * @instance + */ + CppSettings.prototype.common = null; + + /** + * Creates a new CppSettings instance using the specified properties. + * @function create + * @memberof google.api.CppSettings + * @static + * @param {google.api.ICppSettings=} [properties] Properties to set + * @returns {google.api.CppSettings} CppSettings instance + */ + CppSettings.create = function create(properties) { + return new CppSettings(properties); + }; + + /** + * Encodes the specified CppSettings message. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. + * @function encode + * @memberof google.api.CppSettings + * @static + * @param {google.api.ICppSettings} message CppSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CppSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CppSettings message, length delimited. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CppSettings + * @static + * @param {google.api.ICppSettings} message CppSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CppSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CppSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.CppSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CppSettings} CppSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CppSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CppSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CppSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CppSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CppSettings} CppSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CppSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CppSettings message. + * @function verify + * @memberof google.api.CppSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CppSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a CppSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CppSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.CppSettings} CppSettings + */ + CppSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CppSettings) + return object; + var message = new $root.google.api.CppSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.CppSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a CppSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CppSettings + * @static + * @param {google.api.CppSettings} message CppSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CppSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this CppSettings to JSON. + * @function toJSON + * @memberof google.api.CppSettings + * @instance + * @returns {Object.} JSON object + */ + CppSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CppSettings + * @function getTypeUrl + * @memberof google.api.CppSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CppSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CppSettings"; + }; + + return CppSettings; + })(); + + api.PhpSettings = (function() { + + /** + * Properties of a PhpSettings. + * @memberof google.api + * @interface IPhpSettings + * @property {google.api.ICommonLanguageSettings|null} [common] PhpSettings common + */ + + /** + * Constructs a new PhpSettings. + * @memberof google.api + * @classdesc Represents a PhpSettings. + * @implements IPhpSettings + * @constructor + * @param {google.api.IPhpSettings=} [properties] Properties to set + */ + function PhpSettings(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]]; + } + + /** + * PhpSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.PhpSettings + * @instance + */ + PhpSettings.prototype.common = null; + + /** + * Creates a new PhpSettings instance using the specified properties. + * @function create + * @memberof google.api.PhpSettings + * @static + * @param {google.api.IPhpSettings=} [properties] Properties to set + * @returns {google.api.PhpSettings} PhpSettings instance + */ + PhpSettings.create = function create(properties) { + return new PhpSettings(properties); + }; + + /** + * Encodes the specified PhpSettings message. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. + * @function encode + * @memberof google.api.PhpSettings + * @static + * @param {google.api.IPhpSettings} message PhpSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PhpSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PhpSettings message, length delimited. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PhpSettings + * @static + * @param {google.api.IPhpSettings} message PhpSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PhpSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PhpSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.PhpSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PhpSettings} PhpSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PhpSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PhpSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PhpSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PhpSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PhpSettings} PhpSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PhpSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PhpSettings message. + * @function verify + * @memberof google.api.PhpSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PhpSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a PhpSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PhpSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.PhpSettings} PhpSettings + */ + PhpSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PhpSettings) + return object; + var message = new $root.google.api.PhpSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.PhpSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a PhpSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PhpSettings + * @static + * @param {google.api.PhpSettings} message PhpSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PhpSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this PhpSettings to JSON. + * @function toJSON + * @memberof google.api.PhpSettings + * @instance + * @returns {Object.} JSON object + */ + PhpSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PhpSettings + * @function getTypeUrl + * @memberof google.api.PhpSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PhpSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PhpSettings"; + }; + + return PhpSettings; + })(); + + api.PythonSettings = (function() { + + /** + * Properties of a PythonSettings. + * @memberof google.api + * @interface IPythonSettings + * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common + * @property {google.api.PythonSettings.IExperimentalFeatures|null} [experimentalFeatures] PythonSettings experimentalFeatures + */ + + /** + * Constructs a new PythonSettings. + * @memberof google.api + * @classdesc Represents a PythonSettings. + * @implements IPythonSettings + * @constructor + * @param {google.api.IPythonSettings=} [properties] Properties to set + */ + function PythonSettings(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]]; + } + + /** + * PythonSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.common = null; + + /** + * PythonSettings experimentalFeatures. + * @member {google.api.PythonSettings.IExperimentalFeatures|null|undefined} experimentalFeatures + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.experimentalFeatures = null; + + /** + * Creates a new PythonSettings instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings + * @static + * @param {google.api.IPythonSettings=} [properties] Properties to set + * @returns {google.api.PythonSettings} PythonSettings instance + */ + PythonSettings.create = function create(properties) { + return new PythonSettings(properties); + }; + + /** + * Encodes the specified PythonSettings message. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings + * @static + * @param {google.api.IPythonSettings} message PythonSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PythonSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PythonSettings message, length delimited. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings + * @static + * @param {google.api.IPythonSettings} message PythonSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PythonSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PythonSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings} PythonSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PythonSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + case 2: { + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PythonSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings} PythonSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PythonSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PythonSettings message. + * @function verify + * @memberof google.api.PythonSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PythonSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { + var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures); + if (error) + return "experimentalFeatures." + error; + } + return null; + }; + + /** + * Creates a PythonSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings} PythonSettings + */ + PythonSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings) + return object; + var message = new $root.google.api.PythonSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.PythonSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + if (object.experimentalFeatures != null) { + if (typeof object.experimentalFeatures !== "object") + throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures); + } + return message; + }; + + /** + * Creates a plain object from a PythonSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings + * @static + * @param {google.api.PythonSettings} message PythonSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PythonSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.common = null; + object.experimentalFeatures = null; + } + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) + object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options); + return object; + }; + + /** + * Converts this PythonSettings to JSON. + * @function toJSON + * @memberof google.api.PythonSettings + * @instance + * @returns {Object.} JSON object + */ + PythonSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PythonSettings + * @function getTypeUrl + * @memberof google.api.PythonSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PythonSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings"; + }; + + PythonSettings.ExperimentalFeatures = (function() { + + /** + * Properties of an ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @interface IExperimentalFeatures + * @property {boolean|null} [restAsyncIoEnabled] ExperimentalFeatures restAsyncIoEnabled + * @property {boolean|null} [protobufPythonicTypesEnabled] ExperimentalFeatures protobufPythonicTypesEnabled + * @property {boolean|null} [unversionedPackageDisabled] ExperimentalFeatures unversionedPackageDisabled + */ + + /** + * Constructs a new ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @classdesc Represents an ExperimentalFeatures. + * @implements IExperimentalFeatures + * @constructor + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + */ + function ExperimentalFeatures(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]]; + } + + /** + * ExperimentalFeatures restAsyncIoEnabled. + * @member {boolean} restAsyncIoEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.restAsyncIoEnabled = false; + + /** + * ExperimentalFeatures protobufPythonicTypesEnabled. + * @member {boolean} protobufPythonicTypesEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.protobufPythonicTypesEnabled = false; + + /** + * ExperimentalFeatures unversionedPackageDisabled. + * @member {boolean} unversionedPackageDisabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.unversionedPackageDisabled = false; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures instance + */ + ExperimentalFeatures.create = function create(properties) { + return new ExperimentalFeatures(properties); + }; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.protobufPythonicTypesEnabled); + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unversionedPackageDisabled); + return writer; + }; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restAsyncIoEnabled = reader.bool(); + break; + } + case 2: { + message.protobufPythonicTypesEnabled = reader.bool(); + break; + } + case 3: { + message.unversionedPackageDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExperimentalFeatures message. + * @function verify + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExperimentalFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + if (typeof message.restAsyncIoEnabled !== "boolean") + return "restAsyncIoEnabled: boolean expected"; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + if (typeof message.protobufPythonicTypesEnabled !== "boolean") + return "protobufPythonicTypesEnabled: boolean expected"; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + if (typeof message.unversionedPackageDisabled !== "boolean") + return "unversionedPackageDisabled: boolean expected"; + return null; + }; + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + */ + ExperimentalFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) + return object; + var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + if (object.restAsyncIoEnabled != null) + message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); + if (object.protobufPythonicTypesEnabled != null) + message.protobufPythonicTypesEnabled = Boolean(object.protobufPythonicTypesEnabled); + if (object.unversionedPackageDisabled != null) + message.unversionedPackageDisabled = Boolean(object.unversionedPackageDisabled); + return message; + }; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.ExperimentalFeatures} message ExperimentalFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExperimentalFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.restAsyncIoEnabled = false; + object.protobufPythonicTypesEnabled = false; + object.unversionedPackageDisabled = false; + } + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + object.restAsyncIoEnabled = message.restAsyncIoEnabled; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + object.unversionedPackageDisabled = message.unversionedPackageDisabled; + return object; + }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @function toJSON + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + * @returns {Object.} JSON object + */ + ExperimentalFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExperimentalFeatures + * @function getTypeUrl + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExperimentalFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings.ExperimentalFeatures"; + }; + + return ExperimentalFeatures; + })(); + + return PythonSettings; + })(); + + api.NodeSettings = (function() { + + /** + * Properties of a NodeSettings. + * @memberof google.api + * @interface INodeSettings + * @property {google.api.ICommonLanguageSettings|null} [common] NodeSettings common + */ + + /** + * Constructs a new NodeSettings. + * @memberof google.api + * @classdesc Represents a NodeSettings. + * @implements INodeSettings + * @constructor + * @param {google.api.INodeSettings=} [properties] Properties to set + */ + function NodeSettings(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]]; + } + + /** + * NodeSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.NodeSettings + * @instance + */ + NodeSettings.prototype.common = null; + + /** + * Creates a new NodeSettings instance using the specified properties. + * @function create + * @memberof google.api.NodeSettings + * @static + * @param {google.api.INodeSettings=} [properties] Properties to set + * @returns {google.api.NodeSettings} NodeSettings instance + */ + NodeSettings.create = function create(properties) { + return new NodeSettings(properties); + }; + + /** + * Encodes the specified NodeSettings message. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. + * @function encode + * @memberof google.api.NodeSettings + * @static + * @param {google.api.INodeSettings} message NodeSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NodeSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified NodeSettings message, length delimited. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.NodeSettings + * @static + * @param {google.api.INodeSettings} message NodeSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NodeSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NodeSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.NodeSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.NodeSettings} NodeSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NodeSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.NodeSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NodeSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.NodeSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.NodeSettings} NodeSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NodeSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NodeSettings message. + * @function verify + * @memberof google.api.NodeSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NodeSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a NodeSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.NodeSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.NodeSettings} NodeSettings + */ + NodeSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.NodeSettings) + return object; + var message = new $root.google.api.NodeSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.NodeSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a NodeSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.NodeSettings + * @static + * @param {google.api.NodeSettings} message NodeSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NodeSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this NodeSettings to JSON. + * @function toJSON + * @memberof google.api.NodeSettings + * @instance + * @returns {Object.} JSON object + */ + NodeSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NodeSettings + * @function getTypeUrl + * @memberof google.api.NodeSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NodeSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.NodeSettings"; + }; + + return NodeSettings; + })(); + + api.DotnetSettings = (function() { + + /** + * Properties of a DotnetSettings. + * @memberof google.api + * @interface IDotnetSettings + * @property {google.api.ICommonLanguageSettings|null} [common] DotnetSettings common + * @property {Object.|null} [renamedServices] DotnetSettings renamedServices + * @property {Object.|null} [renamedResources] DotnetSettings renamedResources + * @property {Array.|null} [ignoredResources] DotnetSettings ignoredResources + * @property {Array.|null} [forcedNamespaceAliases] DotnetSettings forcedNamespaceAliases + * @property {Array.|null} [handwrittenSignatures] DotnetSettings handwrittenSignatures + */ + + /** + * Constructs a new DotnetSettings. + * @memberof google.api + * @classdesc Represents a DotnetSettings. + * @implements IDotnetSettings + * @constructor + * @param {google.api.IDotnetSettings=} [properties] Properties to set + */ + function DotnetSettings(properties) { + this.renamedServices = {}; + this.renamedResources = {}; + this.ignoredResources = []; + this.forcedNamespaceAliases = []; + this.handwrittenSignatures = []; + 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]]; + } + + /** + * DotnetSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.common = null; + + /** + * DotnetSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.renamedServices = $util.emptyObject; + + /** + * DotnetSettings renamedResources. + * @member {Object.} renamedResources + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.renamedResources = $util.emptyObject; + + /** + * DotnetSettings ignoredResources. + * @member {Array.} ignoredResources + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.ignoredResources = $util.emptyArray; + + /** + * DotnetSettings forcedNamespaceAliases. + * @member {Array.} forcedNamespaceAliases + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.forcedNamespaceAliases = $util.emptyArray; + + /** + * DotnetSettings handwrittenSignatures. + * @member {Array.} handwrittenSignatures + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.handwrittenSignatures = $util.emptyArray; + + /** + * Creates a new DotnetSettings instance using the specified properties. + * @function create + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.IDotnetSettings=} [properties] Properties to set + * @returns {google.api.DotnetSettings} DotnetSettings instance + */ + DotnetSettings.create = function create(properties) { + return new DotnetSettings(properties); + }; + + /** + * Encodes the specified DotnetSettings message. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. + * @function encode + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.IDotnetSettings} message DotnetSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DotnetSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); + if (message.renamedResources != null && Object.hasOwnProperty.call(message, "renamedResources")) + for (var keys = Object.keys(message.renamedResources), i = 0; i < keys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedResources[keys[i]]).ldelim(); + if (message.ignoredResources != null && message.ignoredResources.length) + for (var i = 0; i < message.ignoredResources.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.ignoredResources[i]); + if (message.forcedNamespaceAliases != null && message.forcedNamespaceAliases.length) + for (var i = 0; i < message.forcedNamespaceAliases.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.forcedNamespaceAliases[i]); + if (message.handwrittenSignatures != null && message.handwrittenSignatures.length) + for (var i = 0; i < message.handwrittenSignatures.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.handwrittenSignatures[i]); + return writer; + }; + + /** + * Encodes the specified DotnetSettings message, length delimited. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.IDotnetSettings} message DotnetSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DotnetSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DotnetSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.DotnetSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.DotnetSettings} DotnetSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DotnetSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.DotnetSettings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedServices[key] = value; + break; + } + case 3: { + if (message.renamedResources === $util.emptyObject) + message.renamedResources = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedResources[key] = value; + break; + } + case 4: { + if (!(message.ignoredResources && message.ignoredResources.length)) + message.ignoredResources = []; + message.ignoredResources.push(reader.string()); + break; + } + case 5: { + if (!(message.forcedNamespaceAliases && message.forcedNamespaceAliases.length)) + message.forcedNamespaceAliases = []; + message.forcedNamespaceAliases.push(reader.string()); + break; + } + case 6: { + if (!(message.handwrittenSignatures && message.handwrittenSignatures.length)) + message.handwrittenSignatures = []; + message.handwrittenSignatures.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DotnetSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.DotnetSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.DotnetSettings} DotnetSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DotnetSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DotnetSettings message. + * @function verify + * @memberof google.api.DotnetSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DotnetSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } + if (message.renamedResources != null && message.hasOwnProperty("renamedResources")) { + if (!$util.isObject(message.renamedResources)) + return "renamedResources: object expected"; + var key = Object.keys(message.renamedResources); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedResources[key[i]])) + return "renamedResources: string{k:string} expected"; + } + if (message.ignoredResources != null && message.hasOwnProperty("ignoredResources")) { + if (!Array.isArray(message.ignoredResources)) + return "ignoredResources: array expected"; + for (var i = 0; i < message.ignoredResources.length; ++i) + if (!$util.isString(message.ignoredResources[i])) + return "ignoredResources: string[] expected"; + } + if (message.forcedNamespaceAliases != null && message.hasOwnProperty("forcedNamespaceAliases")) { + if (!Array.isArray(message.forcedNamespaceAliases)) + return "forcedNamespaceAliases: array expected"; + for (var i = 0; i < message.forcedNamespaceAliases.length; ++i) + if (!$util.isString(message.forcedNamespaceAliases[i])) + return "forcedNamespaceAliases: string[] expected"; + } + if (message.handwrittenSignatures != null && message.hasOwnProperty("handwrittenSignatures")) { + if (!Array.isArray(message.handwrittenSignatures)) + return "handwrittenSignatures: array expected"; + for (var i = 0; i < message.handwrittenSignatures.length; ++i) + if (!$util.isString(message.handwrittenSignatures[i])) + return "handwrittenSignatures: string[] expected"; + } + return null; + }; + + /** + * Creates a DotnetSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.DotnetSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.DotnetSettings} DotnetSettings + */ + DotnetSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.DotnetSettings) + return object; + var message = new $root.google.api.DotnetSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.DotnetSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.DotnetSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } + if (object.renamedResources) { + if (typeof object.renamedResources !== "object") + throw TypeError(".google.api.DotnetSettings.renamedResources: object expected"); + message.renamedResources = {}; + for (var keys = Object.keys(object.renamedResources), i = 0; i < keys.length; ++i) + message.renamedResources[keys[i]] = String(object.renamedResources[keys[i]]); + } + if (object.ignoredResources) { + if (!Array.isArray(object.ignoredResources)) + throw TypeError(".google.api.DotnetSettings.ignoredResources: array expected"); + message.ignoredResources = []; + for (var i = 0; i < object.ignoredResources.length; ++i) + message.ignoredResources[i] = String(object.ignoredResources[i]); + } + if (object.forcedNamespaceAliases) { + if (!Array.isArray(object.forcedNamespaceAliases)) + throw TypeError(".google.api.DotnetSettings.forcedNamespaceAliases: array expected"); + message.forcedNamespaceAliases = []; + for (var i = 0; i < object.forcedNamespaceAliases.length; ++i) + message.forcedNamespaceAliases[i] = String(object.forcedNamespaceAliases[i]); + } + if (object.handwrittenSignatures) { + if (!Array.isArray(object.handwrittenSignatures)) + throw TypeError(".google.api.DotnetSettings.handwrittenSignatures: array expected"); + message.handwrittenSignatures = []; + for (var i = 0; i < object.handwrittenSignatures.length; ++i) + message.handwrittenSignatures[i] = String(object.handwrittenSignatures[i]); + } + return message; + }; + + /** + * Creates a plain object from a DotnetSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.DotnetSettings} message DotnetSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DotnetSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.ignoredResources = []; + object.forcedNamespaceAliases = []; + object.handwrittenSignatures = []; + } + if (options.objects || options.defaults) { + object.renamedServices = {}; + object.renamedResources = {}; + } + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } + if (message.renamedResources && (keys2 = Object.keys(message.renamedResources)).length) { + object.renamedResources = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedResources[keys2[j]] = message.renamedResources[keys2[j]]; + } + if (message.ignoredResources && message.ignoredResources.length) { + object.ignoredResources = []; + for (var j = 0; j < message.ignoredResources.length; ++j) + object.ignoredResources[j] = message.ignoredResources[j]; + } + if (message.forcedNamespaceAliases && message.forcedNamespaceAliases.length) { + object.forcedNamespaceAliases = []; + for (var j = 0; j < message.forcedNamespaceAliases.length; ++j) + object.forcedNamespaceAliases[j] = message.forcedNamespaceAliases[j]; + } + if (message.handwrittenSignatures && message.handwrittenSignatures.length) { + object.handwrittenSignatures = []; + for (var j = 0; j < message.handwrittenSignatures.length; ++j) + object.handwrittenSignatures[j] = message.handwrittenSignatures[j]; + } + return object; + }; + + /** + * Converts this DotnetSettings to JSON. + * @function toJSON + * @memberof google.api.DotnetSettings + * @instance + * @returns {Object.} JSON object + */ + DotnetSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DotnetSettings + * @function getTypeUrl + * @memberof google.api.DotnetSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DotnetSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.DotnetSettings"; + }; + + return DotnetSettings; + })(); + + api.RubySettings = (function() { + + /** + * Properties of a RubySettings. + * @memberof google.api + * @interface IRubySettings + * @property {google.api.ICommonLanguageSettings|null} [common] RubySettings common + */ + + /** + * Constructs a new RubySettings. + * @memberof google.api + * @classdesc Represents a RubySettings. + * @implements IRubySettings + * @constructor + * @param {google.api.IRubySettings=} [properties] Properties to set + */ + function RubySettings(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]]; + } + + /** + * RubySettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.RubySettings + * @instance + */ + RubySettings.prototype.common = null; + + /** + * Creates a new RubySettings instance using the specified properties. + * @function create + * @memberof google.api.RubySettings + * @static + * @param {google.api.IRubySettings=} [properties] Properties to set + * @returns {google.api.RubySettings} RubySettings instance + */ + RubySettings.create = function create(properties) { + return new RubySettings(properties); + }; + + /** + * Encodes the specified RubySettings message. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. + * @function encode + * @memberof google.api.RubySettings + * @static + * @param {google.api.IRubySettings} message RubySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RubySettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RubySettings message, length delimited. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.RubySettings + * @static + * @param {google.api.IRubySettings} message RubySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RubySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RubySettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.RubySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.RubySettings} RubySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RubySettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.RubySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RubySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.RubySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.RubySettings} RubySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RubySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RubySettings message. + * @function verify + * @memberof google.api.RubySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RubySettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a RubySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.RubySettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.RubySettings} RubySettings + */ + RubySettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.RubySettings) + return object; + var message = new $root.google.api.RubySettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.RubySettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a RubySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.RubySettings + * @static + * @param {google.api.RubySettings} message RubySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RubySettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this RubySettings to JSON. + * @function toJSON + * @memberof google.api.RubySettings + * @instance + * @returns {Object.} JSON object + */ + RubySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RubySettings + * @function getTypeUrl + * @memberof google.api.RubySettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RubySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.RubySettings"; + }; + + return RubySettings; + })(); + + api.GoSettings = (function() { + + /** + * Properties of a GoSettings. + * @memberof google.api + * @interface IGoSettings + * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common + * @property {Object.|null} [renamedServices] GoSettings renamedServices + */ + + /** + * Constructs a new GoSettings. + * @memberof google.api + * @classdesc Represents a GoSettings. + * @implements IGoSettings + * @constructor + * @param {google.api.IGoSettings=} [properties] Properties to set + */ + function GoSettings(properties) { + this.renamedServices = {}; + 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]]; + } + + /** + * GoSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.common = null; + + /** + * GoSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.renamedServices = $util.emptyObject; + + /** + * Creates a new GoSettings instance using the specified properties. + * @function create + * @memberof google.api.GoSettings + * @static + * @param {google.api.IGoSettings=} [properties] Properties to set + * @returns {google.api.GoSettings} GoSettings instance + */ + GoSettings.create = function create(properties) { + return new GoSettings(properties); + }; + + /** + * Encodes the specified GoSettings message. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. + * @function encode + * @memberof google.api.GoSettings + * @static + * @param {google.api.IGoSettings} message GoSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GoSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified GoSettings message, length delimited. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.GoSettings + * @static + * @param {google.api.IGoSettings} message GoSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GoSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GoSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.GoSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.GoSettings} GoSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GoSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedServices[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GoSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.GoSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.GoSettings} GoSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GoSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GoSettings message. + * @function verify + * @memberof google.api.GoSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GoSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a GoSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.GoSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.GoSettings} GoSettings + */ + GoSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.GoSettings) + return object; + var message = new $root.google.api.GoSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.GoSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.GoSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a GoSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.GoSettings + * @static + * @param {google.api.GoSettings} message GoSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GoSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.renamedServices = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } + return object; + }; + + /** + * Converts this GoSettings to JSON. + * @function toJSON + * @memberof google.api.GoSettings + * @instance + * @returns {Object.} JSON object + */ + GoSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GoSettings + * @function getTypeUrl + * @memberof google.api.GoSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GoSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.GoSettings"; + }; + + return GoSettings; + })(); + + api.MethodSettings = (function() { + + /** + * Properties of a MethodSettings. + * @memberof google.api + * @interface IMethodSettings + * @property {string|null} [selector] MethodSettings selector + * @property {google.api.MethodSettings.ILongRunning|null} [longRunning] MethodSettings longRunning + * @property {Array.|null} [autoPopulatedFields] MethodSettings autoPopulatedFields + */ + + /** + * Constructs a new MethodSettings. + * @memberof google.api + * @classdesc Represents a MethodSettings. + * @implements IMethodSettings + * @constructor + * @param {google.api.IMethodSettings=} [properties] Properties to set + */ + function MethodSettings(properties) { + this.autoPopulatedFields = []; + 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]]; + } + + /** + * MethodSettings selector. + * @member {string} selector + * @memberof google.api.MethodSettings + * @instance + */ + MethodSettings.prototype.selector = ""; + + /** + * MethodSettings longRunning. + * @member {google.api.MethodSettings.ILongRunning|null|undefined} longRunning + * @memberof google.api.MethodSettings + * @instance + */ + MethodSettings.prototype.longRunning = null; + + /** + * MethodSettings autoPopulatedFields. + * @member {Array.} autoPopulatedFields + * @memberof google.api.MethodSettings + * @instance + */ + MethodSettings.prototype.autoPopulatedFields = $util.emptyArray; + + /** + * Creates a new MethodSettings instance using the specified properties. + * @function create + * @memberof google.api.MethodSettings + * @static + * @param {google.api.IMethodSettings=} [properties] Properties to set + * @returns {google.api.MethodSettings} MethodSettings instance + */ + MethodSettings.create = function create(properties) { + return new MethodSettings(properties); + }; + + /** + * Encodes the specified MethodSettings message. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. + * @function encode + * @memberof google.api.MethodSettings + * @static + * @param {google.api.IMethodSettings} message MethodSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.longRunning != null && Object.hasOwnProperty.call(message, "longRunning")) + $root.google.api.MethodSettings.LongRunning.encode(message.longRunning, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.autoPopulatedFields != null && message.autoPopulatedFields.length) + for (var i = 0; i < message.autoPopulatedFields.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.autoPopulatedFields[i]); + return writer; + }; + + /** + * Encodes the specified MethodSettings message, length delimited. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MethodSettings + * @static + * @param {google.api.IMethodSettings} message MethodSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.MethodSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MethodSettings} MethodSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MethodSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.selector = reader.string(); + break; + } + case 2: { + message.longRunning = $root.google.api.MethodSettings.LongRunning.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.autoPopulatedFields && message.autoPopulatedFields.length)) + message.autoPopulatedFields = []; + message.autoPopulatedFields.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MethodSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MethodSettings} MethodSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodSettings message. + * @function verify + * @memberof google.api.MethodSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.longRunning != null && message.hasOwnProperty("longRunning")) { + var error = $root.google.api.MethodSettings.LongRunning.verify(message.longRunning); + if (error) + return "longRunning." + error; + } + if (message.autoPopulatedFields != null && message.hasOwnProperty("autoPopulatedFields")) { + if (!Array.isArray(message.autoPopulatedFields)) + return "autoPopulatedFields: array expected"; + for (var i = 0; i < message.autoPopulatedFields.length; ++i) + if (!$util.isString(message.autoPopulatedFields[i])) + return "autoPopulatedFields: string[] expected"; + } + return null; + }; + + /** + * Creates a MethodSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MethodSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.MethodSettings} MethodSettings + */ + MethodSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MethodSettings) + return object; + var message = new $root.google.api.MethodSettings(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.longRunning != null) { + if (typeof object.longRunning !== "object") + throw TypeError(".google.api.MethodSettings.longRunning: object expected"); + message.longRunning = $root.google.api.MethodSettings.LongRunning.fromObject(object.longRunning); + } + if (object.autoPopulatedFields) { + if (!Array.isArray(object.autoPopulatedFields)) + throw TypeError(".google.api.MethodSettings.autoPopulatedFields: array expected"); + message.autoPopulatedFields = []; + for (var i = 0; i < object.autoPopulatedFields.length; ++i) + message.autoPopulatedFields[i] = String(object.autoPopulatedFields[i]); + } + return message; + }; + + /** + * Creates a plain object from a MethodSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MethodSettings + * @static + * @param {google.api.MethodSettings} message MethodSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.autoPopulatedFields = []; + if (options.defaults) { + object.selector = ""; + object.longRunning = null; + } + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.longRunning != null && message.hasOwnProperty("longRunning")) + object.longRunning = $root.google.api.MethodSettings.LongRunning.toObject(message.longRunning, options); + if (message.autoPopulatedFields && message.autoPopulatedFields.length) { + object.autoPopulatedFields = []; + for (var j = 0; j < message.autoPopulatedFields.length; ++j) + object.autoPopulatedFields[j] = message.autoPopulatedFields[j]; + } + return object; + }; + + /** + * Converts this MethodSettings to JSON. + * @function toJSON + * @memberof google.api.MethodSettings + * @instance + * @returns {Object.} JSON object + */ + MethodSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MethodSettings + * @function getTypeUrl + * @memberof google.api.MethodSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MethodSettings"; + }; + + MethodSettings.LongRunning = (function() { + + /** + * Properties of a LongRunning. + * @memberof google.api.MethodSettings + * @interface ILongRunning + * @property {google.protobuf.IDuration|null} [initialPollDelay] LongRunning initialPollDelay + * @property {number|null} [pollDelayMultiplier] LongRunning pollDelayMultiplier + * @property {google.protobuf.IDuration|null} [maxPollDelay] LongRunning maxPollDelay + * @property {google.protobuf.IDuration|null} [totalPollTimeout] LongRunning totalPollTimeout + */ + + /** + * Constructs a new LongRunning. + * @memberof google.api.MethodSettings + * @classdesc Represents a LongRunning. + * @implements ILongRunning + * @constructor + * @param {google.api.MethodSettings.ILongRunning=} [properties] Properties to set + */ + function LongRunning(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]]; + } + + /** + * LongRunning initialPollDelay. + * @member {google.protobuf.IDuration|null|undefined} initialPollDelay + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.initialPollDelay = null; + + /** + * LongRunning pollDelayMultiplier. + * @member {number} pollDelayMultiplier + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.pollDelayMultiplier = 0; + + /** + * LongRunning maxPollDelay. + * @member {google.protobuf.IDuration|null|undefined} maxPollDelay + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.maxPollDelay = null; + + /** + * LongRunning totalPollTimeout. + * @member {google.protobuf.IDuration|null|undefined} totalPollTimeout + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.totalPollTimeout = null; + + /** + * Creates a new LongRunning instance using the specified properties. + * @function create + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.ILongRunning=} [properties] Properties to set + * @returns {google.api.MethodSettings.LongRunning} LongRunning instance + */ + LongRunning.create = function create(properties) { + return new LongRunning(properties); + }; + + /** + * Encodes the specified LongRunning message. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. + * @function encode + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.ILongRunning} message LongRunning message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LongRunning.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.initialPollDelay != null && Object.hasOwnProperty.call(message, "initialPollDelay")) + $root.google.protobuf.Duration.encode(message.initialPollDelay, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pollDelayMultiplier != null && Object.hasOwnProperty.call(message, "pollDelayMultiplier")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.pollDelayMultiplier); + if (message.maxPollDelay != null && Object.hasOwnProperty.call(message, "maxPollDelay")) + $root.google.protobuf.Duration.encode(message.maxPollDelay, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.totalPollTimeout != null && Object.hasOwnProperty.call(message, "totalPollTimeout")) + $root.google.protobuf.Duration.encode(message.totalPollTimeout, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LongRunning message, length delimited. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.ILongRunning} message LongRunning message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LongRunning.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LongRunning message from the specified reader or buffer. + * @function decode + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MethodSettings.LongRunning} LongRunning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LongRunning.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MethodSettings.LongRunning(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.initialPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 2: { + message.pollDelayMultiplier = reader.float(); + break; + } + case 3: { + message.maxPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 4: { + message.totalPollTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LongRunning message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MethodSettings.LongRunning} LongRunning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LongRunning.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LongRunning message. + * @function verify + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LongRunning.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.initialPollDelay != null && message.hasOwnProperty("initialPollDelay")) { + var error = $root.google.protobuf.Duration.verify(message.initialPollDelay); + if (error) + return "initialPollDelay." + error; + } + if (message.pollDelayMultiplier != null && message.hasOwnProperty("pollDelayMultiplier")) + if (typeof message.pollDelayMultiplier !== "number") + return "pollDelayMultiplier: number expected"; + if (message.maxPollDelay != null && message.hasOwnProperty("maxPollDelay")) { + var error = $root.google.protobuf.Duration.verify(message.maxPollDelay); + if (error) + return "maxPollDelay." + error; + } + if (message.totalPollTimeout != null && message.hasOwnProperty("totalPollTimeout")) { + var error = $root.google.protobuf.Duration.verify(message.totalPollTimeout); + if (error) + return "totalPollTimeout." + error; + } + return null; + }; + + /** + * Creates a LongRunning message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {Object.} object Plain object + * @returns {google.api.MethodSettings.LongRunning} LongRunning + */ + LongRunning.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MethodSettings.LongRunning) + return object; + var message = new $root.google.api.MethodSettings.LongRunning(); + if (object.initialPollDelay != null) { + if (typeof object.initialPollDelay !== "object") + throw TypeError(".google.api.MethodSettings.LongRunning.initialPollDelay: object expected"); + message.initialPollDelay = $root.google.protobuf.Duration.fromObject(object.initialPollDelay); + } + if (object.pollDelayMultiplier != null) + message.pollDelayMultiplier = Number(object.pollDelayMultiplier); + if (object.maxPollDelay != null) { + if (typeof object.maxPollDelay !== "object") + throw TypeError(".google.api.MethodSettings.LongRunning.maxPollDelay: object expected"); + message.maxPollDelay = $root.google.protobuf.Duration.fromObject(object.maxPollDelay); + } + if (object.totalPollTimeout != null) { + if (typeof object.totalPollTimeout !== "object") + throw TypeError(".google.api.MethodSettings.LongRunning.totalPollTimeout: object expected"); + message.totalPollTimeout = $root.google.protobuf.Duration.fromObject(object.totalPollTimeout); + } + return message; + }; + + /** + * Creates a plain object from a LongRunning message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.LongRunning} message LongRunning + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LongRunning.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.initialPollDelay = null; + object.pollDelayMultiplier = 0; + object.maxPollDelay = null; + object.totalPollTimeout = null; + } + if (message.initialPollDelay != null && message.hasOwnProperty("initialPollDelay")) + object.initialPollDelay = $root.google.protobuf.Duration.toObject(message.initialPollDelay, options); + if (message.pollDelayMultiplier != null && message.hasOwnProperty("pollDelayMultiplier")) + object.pollDelayMultiplier = options.json && !isFinite(message.pollDelayMultiplier) ? String(message.pollDelayMultiplier) : message.pollDelayMultiplier; + if (message.maxPollDelay != null && message.hasOwnProperty("maxPollDelay")) + object.maxPollDelay = $root.google.protobuf.Duration.toObject(message.maxPollDelay, options); + if (message.totalPollTimeout != null && message.hasOwnProperty("totalPollTimeout")) + object.totalPollTimeout = $root.google.protobuf.Duration.toObject(message.totalPollTimeout, options); + return object; + }; + + /** + * Converts this LongRunning to JSON. + * @function toJSON + * @memberof google.api.MethodSettings.LongRunning + * @instance + * @returns {Object.} JSON object + */ + LongRunning.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LongRunning + * @function getTypeUrl + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LongRunning.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MethodSettings.LongRunning"; + }; + + return LongRunning; + })(); + + return MethodSettings; + })(); + + /** + * ClientLibraryOrganization enum. + * @name google.api.ClientLibraryOrganization + * @enum {number} + * @property {number} CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED=0 CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED value + * @property {number} CLOUD=1 CLOUD value + * @property {number} ADS=2 ADS value + * @property {number} PHOTOS=3 PHOTOS value + * @property {number} STREET_VIEW=4 STREET_VIEW value + * @property {number} SHOPPING=5 SHOPPING value + * @property {number} GEO=6 GEO value + * @property {number} GENERATIVE_AI=7 GENERATIVE_AI value + */ + api.ClientLibraryOrganization = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED"] = 0; + values[valuesById[1] = "CLOUD"] = 1; + values[valuesById[2] = "ADS"] = 2; + values[valuesById[3] = "PHOTOS"] = 3; + values[valuesById[4] = "STREET_VIEW"] = 4; + values[valuesById[5] = "SHOPPING"] = 5; + values[valuesById[6] = "GEO"] = 6; + values[valuesById[7] = "GENERATIVE_AI"] = 7; + return values; + })(); + + /** + * ClientLibraryDestination enum. + * @name google.api.ClientLibraryDestination + * @enum {number} + * @property {number} CLIENT_LIBRARY_DESTINATION_UNSPECIFIED=0 CLIENT_LIBRARY_DESTINATION_UNSPECIFIED value + * @property {number} GITHUB=10 GITHUB value + * @property {number} PACKAGE_MANAGER=20 PACKAGE_MANAGER value + */ + api.ClientLibraryDestination = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED"] = 0; + values[valuesById[10] = "GITHUB"] = 10; + values[valuesById[20] = "PACKAGE_MANAGER"] = 20; + return values; + })(); + + api.SelectiveGapicGeneration = (function() { + + /** + * Properties of a SelectiveGapicGeneration. + * @memberof google.api + * @interface ISelectiveGapicGeneration + * @property {Array.|null} [methods] SelectiveGapicGeneration methods + * @property {boolean|null} [generateOmittedAsInternal] SelectiveGapicGeneration generateOmittedAsInternal + */ + + /** + * Constructs a new SelectiveGapicGeneration. + * @memberof google.api + * @classdesc Represents a SelectiveGapicGeneration. + * @implements ISelectiveGapicGeneration + * @constructor + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + */ + function SelectiveGapicGeneration(properties) { + this.methods = []; + 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]]; + } + + /** + * SelectiveGapicGeneration methods. + * @member {Array.} methods + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.methods = $util.emptyArray; + + /** + * SelectiveGapicGeneration generateOmittedAsInternal. + * @member {boolean} generateOmittedAsInternal + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.generateOmittedAsInternal = false; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @function create + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration instance + */ + SelectiveGapicGeneration.create = function create(properties) { + return new SelectiveGapicGeneration(properties); + }; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methods != null && message.methods.length) + for (var i = 0; i < message.methods.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.generateOmittedAsInternal); + return writer; + }; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @function decode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.methods && message.methods.length)) + message.methods = []; + message.methods.push(reader.string()); + break; + } + case 2: { + message.generateOmittedAsInternal = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectiveGapicGeneration message. + * @function verify + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectiveGapicGeneration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methods != null && message.hasOwnProperty("methods")) { + if (!Array.isArray(message.methods)) + return "methods: array expected"; + for (var i = 0; i < message.methods.length; ++i) + if (!$util.isString(message.methods[i])) + return "methods: string[] expected"; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + if (typeof message.generateOmittedAsInternal !== "boolean") + return "generateOmittedAsInternal: boolean expected"; + return null; + }; + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} object Plain object + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + */ + SelectiveGapicGeneration.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.SelectiveGapicGeneration) + return object; + var message = new $root.google.api.SelectiveGapicGeneration(); + if (object.methods) { + if (!Array.isArray(object.methods)) + throw TypeError(".google.api.SelectiveGapicGeneration.methods: array expected"); + message.methods = []; + for (var i = 0; i < object.methods.length; ++i) + message.methods[i] = String(object.methods[i]); + } + if (object.generateOmittedAsInternal != null) + message.generateOmittedAsInternal = Boolean(object.generateOmittedAsInternal); + return message; + }; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.SelectiveGapicGeneration} message SelectiveGapicGeneration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectiveGapicGeneration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.methods = []; + if (options.defaults) + object.generateOmittedAsInternal = false; + if (message.methods && message.methods.length) { + object.methods = []; + for (var j = 0; j < message.methods.length; ++j) + object.methods[j] = message.methods[j]; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + object.generateOmittedAsInternal = message.generateOmittedAsInternal; + return object; + }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @function toJSON + * @memberof google.api.SelectiveGapicGeneration + * @instance + * @returns {Object.} JSON object + */ + SelectiveGapicGeneration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @function getTypeUrl + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectiveGapicGeneration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.SelectiveGapicGeneration"; + }; + + return SelectiveGapicGeneration; + })(); + + /** + * LaunchStage enum. + * @name google.api.LaunchStage + * @enum {number} + * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value + * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value + * @property {number} PRELAUNCH=7 PRELAUNCH value + * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + */ + api.LaunchStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; + values[valuesById[6] = "UNIMPLEMENTED"] = 6; + values[valuesById[7] = "PRELAUNCH"] = 7; + values[valuesById[1] = "EARLY_ACCESS"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + return values; + })(); + + /** + * FieldBehavior enum. + * @name google.api.FieldBehavior + * @enum {number} + * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value + * @property {number} OPTIONAL=1 OPTIONAL value + * @property {number} REQUIRED=2 REQUIRED value + * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value + * @property {number} INPUT_ONLY=4 INPUT_ONLY value + * @property {number} IMMUTABLE=5 IMMUTABLE value + * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value + * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value + * @property {number} IDENTIFIER=8 IDENTIFIER value + */ + api.FieldBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + values[valuesById[3] = "OUTPUT_ONLY"] = 3; + values[valuesById[4] = "INPUT_ONLY"] = 4; + values[valuesById[5] = "IMMUTABLE"] = 5; + values[valuesById[6] = "UNORDERED_LIST"] = 6; + values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; + values[valuesById[8] = "IDENTIFIER"] = 8; + return values; + })(); + + api.ResourceDescriptor = (function() { + + /** + * Properties of a ResourceDescriptor. + * @memberof google.api + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style + */ + + /** + * Constructs a new ResourceDescriptor. + * @memberof google.api + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor + * @constructor + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + */ + function ResourceDescriptor(properties) { + this.pattern = []; + this.style = []; + 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]]; + } + + /** + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.type = ""; + + /** + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.pattern = $util.emptyArray; + + /** + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.nameField = ""; + + /** + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.history = 0; + + /** + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.plural = ""; + + /** + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.singular = ""; + + /** + * ResourceDescriptor style. + * @member {Array.} style + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.style = $util.emptyArray; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @function create + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance + */ + ResourceDescriptor.create = function create(properties) { + return new ResourceDescriptor(properties); + }; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.pattern != null && message.pattern.length) + for (var i = 0; i < message.pattern.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); + if (message.history != null && Object.hasOwnProperty.call(message, "history")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + if (message.style != null && message.style.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.style.length; ++i) + writer.int32(message.style[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + } + case 3: { + message.nameField = reader.string(); + break; + } + case 4: { + message.history = reader.int32(); + break; + } + case 5: { + message.plural = reader.string(); + break; + } + case 6: { + message.singular = reader.string(); + break; + } + case 10: { + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else + message.style.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceDescriptor message. + * @function verify + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && message.hasOwnProperty("pattern")) { + if (!Array.isArray(message.pattern)) + return "pattern: array expected"; + for (var i = 0; i < message.pattern.length; ++i) + if (!$util.isString(message.pattern[i])) + return "pattern: string[] expected"; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && message.hasOwnProperty("history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.plural != null && message.hasOwnProperty("plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && message.hasOwnProperty("singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; + if (message.style != null && message.hasOwnProperty("style")) { + if (!Array.isArray(message.style)) + return "style: array expected"; + for (var i = 0; i < message.style.length; ++i) + switch (message.style[i]) { + default: + return "style: enum value[] expected"; + case 0: + case 1: + break; + } + } + return null; + }; + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + */ + ResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceDescriptor) + return object; + var message = new $root.google.api.ResourceDescriptor(); + if (object.type != null) + message.type = String(object.type); + if (object.pattern) { + if (!Array.isArray(object.pattern)) + throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); + message.pattern = []; + for (var i = 0; i < object.pattern.length; ++i) + message.pattern[i] = String(object.pattern[i]); + } + if (object.nameField != null) + message.nameField = String(object.nameField); + switch (object.history) { + default: + if (typeof object.history === "number") { + message.history = object.history; + break; + } + break; + case "HISTORY_UNSPECIFIED": + case 0: + message.history = 0; + break; + case "ORIGINALLY_SINGLE_PATTERN": + case 1: + message.history = 1; + break; + case "FUTURE_MULTI_PATTERN": + case 2: + message.history = 2; + break; + } + if (object.plural != null) + message.plural = String(object.plural); + if (object.singular != null) + message.singular = String(object.singular); + if (object.style) { + if (!Array.isArray(object.style)) + throw TypeError(".google.api.ResourceDescriptor.style: array expected"); + message.style = []; + for (var i = 0; i < object.style.length; ++i) + switch (object.style[i]) { + default: + if (typeof object.style[i] === "number") { + message.style[i] = object.style[i]; + break; + } + case "STYLE_UNSPECIFIED": + case 0: + message.style[i] = 0; + break; + case "DECLARATIVE_FRIENDLY": + case 1: + message.style[i] = 1; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.ResourceDescriptor} message ResourceDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.pattern = []; + object.style = []; + } + if (options.defaults) { + object.type = ""; + object.nameField = ""; + object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; + object.plural = ""; + object.singular = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.pattern && message.pattern.length) { + object.pattern = []; + for (var j = 0; j < message.pattern.length; ++j) + object.pattern[j] = message.pattern[j]; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + object.nameField = message.nameField; + if (message.history != null && message.hasOwnProperty("history")) + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; + if (message.plural != null && message.hasOwnProperty("plural")) + object.plural = message.plural; + if (message.singular != null && message.hasOwnProperty("singular")) + object.singular = message.singular; + if (message.style && message.style.length) { + object.style = []; + for (var j = 0; j < message.style.length; ++j) + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + } + return object; + }; + + /** + * Converts this ResourceDescriptor to JSON. + * @function toJSON + * @memberof google.api.ResourceDescriptor + * @instance + * @returns {Object.} JSON object + */ + ResourceDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceDescriptor + * @function getTypeUrl + * @memberof google.api.ResourceDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceDescriptor"; + }; + + /** + * History enum. + * @name google.api.ResourceDescriptor.History + * @enum {number} + * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value + * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value + * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + */ + ResourceDescriptor.History = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; + values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; + return values; + })(); + + /** + * Style enum. + * @name google.api.ResourceDescriptor.Style + * @enum {number} + * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value + * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value + */ + ResourceDescriptor.Style = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; + return values; + })(); + + return ResourceDescriptor; + })(); + + api.ResourceReference = (function() { + + /** + * Properties of a ResourceReference. + * @memberof google.api + * @interface IResourceReference + * @property {string|null} [type] ResourceReference type + * @property {string|null} [childType] ResourceReference childType + */ + + /** + * Constructs a new ResourceReference. + * @memberof google.api + * @classdesc Represents a ResourceReference. + * @implements IResourceReference + * @constructor + * @param {google.api.IResourceReference=} [properties] Properties to set + */ + function ResourceReference(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]]; + } + + /** + * ResourceReference type. + * @member {string} type + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.type = ""; + + /** + * ResourceReference childType. + * @member {string} childType + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.childType = ""; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @function create + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference=} [properties] Properties to set + * @returns {google.api.ResourceReference} ResourceReference instance + */ + ResourceReference.create = function create(properties) { + return new ResourceReference(properties); + }; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); + return writer; + }; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.childType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceReference message. + * @function verify + * @memberof google.api.ResourceReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && message.hasOwnProperty("childType")) + if (!$util.isString(message.childType)) + return "childType: string expected"; + return null; + }; + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceReference} ResourceReference + */ + ResourceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceReference) + return object; + var message = new $root.google.api.ResourceReference(); + if (object.type != null) + message.type = String(object.type); + if (object.childType != null) + message.childType = String(object.childType); + return message; + }; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceReference + * @static + * @param {google.api.ResourceReference} message ResourceReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = ""; + object.childType = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.childType != null && message.hasOwnProperty("childType")) + object.childType = message.childType; + return object; + }; + + /** + * Converts this ResourceReference to JSON. + * @function toJSON + * @memberof google.api.ResourceReference + * @instance + * @returns {Object.} JSON object + */ + ResourceReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceReference + * @function getTypeUrl + * @memberof google.api.ResourceReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceReference"; + }; + + return ResourceReference; + })(); + + return api; + })(); + + google.protobuf = (function() { + + /** + * Namespace protobuf. + * @memberof google + * @namespace + */ + var protobuf = {}; + + protobuf.FileDescriptorSet = (function() { + + /** + * Properties of a FileDescriptorSet. + * @memberof google.protobuf + * @interface IFileDescriptorSet + * @property {Array.|null} [file] FileDescriptorSet file + */ + + /** + * Constructs a new FileDescriptorSet. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorSet. + * @implements IFileDescriptorSet + * @constructor + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + */ + function FileDescriptorSet(properties) { + this.file = []; + 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]]; + } + + /** + * FileDescriptorSet file. + * @member {Array.} file + * @memberof google.protobuf.FileDescriptorSet + * @instance + */ + FileDescriptorSet.prototype.file = $util.emptyArray; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance + */ + FileDescriptorSet.create = function create(properties) { + return new FileDescriptorSet(properties); + }; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.file != null && message.file.length) + for (var i = 0; i < message.file.length; ++i) + $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.file && message.file.length)) + message.file = []; + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorSet message. + * @function verify + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.file != null && message.hasOwnProperty("file")) { + if (!Array.isArray(message.file)) + return "file: array expected"; + for (var i = 0; i < message.file.length; ++i) { + var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); + if (error) + return "file." + error; + } + } + return null; + }; + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + */ + FileDescriptorSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorSet) + return object; + var message = new $root.google.protobuf.FileDescriptorSet(); + if (object.file) { + if (!Array.isArray(object.file)) + throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); + message.file = []; + for (var i = 0; i < object.file.length; ++i) { + if (typeof object.file[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); + message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.file = []; + if (message.file && message.file.length) { + object.file = []; + for (var j = 0; j < message.file.length; ++j) + object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); + } + return object; + }; + + /** + * Converts this FileDescriptorSet to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorSet + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileDescriptorSet + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorSet"; + }; + + return FileDescriptorSet; + })(); + + /** + * Edition enum. + * @name google.protobuf.Edition + * @enum {number} + * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_LEGACY=900 EDITION_LEGACY value + * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value + * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value + * @property {number} EDITION_2023=1000 EDITION_2023 value + * @property {number} EDITION_2024=1001 EDITION_2024 value + * @property {number} EDITION_1_TEST_ONLY=1 EDITION_1_TEST_ONLY value + * @property {number} EDITION_2_TEST_ONLY=2 EDITION_2_TEST_ONLY value + * @property {number} EDITION_99997_TEST_ONLY=99997 EDITION_99997_TEST_ONLY value + * @property {number} EDITION_99998_TEST_ONLY=99998 EDITION_99998_TEST_ONLY value + * @property {number} EDITION_99999_TEST_ONLY=99999 EDITION_99999_TEST_ONLY value + * @property {number} EDITION_MAX=2147483647 EDITION_MAX value + */ + protobuf.Edition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[900] = "EDITION_LEGACY"] = 900; + values[valuesById[998] = "EDITION_PROTO2"] = 998; + values[valuesById[999] = "EDITION_PROTO3"] = 999; + values[valuesById[1000] = "EDITION_2023"] = 1000; + values[valuesById[1001] = "EDITION_2024"] = 1001; + values[valuesById[1] = "EDITION_1_TEST_ONLY"] = 1; + values[valuesById[2] = "EDITION_2_TEST_ONLY"] = 2; + values[valuesById[99997] = "EDITION_99997_TEST_ONLY"] = 99997; + values[valuesById[99998] = "EDITION_99998_TEST_ONLY"] = 99998; + values[valuesById[99999] = "EDITION_99999_TEST_ONLY"] = 99999; + values[valuesById[2147483647] = "EDITION_MAX"] = 2147483647; + return values; + })(); + + protobuf.FileDescriptorProto = (function() { + + /** + * Properties of a FileDescriptorProto. + * @memberof google.protobuf + * @interface IFileDescriptorProto + * @property {string|null} [name] FileDescriptorProto name + * @property {string|null} ["package"] FileDescriptorProto package + * @property {Array.|null} [dependency] FileDescriptorProto dependency + * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency + * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [optionDependency] FileDescriptorProto optionDependency + * @property {Array.|null} [messageType] FileDescriptorProto messageType + * @property {Array.|null} [enumType] FileDescriptorProto enumType + * @property {Array.|null} [service] FileDescriptorProto service + * @property {Array.|null} [extension] FileDescriptorProto extension + * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options + * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo + * @property {string|null} [syntax] FileDescriptorProto syntax + * @property {google.protobuf.Edition|null} [edition] FileDescriptorProto edition + */ + + /** + * Constructs a new FileDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorProto. + * @implements IFileDescriptorProto + * @constructor + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + */ + function FileDescriptorProto(properties) { + this.dependency = []; + this.publicDependency = []; + this.weakDependency = []; + this.optionDependency = []; + this.messageType = []; + this.enumType = []; + this.service = []; + this.extension = []; + 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]]; + } + + /** + * FileDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.name = ""; + + /** + * FileDescriptorProto package. + * @member {string} package + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype["package"] = ""; + + /** + * FileDescriptorProto dependency. + * @member {Array.} dependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.dependency = $util.emptyArray; + + /** + * FileDescriptorProto publicDependency. + * @member {Array.} publicDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.publicDependency = $util.emptyArray; + + /** + * FileDescriptorProto weakDependency. + * @member {Array.} weakDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + + /** + * FileDescriptorProto optionDependency. + * @member {Array.} optionDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.optionDependency = $util.emptyArray; + + /** + * FileDescriptorProto messageType. + * @member {Array.} messageType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.messageType = $util.emptyArray; + + /** + * FileDescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * FileDescriptorProto service. + * @member {Array.} service + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.service = $util.emptyArray; + + /** + * FileDescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.extension = $util.emptyArray; + + /** + * FileDescriptorProto options. + * @member {google.protobuf.IFileOptions|null|undefined} options + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.options = null; + + /** + * FileDescriptorProto sourceCodeInfo. + * @member {google.protobuf.ISourceCodeInfo|null|undefined} sourceCodeInfo + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.sourceCodeInfo = null; + + /** + * FileDescriptorProto syntax. + * @member {string} syntax + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.syntax = ""; + + /** + * FileDescriptorProto edition. + * @member {google.protobuf.Edition} edition + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.edition = 0; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance + */ + FileDescriptorProto.create = function create(properties) { + return new FileDescriptorProto(properties); + }; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.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); + if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]); + if (message.dependency != null && message.dependency.length) + for (var i = 0; i < message.dependency.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); + if (message.messageType != null && message.messageType.length) + for (var i = 0; i < message.messageType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.messageType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.service != null && message.service.length) + for (var i = 0; i < message.service.length; ++i) + $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) + $root.google.protobuf.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.publicDependency != null && message.publicDependency.length) + for (var i = 0; i < message.publicDependency.length; ++i) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.publicDependency[i]); + if (message.weakDependency != null && message.weakDependency.length) + for (var i = 0; i < message.weakDependency.length; ++i) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + if (message.optionDependency != null && message.optionDependency.length) + for (var i = 0; i < message.optionDependency.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.optionDependency[i]); + return writer; + }; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message["package"] = reader.string(); + break; + } + case 3: { + if (!(message.dependency && message.dependency.length)) + message.dependency = []; + message.dependency.push(reader.string()); + break; + } + case 10: { + if (!(message.publicDependency && message.publicDependency.length)) + message.publicDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.publicDependency.push(reader.int32()); + } else + message.publicDependency.push(reader.int32()); + break; + } + case 11: { + if (!(message.weakDependency && message.weakDependency.length)) + message.weakDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.weakDependency.push(reader.int32()); + } else + message.weakDependency.push(reader.int32()); + break; + } + case 15: { + if (!(message.optionDependency && message.optionDependency.length)) + message.optionDependency = []; + message.optionDependency.push(reader.string()); + break; + } + case 4: { + if (!(message.messageType && message.messageType.length)) + message.messageType = []; + message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.service && message.service.length)) + message.service = []; + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 8: { + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + break; + } + case 12: { + message.syntax = reader.string(); + break; + } + case 14: { + message.edition = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorProto message. + * @function verify + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorProto.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"; + if (message["package"] != null && message.hasOwnProperty("package")) + if (!$util.isString(message["package"])) + return "package: string expected"; + if (message.dependency != null && message.hasOwnProperty("dependency")) { + if (!Array.isArray(message.dependency)) + return "dependency: array expected"; + for (var i = 0; i < message.dependency.length; ++i) + if (!$util.isString(message.dependency[i])) + return "dependency: string[] expected"; + } + if (message.publicDependency != null && message.hasOwnProperty("publicDependency")) { + if (!Array.isArray(message.publicDependency)) + return "publicDependency: array expected"; + for (var i = 0; i < message.publicDependency.length; ++i) + if (!$util.isInteger(message.publicDependency[i])) + return "publicDependency: integer[] expected"; + } + if (message.weakDependency != null && message.hasOwnProperty("weakDependency")) { + if (!Array.isArray(message.weakDependency)) + return "weakDependency: array expected"; + for (var i = 0; i < message.weakDependency.length; ++i) + if (!$util.isInteger(message.weakDependency[i])) + return "weakDependency: integer[] expected"; + } + if (message.optionDependency != null && message.hasOwnProperty("optionDependency")) { + if (!Array.isArray(message.optionDependency)) + return "optionDependency: array expected"; + for (var i = 0; i < message.optionDependency.length; ++i) + if (!$util.isString(message.optionDependency[i])) + return "optionDependency: string[] expected"; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) { + if (!Array.isArray(message.messageType)) + return "messageType: array expected"; + for (var i = 0; i < message.messageType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i]); + if (error) + return "messageType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.service != null && message.hasOwnProperty("service")) { + if (!Array.isArray(message.service)) + return "service: array expected"; + for (var i = 0; i < message.service.length; ++i) { + var error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); + if (error) + return "service." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FileOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) { + var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo); + if (error) + return "sourceCodeInfo." + error; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + if (!$util.isString(message.syntax)) + return "syntax: string expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + */ + FileDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorProto) + return object; + var message = new $root.google.protobuf.FileDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object["package"] != null) + message["package"] = String(object["package"]); + if (object.dependency) { + if (!Array.isArray(object.dependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); + message.dependency = []; + for (var i = 0; i < object.dependency.length; ++i) + message.dependency[i] = String(object.dependency[i]); + } + if (object.publicDependency) { + if (!Array.isArray(object.publicDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.publicDependency: array expected"); + message.publicDependency = []; + for (var i = 0; i < object.publicDependency.length; ++i) + message.publicDependency[i] = object.publicDependency[i] | 0; + } + if (object.weakDependency) { + if (!Array.isArray(object.weakDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.weakDependency: array expected"); + message.weakDependency = []; + for (var i = 0; i < object.weakDependency.length; ++i) + message.weakDependency[i] = object.weakDependency[i] | 0; + } + if (object.optionDependency) { + if (!Array.isArray(object.optionDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.optionDependency: array expected"); + message.optionDependency = []; + for (var i = 0; i < object.optionDependency.length; ++i) + message.optionDependency[i] = String(object.optionDependency[i]); + } + if (object.messageType) { + if (!Array.isArray(object.messageType)) + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); + message.messageType = []; + for (var i = 0; i < object.messageType.length; ++i) { + if (typeof object.messageType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); + message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.service) { + if (!Array.isArray(object.service)) + throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); + message.service = []; + for (var i = 0; i < object.service.length; ++i) { + if (typeof object.service[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); + message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FileOptions.fromObject(object.options); + } + if (object.sourceCodeInfo != null) { + if (typeof object.sourceCodeInfo !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo); + } + if (object.syntax != null) + message.syntax = String(object.syntax); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.dependency = []; + object.messageType = []; + object.enumType = []; + object.service = []; + object.extension = []; + object.publicDependency = []; + object.weakDependency = []; + object.optionDependency = []; + } + if (options.defaults) { + object.name = ""; + object["package"] = ""; + object.options = null; + object.sourceCodeInfo = null; + object.syntax = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message["package"] != null && message.hasOwnProperty("package")) + object["package"] = message["package"]; + if (message.dependency && message.dependency.length) { + object.dependency = []; + for (var j = 0; j < message.dependency.length; ++j) + object.dependency[j] = message.dependency[j]; + } + if (message.messageType && message.messageType.length) { + object.messageType = []; + for (var j = 0; j < message.messageType.length; ++j) + object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.service && message.service.length) { + object.service = []; + for (var j = 0; j < message.service.length; ++j) + object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) + object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options); + if (message.publicDependency && message.publicDependency.length) { + object.publicDependency = []; + for (var j = 0; j < message.publicDependency.length; ++j) + object.publicDependency[j] = message.publicDependency[j]; + } + if (message.weakDependency && message.weakDependency.length) { + object.weakDependency = []; + for (var j = 0; j < message.weakDependency.length; ++j) + object.weakDependency[j] = message.weakDependency[j]; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + object.syntax = message.syntax; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.optionDependency && message.optionDependency.length) { + object.optionDependency = []; + for (var j = 0; j < message.optionDependency.length; ++j) + object.optionDependency[j] = message.optionDependency[j]; + } + return object; + }; + + /** + * Converts this FileDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorProto"; + }; + + return FileDescriptorProto; + })(); + + protobuf.DescriptorProto = (function() { + + /** + * Properties of a DescriptorProto. + * @memberof google.protobuf + * @interface IDescriptorProto + * @property {string|null} [name] DescriptorProto name + * @property {Array.|null} [field] DescriptorProto field + * @property {Array.|null} [extension] DescriptorProto extension + * @property {Array.|null} [nestedType] DescriptorProto nestedType + * @property {Array.|null} [enumType] DescriptorProto enumType + * @property {Array.|null} [extensionRange] DescriptorProto extensionRange + * @property {Array.|null} [oneofDecl] DescriptorProto oneofDecl + * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options + * @property {Array.|null} [reservedRange] DescriptorProto reservedRange + * @property {Array.|null} [reservedName] DescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] DescriptorProto visibility + */ + + /** + * Constructs a new DescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a DescriptorProto. + * @implements IDescriptorProto + * @constructor + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + */ + function DescriptorProto(properties) { + this.field = []; + this.extension = []; + this.nestedType = []; + this.enumType = []; + this.extensionRange = []; + this.oneofDecl = []; + this.reservedRange = []; + this.reservedName = []; + 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]]; + } + + /** + * DescriptorProto name. + * @member {string} name + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.name = ""; + + /** + * DescriptorProto field. + * @member {Array.} field + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.field = $util.emptyArray; + + /** + * DescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extension = $util.emptyArray; + + /** + * DescriptorProto nestedType. + * @member {Array.} nestedType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.nestedType = $util.emptyArray; + + /** + * DescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * DescriptorProto extensionRange. + * @member {Array.} extensionRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extensionRange = $util.emptyArray; + + /** + * DescriptorProto oneofDecl. + * @member {Array.} oneofDecl + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.oneofDecl = $util.emptyArray; + + /** + * DescriptorProto options. + * @member {google.protobuf.IMessageOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.options = null; + + /** + * DescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * DescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * DescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.visibility = 0; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto} DescriptorProto instance + */ + DescriptorProto.create = function create(properties) { + return new DescriptorProto(properties); + }; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.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); + if (message.field != null && message.field.length) + for (var i = 0; i < message.field.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nestedType != null && message.nestedType.length) + for (var i = 0; i < message.nestedType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.extensionRange != null && message.extensionRange.length) + for (var i = 0; i < message.extensionRange.length; ++i) + $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.oneofDecl != null && message.oneofDecl.length) + for (var i = 0; i < message.oneofDecl.length; ++i) + $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.visibility); + return writer; + }; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + break; + } + case 10: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } + case 11: { + message.visibility = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DescriptorProto message. + * @function verify + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DescriptorProto.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"; + if (message.field != null && message.hasOwnProperty("field")) { + if (!Array.isArray(message.field)) + return "field: array expected"; + for (var i = 0; i < message.field.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); + if (error) + return "field." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.nestedType != null && message.hasOwnProperty("nestedType")) { + if (!Array.isArray(message.nestedType)) + return "nestedType: array expected"; + for (var i = 0; i < message.nestedType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i]); + if (error) + return "nestedType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.extensionRange != null && message.hasOwnProperty("extensionRange")) { + if (!Array.isArray(message.extensionRange)) + return "extensionRange: array expected"; + for (var i = 0; i < message.extensionRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i]); + if (error) + return "extensionRange." + error; + } + } + if (message.oneofDecl != null && message.hasOwnProperty("oneofDecl")) { + if (!Array.isArray(message.oneofDecl)) + return "oneofDecl: array expected"; + for (var i = 0; i < message.oneofDecl.length; ++i) { + var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i]); + if (error) + return "oneofDecl." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MessageOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto} DescriptorProto + */ + DescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto) + return object; + var message = new $root.google.protobuf.DescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.field) { + if (!Array.isArray(object.field)) + throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); + message.field = []; + for (var i = 0; i < object.field.length; ++i) { + if (typeof object.field[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); + message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.nestedType) { + if (!Array.isArray(object.nestedType)) + throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); + message.nestedType = []; + for (var i = 0; i < object.nestedType.length; ++i) { + if (typeof object.nestedType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); + message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.extensionRange) { + if (!Array.isArray(object.extensionRange)) + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); + message.extensionRange = []; + for (var i = 0; i < object.extensionRange.length; ++i) { + if (typeof object.extensionRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); + message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i]); + } + } + if (object.oneofDecl) { + if (!Array.isArray(object.oneofDecl)) + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); + message.oneofDecl = []; + for (var i = 0; i < object.oneofDecl.length; ++i) { + if (typeof object.oneofDecl[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); + message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.DescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.DescriptorProto} message DescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.field = []; + object.nestedType = []; + object.enumType = []; + object.extensionRange = []; + object.extension = []; + object.oneofDecl = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.field && message.field.length) { + object.field = []; + for (var j = 0; j < message.field.length; ++j) + object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); + } + if (message.nestedType && message.nestedType.length) { + object.nestedType = []; + for (var j = 0; j < message.nestedType.length; ++j) + object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.extensionRange && message.extensionRange.length) { + object.extensionRange = []; + for (var j = 0; j < message.extensionRange.length; ++j) + object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); + if (message.oneofDecl && message.oneofDecl.length) { + object.oneofDecl = []; + for (var j = 0; j < message.oneofDecl.length; ++j) + object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options); + } + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; + return object; + }; + + /** + * Converts this DescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto + * @instance + * @returns {Object.} JSON object + */ + DescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto"; + }; + + DescriptorProto.ExtensionRange = (function() { + + /** + * Properties of an ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @interface IExtensionRange + * @property {number|null} [start] ExtensionRange start + * @property {number|null} [end] ExtensionRange end + * @property {google.protobuf.IExtensionRangeOptions|null} [options] ExtensionRange options + */ + + /** + * Constructs a new ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents an ExtensionRange. + * @implements IExtensionRange + * @constructor + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + */ + function ExtensionRange(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]]; + } + + /** + * ExtensionRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.start = 0; + + /** + * ExtensionRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.end = 0; + + /** + * ExtensionRange options. + * @member {google.protobuf.IExtensionRangeOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.options = null; + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance + */ + ExtensionRange.create = function create(properties) { + return new ExtensionRange(properties); + }; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + */ + ExtensionRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); + message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + object.options = null; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ExtensionRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + * @returns {Object.} JSON object + */ + ExtensionRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExtensionRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ExtensionRange"; + }; + + return ExtensionRange; + })(); + + DescriptorProto.ReservedRange = (function() { + + /** + * Properties of a ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @interface IReservedRange + * @property {number|null} [start] ReservedRange start + * @property {number|null} [end] ReservedRange end + */ + + /** + * Constructs a new ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents a ReservedRange. + * @implements IReservedRange + * @constructor + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + */ + function ReservedRange(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]]; + } + + /** + * ReservedRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.start = 0; + + /** + * ReservedRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.end = 0; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance + */ + ReservedRange.create = function create(properties) { + return new ReservedRange(properties); + }; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReservedRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + */ + ReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this ReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + * @returns {Object.} JSON object + */ + ReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReservedRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ReservedRange"; + }; + + return ReservedRange; + })(); + + return DescriptorProto; + })(); + + protobuf.ExtensionRangeOptions = (function() { + + /** + * Properties of an ExtensionRangeOptions. + * @memberof google.protobuf + * @interface IExtensionRangeOptions + * @property {Array.|null} [uninterpretedOption] ExtensionRangeOptions uninterpretedOption + * @property {Array.|null} [declaration] ExtensionRangeOptions declaration + * @property {google.protobuf.IFeatureSet|null} [features] ExtensionRangeOptions features + * @property {google.protobuf.ExtensionRangeOptions.VerificationState|null} [verification] ExtensionRangeOptions verification + */ + + /** + * Constructs a new ExtensionRangeOptions. + * @memberof google.protobuf + * @classdesc Represents an ExtensionRangeOptions. + * @implements IExtensionRangeOptions + * @constructor + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + */ + function ExtensionRangeOptions(properties) { + this.uninterpretedOption = []; + this.declaration = []; + 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]]; + } + + /** + * ExtensionRangeOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * ExtensionRangeOptions declaration. + * @member {Array.} declaration + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.declaration = $util.emptyArray; + + /** + * ExtensionRangeOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.features = null; + + /** + * ExtensionRangeOptions verification. + * @member {google.protobuf.ExtensionRangeOptions.VerificationState} verification + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.verification = 1; + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions instance + */ + ExtensionRangeOptions.create = function create(properties) { + return new ExtensionRangeOptions(properties); + }; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.declaration != null && message.declaration.length) + for (var i = 0; i < message.declaration.length; ++i) + $root.google.protobuf.ExtensionRangeOptions.Declaration.encode(message.declaration[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.verification != null && Object.hasOwnProperty.call(message, "verification")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.verification); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.declaration && message.declaration.length)) + message.declaration = []; + message.declaration.push($root.google.protobuf.ExtensionRangeOptions.Declaration.decode(reader, reader.uint32())); + break; + } + case 50: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 3: { + message.verification = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRangeOptions message. + * @function verify + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRangeOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message.declaration != null && message.hasOwnProperty("declaration")) { + if (!Array.isArray(message.declaration)) + return "declaration: array expected"; + for (var i = 0; i < message.declaration.length; ++i) { + var error = $root.google.protobuf.ExtensionRangeOptions.Declaration.verify(message.declaration[i]); + if (error) + return "declaration." + error; + } + } + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.verification != null && message.hasOwnProperty("verification")) + switch (message.verification) { + default: + return "verification: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + */ + ExtensionRangeOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ExtensionRangeOptions) + return object; + var message = new $root.google.protobuf.ExtensionRangeOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object.declaration) { + if (!Array.isArray(object.declaration)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: array expected"); + message.declaration = []; + for (var i = 0; i < object.declaration.length; ++i) { + if (typeof object.declaration[i] !== "object") + throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: object expected"); + message.declaration[i] = $root.google.protobuf.ExtensionRangeOptions.Declaration.fromObject(object.declaration[i]); + } + } + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.ExtensionRangeOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + switch (object.verification) { + case "DECLARATION": + case 0: + message.verification = 0; + break; + default: + if (typeof object.verification === "number") { + message.verification = object.verification; + break; + } + break; + case "UNVERIFIED": + case 1: + message.verification = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.ExtensionRangeOptions} message ExtensionRangeOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRangeOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.declaration = []; + object.uninterpretedOption = []; + } + if (options.defaults) { + object.verification = options.enums === String ? "UNVERIFIED" : 1; + object.features = null; + } + if (message.declaration && message.declaration.length) { + object.declaration = []; + for (var j = 0; j < message.declaration.length; ++j) + object.declaration[j] = $root.google.protobuf.ExtensionRangeOptions.Declaration.toObject(message.declaration[j], options); + } + if (message.verification != null && message.hasOwnProperty("verification")) + object.verification = options.enums === String ? $root.google.protobuf.ExtensionRangeOptions.VerificationState[message.verification] === undefined ? message.verification : $root.google.protobuf.ExtensionRangeOptions.VerificationState[message.verification] : message.verification; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + * @returns {Object.} JSON object + */ + ExtensionRangeOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExtensionRangeOptions + * @function getTypeUrl + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRangeOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions"; + }; + + ExtensionRangeOptions.Declaration = (function() { + + /** + * Properties of a Declaration. + * @memberof google.protobuf.ExtensionRangeOptions + * @interface IDeclaration + * @property {number|null} [number] Declaration number + * @property {string|null} [fullName] Declaration fullName + * @property {string|null} [type] Declaration type + * @property {boolean|null} [reserved] Declaration reserved + * @property {boolean|null} [repeated] Declaration repeated + */ + + /** + * Constructs a new Declaration. + * @memberof google.protobuf.ExtensionRangeOptions + * @classdesc Represents a Declaration. + * @implements IDeclaration + * @constructor + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration=} [properties] Properties to set + */ + function Declaration(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]]; + } + + /** + * Declaration number. + * @member {number} number + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.number = 0; + + /** + * Declaration fullName. + * @member {string} fullName + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.fullName = ""; + + /** + * Declaration type. + * @member {string} type + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.type = ""; + + /** + * Declaration reserved. + * @member {boolean} reserved + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.reserved = false; + + /** + * Declaration repeated. + * @member {boolean} repeated + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.repeated = false; + + /** + * Creates a new Declaration instance using the specified properties. + * @function create + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration=} [properties] Properties to set + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration instance + */ + Declaration.create = function create(properties) { + return new Declaration(properties); + }; + + /** + * Encodes the specified Declaration message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration} message Declaration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Declaration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.number); + if (message.fullName != null && Object.hasOwnProperty.call(message, "fullName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.fullName); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.type); + if (message.reserved != null && Object.hasOwnProperty.call(message, "reserved")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.reserved); + if (message.repeated != null && Object.hasOwnProperty.call(message, "repeated")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.repeated); + return writer; + }; + + /** + * Encodes the specified Declaration message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration} message Declaration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Declaration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Declaration message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Declaration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions.Declaration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.number = reader.int32(); + break; + } + case 2: { + message.fullName = reader.string(); + break; + } + case 3: { + message.type = reader.string(); + break; + } + case 5: { + message.reserved = reader.bool(); + break; + } + case 6: { + message.repeated = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Declaration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Declaration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Declaration message. + * @function verify + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Declaration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.fullName != null && message.hasOwnProperty("fullName")) + if (!$util.isString(message.fullName)) + return "fullName: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.reserved != null && message.hasOwnProperty("reserved")) + if (typeof message.reserved !== "boolean") + return "reserved: boolean expected"; + if (message.repeated != null && message.hasOwnProperty("repeated")) + if (typeof message.repeated !== "boolean") + return "repeated: boolean expected"; + return null; + }; + + /** + * Creates a Declaration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration + */ + Declaration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ExtensionRangeOptions.Declaration) + return object; + var message = new $root.google.protobuf.ExtensionRangeOptions.Declaration(); + if (object.number != null) + message.number = object.number | 0; + if (object.fullName != null) + message.fullName = String(object.fullName); + if (object.type != null) + message.type = String(object.type); + if (object.reserved != null) + message.reserved = Boolean(object.reserved); + if (object.repeated != null) + message.repeated = Boolean(object.repeated); + return message; + }; + + /** + * Creates a plain object from a Declaration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.Declaration} message Declaration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Declaration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.number = 0; + object.fullName = ""; + object.type = ""; + object.reserved = false; + object.repeated = false; + } + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.fullName != null && message.hasOwnProperty("fullName")) + object.fullName = message.fullName; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.reserved != null && message.hasOwnProperty("reserved")) + object.reserved = message.reserved; + if (message.repeated != null && message.hasOwnProperty("repeated")) + object.repeated = message.repeated; + return object; + }; + + /** + * Converts this Declaration to JSON. + * @function toJSON + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + * @returns {Object.} JSON object + */ + Declaration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Declaration + * @function getTypeUrl + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Declaration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions.Declaration"; + }; + + return Declaration; + })(); + + /** + * VerificationState enum. + * @name google.protobuf.ExtensionRangeOptions.VerificationState + * @enum {number} + * @property {number} DECLARATION=0 DECLARATION value + * @property {number} UNVERIFIED=1 UNVERIFIED value + */ + ExtensionRangeOptions.VerificationState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DECLARATION"] = 0; + values[valuesById[1] = "UNVERIFIED"] = 1; + return values; + })(); + + return ExtensionRangeOptions; + })(); + + protobuf.FieldDescriptorProto = (function() { + + /** + * Properties of a FieldDescriptorProto. + * @memberof google.protobuf + * @interface IFieldDescriptorProto + * @property {string|null} [name] FieldDescriptorProto name + * @property {number|null} [number] FieldDescriptorProto number + * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label + * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type + * @property {string|null} [typeName] FieldDescriptorProto typeName + * @property {string|null} [extendee] FieldDescriptorProto extendee + * @property {string|null} [defaultValue] FieldDescriptorProto defaultValue + * @property {number|null} [oneofIndex] FieldDescriptorProto oneofIndex + * @property {string|null} [jsonName] FieldDescriptorProto jsonName + * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options + * @property {boolean|null} [proto3Optional] FieldDescriptorProto proto3Optional + */ + + /** + * Constructs a new FieldDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FieldDescriptorProto. + * @implements IFieldDescriptorProto + * @constructor + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + */ + function FieldDescriptorProto(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]]; + } + + /** + * FieldDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.name = ""; + + /** + * FieldDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.number = 0; + + /** + * FieldDescriptorProto label. + * @member {google.protobuf.FieldDescriptorProto.Label} label + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.label = 1; + + /** + * FieldDescriptorProto type. + * @member {google.protobuf.FieldDescriptorProto.Type} type + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.type = 1; + + /** + * FieldDescriptorProto typeName. + * @member {string} typeName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.typeName = ""; + + /** + * FieldDescriptorProto extendee. + * @member {string} extendee + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.extendee = ""; + + /** + * FieldDescriptorProto defaultValue. + * @member {string} defaultValue + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.defaultValue = ""; + + /** + * FieldDescriptorProto oneofIndex. + * @member {number} oneofIndex + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.oneofIndex = 0; + + /** + * FieldDescriptorProto jsonName. + * @member {string} jsonName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.jsonName = ""; + + /** + * FieldDescriptorProto options. + * @member {google.protobuf.IFieldOptions|null|undefined} options + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.options = null; + + /** + * FieldDescriptorProto proto3Optional. + * @member {boolean} proto3Optional + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.proto3Optional = false; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance + */ + FieldDescriptorProto.create = function create(properties) { + return new FieldDescriptorProto(properties); + }; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.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); + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); + if (message.label != null && Object.hasOwnProperty.call(message, "label")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); + if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.proto3Optional); + return writer; + }; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.number = reader.int32(); + break; + } + case 4: { + message.label = reader.int32(); + break; + } + case 5: { + message.type = reader.int32(); + break; + } + case 6: { + message.typeName = reader.string(); + break; + } + case 2: { + message.extendee = reader.string(); + break; + } + case 7: { + message.defaultValue = reader.string(); + break; + } + case 9: { + message.oneofIndex = reader.int32(); + break; + } + case 10: { + message.jsonName = reader.string(); + break; + } + case 8: { + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + break; + } + case 17: { + message.proto3Optional = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldDescriptorProto message. + * @function verify + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldDescriptorProto.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"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.label != null && message.hasOwnProperty("label")) + switch (message.label) { + default: + return "label: enum value expected"; + case 1: + case 3: + case 2: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + break; + } + if (message.typeName != null && message.hasOwnProperty("typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + if (message.extendee != null && message.hasOwnProperty("extendee")) + if (!$util.isString(message.extendee)) + return "extendee: string expected"; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (!$util.isString(message.defaultValue)) + return "defaultValue: string expected"; + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + if (!$util.isInteger(message.oneofIndex)) + return "oneofIndex: integer expected"; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + if (!$util.isString(message.jsonName)) + return "jsonName: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FieldOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + if (typeof message.proto3Optional !== "boolean") + return "proto3Optional: boolean expected"; + return null; + }; + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + */ + FieldDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldDescriptorProto) + return object; + var message = new $root.google.protobuf.FieldDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + switch (object.label) { + default: + if (typeof object.label === "number") { + message.label = object.label; + break; + } + break; + case "LABEL_OPTIONAL": + case 1: + message.label = 1; + break; + case "LABEL_REPEATED": + case 3: + message.label = 3; + break; + case "LABEL_REQUIRED": + case 2: + message.label = 2; + break; + } + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "TYPE_DOUBLE": + case 1: + message.type = 1; + break; + case "TYPE_FLOAT": + case 2: + message.type = 2; + break; + case "TYPE_INT64": + case 3: + message.type = 3; + break; + case "TYPE_UINT64": + case 4: + message.type = 4; + break; + case "TYPE_INT32": + case 5: + message.type = 5; + break; + case "TYPE_FIXED64": + case 6: + message.type = 6; + break; + case "TYPE_FIXED32": + case 7: + message.type = 7; + break; + case "TYPE_BOOL": + case 8: + message.type = 8; + break; + case "TYPE_STRING": + case 9: + message.type = 9; + break; + case "TYPE_GROUP": + case 10: + message.type = 10; + break; + case "TYPE_MESSAGE": + case 11: + message.type = 11; + break; + case "TYPE_BYTES": + case 12: + message.type = 12; + break; + case "TYPE_UINT32": + case 13: + message.type = 13; + break; + case "TYPE_ENUM": + case 14: + message.type = 14; + break; + case "TYPE_SFIXED32": + case 15: + message.type = 15; + break; + case "TYPE_SFIXED64": + case 16: + message.type = 16; + break; + case "TYPE_SINT32": + case 17: + message.type = 17; + break; + case "TYPE_SINT64": + case 18: + message.type = 18; + break; + } + if (object.typeName != null) + message.typeName = String(object.typeName); + if (object.extendee != null) + message.extendee = String(object.extendee); + if (object.defaultValue != null) + message.defaultValue = String(object.defaultValue); + if (object.oneofIndex != null) + message.oneofIndex = object.oneofIndex | 0; + if (object.jsonName != null) + message.jsonName = String(object.jsonName); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); + } + if (object.proto3Optional != null) + message.proto3Optional = Boolean(object.proto3Optional); + return message; + }; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.extendee = ""; + object.number = 0; + object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; + object.type = options.enums === String ? "TYPE_DOUBLE" : 1; + object.typeName = ""; + object.defaultValue = ""; + object.options = null; + object.oneofIndex = 0; + object.jsonName = ""; + object.proto3Optional = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.extendee != null && message.hasOwnProperty("extendee")) + object.extendee = message.extendee; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.label != null && message.hasOwnProperty("label")) + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] === undefined ? message.label : $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] === undefined ? message.type : $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; + if (message.typeName != null && message.hasOwnProperty("typeName")) + object.typeName = message.typeName; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + object.defaultValue = message.defaultValue; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + object.oneofIndex = message.oneofIndex; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + object.jsonName = message.jsonName; + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + object.proto3Optional = message.proto3Optional; + return object; + }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FieldDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FieldDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldDescriptorProto"; + }; + + /** + * Type enum. + * @name google.protobuf.FieldDescriptorProto.Type + * @enum {number} + * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value + * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value + * @property {number} TYPE_INT64=3 TYPE_INT64 value + * @property {number} TYPE_UINT64=4 TYPE_UINT64 value + * @property {number} TYPE_INT32=5 TYPE_INT32 value + * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value + * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value + * @property {number} TYPE_BOOL=8 TYPE_BOOL value + * @property {number} TYPE_STRING=9 TYPE_STRING value + * @property {number} TYPE_GROUP=10 TYPE_GROUP value + * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value + * @property {number} TYPE_BYTES=12 TYPE_BYTES value + * @property {number} TYPE_UINT32=13 TYPE_UINT32 value + * @property {number} TYPE_ENUM=14 TYPE_ENUM value + * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value + * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value + * @property {number} TYPE_SINT32=17 TYPE_SINT32 value + * @property {number} TYPE_SINT64=18 TYPE_SINT64 value + */ + FieldDescriptorProto.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "TYPE_DOUBLE"] = 1; + values[valuesById[2] = "TYPE_FLOAT"] = 2; + values[valuesById[3] = "TYPE_INT64"] = 3; + values[valuesById[4] = "TYPE_UINT64"] = 4; + values[valuesById[5] = "TYPE_INT32"] = 5; + values[valuesById[6] = "TYPE_FIXED64"] = 6; + values[valuesById[7] = "TYPE_FIXED32"] = 7; + values[valuesById[8] = "TYPE_BOOL"] = 8; + values[valuesById[9] = "TYPE_STRING"] = 9; + values[valuesById[10] = "TYPE_GROUP"] = 10; + values[valuesById[11] = "TYPE_MESSAGE"] = 11; + values[valuesById[12] = "TYPE_BYTES"] = 12; + values[valuesById[13] = "TYPE_UINT32"] = 13; + values[valuesById[14] = "TYPE_ENUM"] = 14; + values[valuesById[15] = "TYPE_SFIXED32"] = 15; + values[valuesById[16] = "TYPE_SFIXED64"] = 16; + values[valuesById[17] = "TYPE_SINT32"] = 17; + values[valuesById[18] = "TYPE_SINT64"] = 18; + return values; + })(); + + /** + * Label enum. + * @name google.protobuf.FieldDescriptorProto.Label + * @enum {number} + * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value + * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value + * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value + */ + FieldDescriptorProto.Label = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "LABEL_OPTIONAL"] = 1; + values[valuesById[3] = "LABEL_REPEATED"] = 3; + values[valuesById[2] = "LABEL_REQUIRED"] = 2; + return values; + })(); + + return FieldDescriptorProto; + })(); + + protobuf.OneofDescriptorProto = (function() { + + /** + * Properties of an OneofDescriptorProto. + * @memberof google.protobuf + * @interface IOneofDescriptorProto + * @property {string|null} [name] OneofDescriptorProto name + * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options + */ + + /** + * Constructs a new OneofDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an OneofDescriptorProto. + * @implements IOneofDescriptorProto + * @constructor + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + */ + function OneofDescriptorProto(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]]; + } + + /** + * OneofDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.name = ""; + + /** + * OneofDescriptorProto options. + * @member {google.protobuf.IOneofOptions|null|undefined} options + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.options = null; + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance + */ + OneofDescriptorProto.create = function create(properties) { + return new OneofDescriptorProto(properties); + }; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.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); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofDescriptorProto message. + * @function verify + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofDescriptorProto.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"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.OneofOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + */ + OneofDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofDescriptorProto) + return object; + var message = new $root.google.protobuf.OneofDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.OneofDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + OneofDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OneofDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofDescriptorProto"; + }; + + return OneofDescriptorProto; + })(); + + protobuf.EnumDescriptorProto = (function() { + + /** + * Properties of an EnumDescriptorProto. + * @memberof google.protobuf + * @interface IEnumDescriptorProto + * @property {string|null} [name] EnumDescriptorProto name + * @property {Array.|null} [value] EnumDescriptorProto value + * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options + * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange + * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] EnumDescriptorProto visibility + */ + + /** + * Constructs a new EnumDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumDescriptorProto. + * @implements IEnumDescriptorProto + * @constructor + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + */ + function EnumDescriptorProto(properties) { + this.value = []; + this.reservedRange = []; + this.reservedName = []; + 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]]; + } + + /** + * EnumDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.name = ""; + + /** + * EnumDescriptorProto value. + * @member {Array.} value + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.value = $util.emptyArray; + + /** + * EnumDescriptorProto options. + * @member {google.protobuf.IEnumOptions|null|undefined} options + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.options = null; + + /** + * EnumDescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * EnumDescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * EnumDescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.visibility = 0; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance + */ + EnumDescriptorProto.create = function create(properties) { + return new EnumDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.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); + if (message.value != null && message.value.length) + for (var i = 0; i < message.value.length; ++i) + $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.visibility); + return writer; + }; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } + case 6: { + message.visibility = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumDescriptorProto.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"; + if (message.value != null && message.hasOwnProperty("value")) { + if (!Array.isArray(message.value)) + return "value: array expected"; + for (var i = 0; i < message.value.length; ++i) { + var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); + if (error) + return "value." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + */ + EnumDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.value) { + if (!Array.isArray(object.value)) + throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); + message.value = []; + for (var i = 0; i < object.value.length; ++i) { + if (typeof object.value[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); + message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.value = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value && message.value.length) { + object.value = []; + for (var j = 0; j < message.value.length; ++j) + object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; + return object; + }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto"; + }; + + EnumDescriptorProto.EnumReservedRange = (function() { + + /** + * Properties of an EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @interface IEnumReservedRange + * @property {number|null} [start] EnumReservedRange start + * @property {number|null} [end] EnumReservedRange end + */ + + /** + * Constructs a new EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @classdesc Represents an EnumReservedRange. + * @implements IEnumReservedRange + * @constructor + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + */ + function EnumReservedRange(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]]; + } + + /** + * EnumReservedRange start. + * @member {number} start + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.start = 0; + + /** + * EnumReservedRange end. + * @member {number} end + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.end = 0; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange instance + */ + EnumReservedRange.create = function create(properties) { + return new EnumReservedRange(properties); + }; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumReservedRange message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + */ + EnumReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.EnumReservedRange} message EnumReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this EnumReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + * @returns {Object.} JSON object + */ + EnumReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumReservedRange + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto.EnumReservedRange"; + }; + + return EnumReservedRange; + })(); + + return EnumDescriptorProto; + })(); + + protobuf.EnumValueDescriptorProto = (function() { + + /** + * Properties of an EnumValueDescriptorProto. + * @memberof google.protobuf + * @interface IEnumValueDescriptorProto + * @property {string|null} [name] EnumValueDescriptorProto name + * @property {number|null} [number] EnumValueDescriptorProto number + * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options + */ + + /** + * Constructs a new EnumValueDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumValueDescriptorProto. + * @implements IEnumValueDescriptorProto + * @constructor + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + */ + function EnumValueDescriptorProto(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]]; + } + + /** + * EnumValueDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.name = ""; + + /** + * EnumValueDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.number = 0; + + /** + * EnumValueDescriptorProto options. + * @member {google.protobuf.IEnumValueOptions|null|undefined} options + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.options = null; + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance + */ + EnumValueDescriptorProto.create = function create(properties) { + return new EnumValueDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.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); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.number = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueDescriptorProto.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"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumValueOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + */ + EnumValueDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumValueDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.number = 0; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumValueDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumValueDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueDescriptorProto"; + }; + + return EnumValueDescriptorProto; + })(); + + protobuf.ServiceDescriptorProto = (function() { + + /** + * Properties of a ServiceDescriptorProto. + * @memberof google.protobuf + * @interface IServiceDescriptorProto + * @property {string|null} [name] ServiceDescriptorProto name + * @property {Array.|null} [method] ServiceDescriptorProto method + * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options + */ + + /** + * Constructs a new ServiceDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a ServiceDescriptorProto. + * @implements IServiceDescriptorProto + * @constructor + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + */ + function ServiceDescriptorProto(properties) { + this.method = []; + 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]]; + } + + /** + * ServiceDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.name = ""; + + /** + * ServiceDescriptorProto method. + * @member {Array.} method + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.method = $util.emptyArray; + + /** + * ServiceDescriptorProto options. + * @member {google.protobuf.IServiceOptions|null|undefined} options + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.options = null; + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance + */ + ServiceDescriptorProto.create = function create(properties) { + return new ServiceDescriptorProto(properties); + }; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.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); + if (message.method != null && message.method.length) + for (var i = 0; i < message.method.length; ++i) + $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceDescriptorProto message. + * @function verify + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceDescriptorProto.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"; + if (message.method != null && message.hasOwnProperty("method")) { + if (!Array.isArray(message.method)) + return "method: array expected"; + for (var i = 0; i < message.method.length; ++i) { + var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); + if (error) + return "method." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ServiceOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + */ + ServiceDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceDescriptorProto) + return object; + var message = new $root.google.protobuf.ServiceDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.method) { + if (!Array.isArray(object.method)) + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); + message.method = []; + for (var i = 0; i < object.method.length; ++i) { + if (typeof object.method[i] !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); + message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.method = []; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.method && message.method.length) { + object.method = []; + for (var j = 0; j < message.method.length; ++j) + object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + ServiceDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceDescriptorProto"; + }; + + return ServiceDescriptorProto; + })(); + + protobuf.MethodDescriptorProto = (function() { + + /** + * Properties of a MethodDescriptorProto. + * @memberof google.protobuf + * @interface IMethodDescriptorProto + * @property {string|null} [name] MethodDescriptorProto name + * @property {string|null} [inputType] MethodDescriptorProto inputType + * @property {string|null} [outputType] MethodDescriptorProto outputType + * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options + * @property {boolean|null} [clientStreaming] MethodDescriptorProto clientStreaming + * @property {boolean|null} [serverStreaming] MethodDescriptorProto serverStreaming + */ + + /** + * Constructs a new MethodDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a MethodDescriptorProto. + * @implements IMethodDescriptorProto + * @constructor + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + */ + function MethodDescriptorProto(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]]; + } + + /** + * MethodDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.name = ""; + + /** + * MethodDescriptorProto inputType. + * @member {string} inputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.inputType = ""; + + /** + * MethodDescriptorProto outputType. + * @member {string} outputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.outputType = ""; + + /** + * MethodDescriptorProto options. + * @member {google.protobuf.IMethodOptions|null|undefined} options + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.options = null; + + /** + * MethodDescriptorProto clientStreaming. + * @member {boolean} clientStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.clientStreaming = false; + + /** + * MethodDescriptorProto serverStreaming. + * @member {boolean} serverStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.serverStreaming = false; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance + */ + MethodDescriptorProto.create = function create(properties) { + return new MethodDescriptorProto(properties); + }; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.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); + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); + return writer; + }; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.inputType = reader.string(); + break; + } + case 3: { + message.outputType = reader.string(); + break; + } + case 4: { + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + break; + } + case 5: { + message.clientStreaming = reader.bool(); + break; + } + case 6: { + message.serverStreaming = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodDescriptorProto message. + * @function verify + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodDescriptorProto.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"; + if (message.inputType != null && message.hasOwnProperty("inputType")) + if (!$util.isString(message.inputType)) + return "inputType: string expected"; + if (message.outputType != null && message.hasOwnProperty("outputType")) + if (!$util.isString(message.outputType)) + return "outputType: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MethodOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + if (typeof message.clientStreaming !== "boolean") + return "clientStreaming: boolean expected"; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + if (typeof message.serverStreaming !== "boolean") + return "serverStreaming: boolean expected"; + return null; + }; + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + */ + MethodDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodDescriptorProto) + return object; + var message = new $root.google.protobuf.MethodDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.inputType != null) + message.inputType = String(object.inputType); + if (object.outputType != null) + message.outputType = String(object.outputType); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); + } + if (object.clientStreaming != null) + message.clientStreaming = Boolean(object.clientStreaming); + if (object.serverStreaming != null) + message.serverStreaming = Boolean(object.serverStreaming); + return message; + }; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputType = ""; + object.outputType = ""; + object.options = null; + object.clientStreaming = false; + object.serverStreaming = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.inputType != null && message.hasOwnProperty("inputType")) + object.inputType = message.inputType; + if (message.outputType != null && message.hasOwnProperty("outputType")) + object.outputType = message.outputType; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + object.clientStreaming = message.clientStreaming; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + object.serverStreaming = message.serverStreaming; + return object; + }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.MethodDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + MethodDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MethodDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodDescriptorProto"; + }; + + return MethodDescriptorProto; + })(); + + protobuf.FileOptions = (function() { + + /** + * Properties of a FileOptions. + * @memberof google.protobuf + * @interface IFileOptions + * @property {string|null} [javaPackage] FileOptions javaPackage + * @property {string|null} [javaOuterClassname] FileOptions javaOuterClassname + * @property {boolean|null} [javaMultipleFiles] FileOptions javaMultipleFiles + * @property {boolean|null} [javaGenerateEqualsAndHash] FileOptions javaGenerateEqualsAndHash + * @property {boolean|null} [javaStringCheckUtf8] FileOptions javaStringCheckUtf8 + * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimizeFor] FileOptions optimizeFor + * @property {string|null} [goPackage] FileOptions goPackage + * @property {boolean|null} [ccGenericServices] FileOptions ccGenericServices + * @property {boolean|null} [javaGenericServices] FileOptions javaGenericServices + * @property {boolean|null} [pyGenericServices] FileOptions pyGenericServices + * @property {boolean|null} [deprecated] FileOptions deprecated + * @property {boolean|null} [ccEnableArenas] FileOptions ccEnableArenas + * @property {string|null} [objcClassPrefix] FileOptions objcClassPrefix + * @property {string|null} [csharpNamespace] FileOptions csharpNamespace + * @property {string|null} [swiftPrefix] FileOptions swiftPrefix + * @property {string|null} [phpClassPrefix] FileOptions phpClassPrefix + * @property {string|null} [phpNamespace] FileOptions phpNamespace + * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace + * @property {string|null} [rubyPackage] FileOptions rubyPackage + * @property {google.protobuf.IFeatureSet|null} [features] FileOptions features + * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption + * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition + */ + + /** + * Constructs a new FileOptions. + * @memberof google.protobuf + * @classdesc Represents a FileOptions. + * @implements IFileOptions + * @constructor + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + */ + function FileOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.resourceDefinition"] = []; + 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]]; + } + + /** + * FileOptions javaPackage. + * @member {string} javaPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaPackage = ""; + + /** + * FileOptions javaOuterClassname. + * @member {string} javaOuterClassname + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaOuterClassname = ""; + + /** + * FileOptions javaMultipleFiles. + * @member {boolean} javaMultipleFiles + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaMultipleFiles = false; + + /** + * FileOptions javaGenerateEqualsAndHash. + * @member {boolean} javaGenerateEqualsAndHash + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenerateEqualsAndHash = false; + + /** + * FileOptions javaStringCheckUtf8. + * @member {boolean} javaStringCheckUtf8 + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaStringCheckUtf8 = false; + + /** + * FileOptions optimizeFor. + * @member {google.protobuf.FileOptions.OptimizeMode} optimizeFor + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.optimizeFor = 1; + + /** + * FileOptions goPackage. + * @member {string} goPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.goPackage = ""; + + /** + * FileOptions ccGenericServices. + * @member {boolean} ccGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccGenericServices = false; + + /** + * FileOptions javaGenericServices. + * @member {boolean} javaGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenericServices = false; + + /** + * FileOptions pyGenericServices. + * @member {boolean} pyGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.pyGenericServices = false; + + /** + * FileOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.deprecated = false; + + /** + * FileOptions ccEnableArenas. + * @member {boolean} ccEnableArenas + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccEnableArenas = true; + + /** + * FileOptions objcClassPrefix. + * @member {string} objcClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.objcClassPrefix = ""; + + /** + * FileOptions csharpNamespace. + * @member {string} csharpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.csharpNamespace = ""; + + /** + * FileOptions swiftPrefix. + * @member {string} swiftPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.swiftPrefix = ""; + + /** + * FileOptions phpClassPrefix. + * @member {string} phpClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpClassPrefix = ""; + + /** + * FileOptions phpNamespace. + * @member {string} phpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpNamespace = ""; + + /** + * FileOptions phpMetadataNamespace. + * @member {string} phpMetadataNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpMetadataNamespace = ""; + + /** + * FileOptions rubyPackage. + * @member {string} rubyPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.rubyPackage = ""; + + /** + * FileOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.features = null; + + /** + * FileOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FileOptions .google.api.resourceDefinition. + * @member {Array.} .google.api.resourceDefinition + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; + + /** + * Creates a new FileOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + * @returns {google.protobuf.FileOptions} FileOptions instance + */ + FileOptions.create = function create(properties) { + return new FileOptions(properties); + }; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) + writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) + writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) + writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) + writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) + writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) + writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); + if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) + writer.uint32(/* id 45, wireType 2 =*/362).string(message.rubyPackage); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.javaPackage = reader.string(); + break; + } + case 8: { + message.javaOuterClassname = reader.string(); + break; + } + case 10: { + message.javaMultipleFiles = reader.bool(); + break; + } + case 20: { + message.javaGenerateEqualsAndHash = reader.bool(); + break; + } + case 27: { + message.javaStringCheckUtf8 = reader.bool(); + break; + } + case 9: { + message.optimizeFor = reader.int32(); + break; + } + case 11: { + message.goPackage = reader.string(); + break; + } + case 16: { + message.ccGenericServices = reader.bool(); + break; + } + case 17: { + message.javaGenericServices = reader.bool(); + break; + } + case 18: { + message.pyGenericServices = reader.bool(); + break; + } + case 23: { + message.deprecated = reader.bool(); + break; + } + case 31: { + message.ccEnableArenas = reader.bool(); + break; + } + case 36: { + message.objcClassPrefix = reader.string(); + break; + } + case 37: { + message.csharpNamespace = reader.string(); + break; + } + case 39: { + message.swiftPrefix = reader.string(); + break; + } + case 40: { + message.phpClassPrefix = reader.string(); + break; + } + case 41: { + message.phpNamespace = reader.string(); + break; + } + case 44: { + message.phpMetadataNamespace = reader.string(); + break; + } + case 45: { + message.rubyPackage = reader.string(); + break; + } + case 50: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileOptions message. + * @function verify + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + if (!$util.isString(message.javaPackage)) + return "javaPackage: string expected"; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + if (!$util.isString(message.javaOuterClassname)) + return "javaOuterClassname: string expected"; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + if (typeof message.javaMultipleFiles !== "boolean") + return "javaMultipleFiles: boolean expected"; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + if (typeof message.javaGenerateEqualsAndHash !== "boolean") + return "javaGenerateEqualsAndHash: boolean expected"; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + if (typeof message.javaStringCheckUtf8 !== "boolean") + return "javaStringCheckUtf8: boolean expected"; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + switch (message.optimizeFor) { + default: + return "optimizeFor: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + if (!$util.isString(message.goPackage)) + return "goPackage: string expected"; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + if (typeof message.ccGenericServices !== "boolean") + return "ccGenericServices: boolean expected"; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + if (typeof message.javaGenericServices !== "boolean") + return "javaGenericServices: boolean expected"; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + if (typeof message.pyGenericServices !== "boolean") + return "pyGenericServices: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + if (typeof message.ccEnableArenas !== "boolean") + return "ccEnableArenas: boolean expected"; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + if (!$util.isString(message.objcClassPrefix)) + return "objcClassPrefix: string expected"; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + if (!$util.isString(message.csharpNamespace)) + return "csharpNamespace: string expected"; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + if (!$util.isString(message.swiftPrefix)) + return "swiftPrefix: string expected"; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + if (!$util.isString(message.phpClassPrefix)) + return "phpClassPrefix: string expected"; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + if (!$util.isString(message.phpNamespace)) + return "phpNamespace: string expected"; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + if (!$util.isString(message.phpMetadataNamespace)) + return "phpMetadataNamespace: string expected"; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + if (!$util.isString(message.rubyPackage)) + return "rubyPackage: string expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { + if (!Array.isArray(message[".google.api.resourceDefinition"])) + return ".google.api.resourceDefinition: array expected"; + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); + if (error) + return ".google.api.resourceDefinition." + error; + } + } + return null; + }; + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileOptions} FileOptions + */ + FileOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileOptions) + return object; + var message = new $root.google.protobuf.FileOptions(); + if (object.javaPackage != null) + message.javaPackage = String(object.javaPackage); + if (object.javaOuterClassname != null) + message.javaOuterClassname = String(object.javaOuterClassname); + if (object.javaMultipleFiles != null) + message.javaMultipleFiles = Boolean(object.javaMultipleFiles); + if (object.javaGenerateEqualsAndHash != null) + message.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); + if (object.javaStringCheckUtf8 != null) + message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); + switch (object.optimizeFor) { + default: + if (typeof object.optimizeFor === "number") { + message.optimizeFor = object.optimizeFor; + break; + } + break; + case "SPEED": + case 1: + message.optimizeFor = 1; + break; + case "CODE_SIZE": + case 2: + message.optimizeFor = 2; + break; + case "LITE_RUNTIME": + case 3: + message.optimizeFor = 3; + break; + } + if (object.goPackage != null) + message.goPackage = String(object.goPackage); + if (object.ccGenericServices != null) + message.ccGenericServices = Boolean(object.ccGenericServices); + if (object.javaGenericServices != null) + message.javaGenericServices = Boolean(object.javaGenericServices); + if (object.pyGenericServices != null) + message.pyGenericServices = Boolean(object.pyGenericServices); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.ccEnableArenas != null) + message.ccEnableArenas = Boolean(object.ccEnableArenas); + if (object.objcClassPrefix != null) + message.objcClassPrefix = String(object.objcClassPrefix); + if (object.csharpNamespace != null) + message.csharpNamespace = String(object.csharpNamespace); + if (object.swiftPrefix != null) + message.swiftPrefix = String(object.swiftPrefix); + if (object.phpClassPrefix != null) + message.phpClassPrefix = String(object.phpClassPrefix); + if (object.phpNamespace != null) + message.phpNamespace = String(object.phpNamespace); + if (object.phpMetadataNamespace != null) + message.phpMetadataNamespace = String(object.phpMetadataNamespace); + if (object.rubyPackage != null) + message.rubyPackage = String(object.rubyPackage); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.FileOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resourceDefinition"]) { + if (!Array.isArray(object[".google.api.resourceDefinition"])) + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); + message[".google.api.resourceDefinition"] = []; + for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { + if (typeof object[".google.api.resourceDefinition"][i] !== "object") + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); + message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.FileOptions} message FileOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.resourceDefinition"] = []; + } + if (options.defaults) { + object.javaPackage = ""; + object.javaOuterClassname = ""; + object.optimizeFor = options.enums === String ? "SPEED" : 1; + object.javaMultipleFiles = false; + object.goPackage = ""; + object.ccGenericServices = false; + object.javaGenericServices = false; + object.pyGenericServices = false; + object.javaGenerateEqualsAndHash = false; + object.deprecated = false; + object.javaStringCheckUtf8 = false; + object.ccEnableArenas = true; + object.objcClassPrefix = ""; + object.csharpNamespace = ""; + object.swiftPrefix = ""; + object.phpClassPrefix = ""; + object.phpNamespace = ""; + object.phpMetadataNamespace = ""; + object.rubyPackage = ""; + object.features = null; + } + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + object.javaPackage = message.javaPackage; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + object.javaOuterClassname = message.javaOuterClassname; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] === undefined ? message.optimizeFor : $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + object.javaMultipleFiles = message.javaMultipleFiles; + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + object.goPackage = message.goPackage; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + object.ccGenericServices = message.ccGenericServices; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + object.javaGenericServices = message.javaGenericServices; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + object.pyGenericServices = message.pyGenericServices; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + object.javaStringCheckUtf8 = message.javaStringCheckUtf8; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + object.ccEnableArenas = message.ccEnableArenas; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + object.objcClassPrefix = message.objcClassPrefix; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + object.csharpNamespace = message.csharpNamespace; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + object.swiftPrefix = message.swiftPrefix; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + object.phpClassPrefix = message.phpClassPrefix; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + object.phpNamespace = message.phpNamespace; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + object.phpMetadataNamespace = message.phpMetadataNamespace; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + object.rubyPackage = message.rubyPackage; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { + object[".google.api.resourceDefinition"] = []; + for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) + object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); + } + return object; + }; - /** - * Gets the default type url for Declaration - * @function getTypeUrl - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Declaration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions.Declaration"; - }; + /** + * Converts this FileOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FileOptions + * @instance + * @returns {Object.} JSON object + */ + FileOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return Declaration; - })(); + /** + * Gets the default type url for FileOptions + * @function getTypeUrl + * @memberof google.protobuf.FileOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileOptions"; + }; /** - * VerificationState enum. - * @name google.protobuf.ExtensionRangeOptions.VerificationState + * OptimizeMode enum. + * @name google.protobuf.FileOptions.OptimizeMode * @enum {number} - * @property {number} DECLARATION=0 DECLARATION value - * @property {number} UNVERIFIED=1 UNVERIFIED value + * @property {number} SPEED=1 SPEED value + * @property {number} CODE_SIZE=2 CODE_SIZE value + * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value */ - ExtensionRangeOptions.VerificationState = (function() { + FileOptions.OptimizeMode = (function() { var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DECLARATION"] = 0; - values[valuesById[1] = "UNVERIFIED"] = 1; + values[valuesById[1] = "SPEED"] = 1; + values[valuesById[2] = "CODE_SIZE"] = 2; + values[valuesById[3] = "LITE_RUNTIME"] = 3; return values; })(); - return ExtensionRangeOptions; + return FileOptions; })(); - protobuf.FieldDescriptorProto = (function() { + protobuf.MessageOptions = (function() { /** - * Properties of a FieldDescriptorProto. + * Properties of a MessageOptions. * @memberof google.protobuf - * @interface IFieldDescriptorProto - * @property {string|null} [name] FieldDescriptorProto name - * @property {number|null} [number] FieldDescriptorProto number - * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label - * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type - * @property {string|null} [typeName] FieldDescriptorProto typeName - * @property {string|null} [extendee] FieldDescriptorProto extendee - * @property {string|null} [defaultValue] FieldDescriptorProto defaultValue - * @property {number|null} [oneofIndex] FieldDescriptorProto oneofIndex - * @property {string|null} [jsonName] FieldDescriptorProto jsonName - * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options - * @property {boolean|null} [proto3Optional] FieldDescriptorProto proto3Optional + * @interface IMessageOptions + * @property {boolean|null} [messageSetWireFormat] MessageOptions messageSetWireFormat + * @property {boolean|null} [noStandardDescriptorAccessor] MessageOptions noStandardDescriptorAccessor + * @property {boolean|null} [deprecated] MessageOptions deprecated + * @property {boolean|null} [mapEntry] MessageOptions mapEntry + * @property {boolean|null} [deprecatedLegacyJsonFieldConflicts] MessageOptions deprecatedLegacyJsonFieldConflicts + * @property {google.protobuf.IFeatureSet|null} [features] MessageOptions features + * @property {Array.|null} [uninterpretedOption] MessageOptions uninterpretedOption + * @property {google.api.IResourceDescriptor|null} [".google.api.resource"] MessageOptions .google.api.resource */ /** - * Constructs a new FieldDescriptorProto. + * Constructs a new MessageOptions. * @memberof google.protobuf - * @classdesc Represents a FieldDescriptorProto. - * @implements IFieldDescriptorProto + * @classdesc Represents a MessageOptions. + * @implements IMessageOptions * @constructor - * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set */ - function FieldDescriptorProto(properties) { + function MessageOptions(properties) { + this.uninterpretedOption = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14473,217 +24607,178 @@ } /** - * FieldDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.name = ""; - - /** - * FieldDescriptorProto number. - * @member {number} number - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.number = 0; - - /** - * FieldDescriptorProto label. - * @member {google.protobuf.FieldDescriptorProto.Label} label - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.label = 1; - - /** - * FieldDescriptorProto type. - * @member {google.protobuf.FieldDescriptorProto.Type} type - * @memberof google.protobuf.FieldDescriptorProto + * MessageOptions messageSetWireFormat. + * @member {boolean} messageSetWireFormat + * @memberof google.protobuf.MessageOptions * @instance */ - FieldDescriptorProto.prototype.type = 1; + MessageOptions.prototype.messageSetWireFormat = false; /** - * FieldDescriptorProto typeName. - * @member {string} typeName - * @memberof google.protobuf.FieldDescriptorProto + * MessageOptions noStandardDescriptorAccessor. + * @member {boolean} noStandardDescriptorAccessor + * @memberof google.protobuf.MessageOptions * @instance */ - FieldDescriptorProto.prototype.typeName = ""; + MessageOptions.prototype.noStandardDescriptorAccessor = false; /** - * FieldDescriptorProto extendee. - * @member {string} extendee - * @memberof google.protobuf.FieldDescriptorProto + * MessageOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MessageOptions * @instance */ - FieldDescriptorProto.prototype.extendee = ""; + MessageOptions.prototype.deprecated = false; /** - * FieldDescriptorProto defaultValue. - * @member {string} defaultValue - * @memberof google.protobuf.FieldDescriptorProto + * MessageOptions mapEntry. + * @member {boolean} mapEntry + * @memberof google.protobuf.MessageOptions * @instance */ - FieldDescriptorProto.prototype.defaultValue = ""; + MessageOptions.prototype.mapEntry = false; /** - * FieldDescriptorProto oneofIndex. - * @member {number} oneofIndex - * @memberof google.protobuf.FieldDescriptorProto + * MessageOptions deprecatedLegacyJsonFieldConflicts. + * @member {boolean} deprecatedLegacyJsonFieldConflicts + * @memberof google.protobuf.MessageOptions * @instance */ - FieldDescriptorProto.prototype.oneofIndex = 0; + MessageOptions.prototype.deprecatedLegacyJsonFieldConflicts = false; /** - * FieldDescriptorProto jsonName. - * @member {string} jsonName - * @memberof google.protobuf.FieldDescriptorProto + * MessageOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.MessageOptions * @instance */ - FieldDescriptorProto.prototype.jsonName = ""; + MessageOptions.prototype.features = null; /** - * FieldDescriptorProto options. - * @member {google.protobuf.IFieldOptions|null|undefined} options - * @memberof google.protobuf.FieldDescriptorProto + * MessageOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MessageOptions * @instance */ - FieldDescriptorProto.prototype.options = null; + MessageOptions.prototype.uninterpretedOption = $util.emptyArray; /** - * FieldDescriptorProto proto3Optional. - * @member {boolean} proto3Optional - * @memberof google.protobuf.FieldDescriptorProto + * MessageOptions .google.api.resource. + * @member {google.api.IResourceDescriptor|null|undefined} .google.api.resource + * @memberof google.protobuf.MessageOptions * @instance */ - FieldDescriptorProto.prototype.proto3Optional = false; + MessageOptions.prototype[".google.api.resource"] = null; /** - * Creates a new FieldDescriptorProto instance using the specified properties. + * Creates a new MessageOptions instance using the specified properties. * @function create - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance - */ - FieldDescriptorProto.create = function create(properties) { - return new FieldDescriptorProto(properties); - }; - - /** - * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.MessageOptions * @static - * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + * @returns {google.protobuf.MessageOptions} MessageOptions instance */ - FieldDescriptorProto.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); - if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); - if (message.number != null && Object.hasOwnProperty.call(message, "number")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); - if (message.label != null && Object.hasOwnProperty.call(message, "label")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); - if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); - if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); - if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); - if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) - writer.uint32(/* id 17, wireType 0 =*/136).bool(message.proto3Optional); + MessageOptions.create = function create(properties) { + return new MessageOptions(properties); + }; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.mapEntry); + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.deprecatedLegacyJsonFieldConflicts); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); return writer; }; /** - * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.MessageOptions * @static - * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * Decodes a MessageOptions message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.MessageOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @returns {google.protobuf.MessageOptions} MessageOptions * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FieldDescriptorProto.decode = function decode(reader, length, error) { + MessageOptions.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - message.name = reader.string(); - break; - } - case 3: { - message.number = reader.int32(); - break; - } - case 4: { - message.label = reader.int32(); - break; - } - case 5: { - message.type = reader.int32(); + message.messageSetWireFormat = reader.bool(); break; } - case 6: { - message.typeName = reader.string(); + case 2: { + message.noStandardDescriptorAccessor = reader.bool(); break; } - case 2: { - message.extendee = reader.string(); + case 3: { + message.deprecated = reader.bool(); break; } case 7: { - message.defaultValue = reader.string(); + message.mapEntry = reader.bool(); break; } - case 9: { - message.oneofIndex = reader.int32(); + case 11: { + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); break; } - case 10: { - message.jsonName = reader.string(); + case 12: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } - case 8: { - message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); break; } - case 17: { - message.proto3Optional = reader.bool(); + case 1053: { + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); break; } default: @@ -14695,988 +24790,1420 @@ }; /** - * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.MessageOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @returns {google.protobuf.MessageOptions} MessageOptions * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + MessageOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FieldDescriptorProto message. + * Verifies a MessageOptions message. * @function verify - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.MessageOptions * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FieldDescriptorProto.verify = function verify(message) { + MessageOptions.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"; - if (message.number != null && message.hasOwnProperty("number")) - if (!$util.isInteger(message.number)) - return "number: integer expected"; - if (message.label != null && message.hasOwnProperty("label")) - switch (message.label) { - default: - return "label: enum value expected"; - case 1: - case 3: - case 2: - break; - } - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - break; + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + if (typeof message.messageSetWireFormat !== "boolean") + return "messageSetWireFormat: boolean expected"; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + if (typeof message.noStandardDescriptorAccessor !== "boolean") + return "noStandardDescriptorAccessor: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + if (typeof message.mapEntry !== "boolean") + return "mapEntry: boolean expected"; + if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") + return "deprecatedLegacyJsonFieldConflicts: boolean expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; } - if (message.typeName != null && message.hasOwnProperty("typeName")) - if (!$util.isString(message.typeName)) - return "typeName: string expected"; - if (message.extendee != null && message.hasOwnProperty("extendee")) - if (!$util.isString(message.extendee)) - return "extendee: string expected"; - if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) - if (!$util.isString(message.defaultValue)) - return "defaultValue: string expected"; - if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) - if (!$util.isInteger(message.oneofIndex)) - return "oneofIndex: integer expected"; - if (message.jsonName != null && message.hasOwnProperty("jsonName")) - if (!$util.isString(message.jsonName)) - return "jsonName: string expected"; - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.FieldOptions.verify(message.options); + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); if (error) - return "options." + error; + return ".google.api.resource." + error; } - if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) - if (typeof message.proto3Optional !== "boolean") - return "proto3Optional: boolean expected"; return null; }; /** - * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.MessageOptions * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @returns {google.protobuf.MessageOptions} MessageOptions */ - FieldDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldDescriptorProto) + MessageOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MessageOptions) return object; - var message = new $root.google.protobuf.FieldDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.number != null) - message.number = object.number | 0; - switch (object.label) { - default: - if (typeof object.label === "number") { - message.label = object.label; - break; - } - break; - case "LABEL_OPTIONAL": - case 1: - message.label = 1; - break; - case "LABEL_REPEATED": - case 3: - message.label = 3; - break; - case "LABEL_REQUIRED": - case 2: - message.label = 2; - break; + var message = new $root.google.protobuf.MessageOptions(); + if (object.messageSetWireFormat != null) + message.messageSetWireFormat = Boolean(object.messageSetWireFormat); + if (object.noStandardDescriptorAccessor != null) + message.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.mapEntry != null) + message.mapEntry = Boolean(object.mapEntry); + if (object.deprecatedLegacyJsonFieldConflicts != null) + message.deprecatedLegacyJsonFieldConflicts = Boolean(object.deprecatedLegacyJsonFieldConflicts); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.MessageOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); } - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); } - break; - case "TYPE_DOUBLE": - case 1: - message.type = 1; - break; - case "TYPE_FLOAT": - case 2: - message.type = 2; - break; - case "TYPE_INT64": - case 3: - message.type = 3; - break; - case "TYPE_UINT64": - case 4: - message.type = 4; - break; - case "TYPE_INT32": - case 5: - message.type = 5; - break; - case "TYPE_FIXED64": - case 6: - message.type = 6; - break; - case "TYPE_FIXED32": - case 7: - message.type = 7; - break; - case "TYPE_BOOL": - case 8: - message.type = 8; - break; - case "TYPE_STRING": - case 9: - message.type = 9; - break; - case "TYPE_GROUP": - case 10: - message.type = 10; - break; - case "TYPE_MESSAGE": - case 11: - message.type = 11; - break; - case "TYPE_BYTES": - case 12: - message.type = 12; - break; - case "TYPE_UINT32": - case 13: - message.type = 13; - break; - case "TYPE_ENUM": - case 14: - message.type = 14; - break; - case "TYPE_SFIXED32": - case 15: - message.type = 15; - break; - case "TYPE_SFIXED64": - case 16: - message.type = 16; - break; - case "TYPE_SINT32": - case 17: - message.type = 17; - break; - case "TYPE_SINT64": - case 18: - message.type = 18; - break; } - if (object.typeName != null) - message.typeName = String(object.typeName); - if (object.extendee != null) - message.extendee = String(object.extendee); - if (object.defaultValue != null) - message.defaultValue = String(object.defaultValue); - if (object.oneofIndex != null) - message.oneofIndex = object.oneofIndex | 0; - if (object.jsonName != null) - message.jsonName = String(object.jsonName); - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); + if (object[".google.api.resource"] != null) { + if (typeof object[".google.api.resource"] !== "object") + throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); } - if (object.proto3Optional != null) - message.proto3Optional = Boolean(object.proto3Optional); return message; }; /** - * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldDescriptorProto + * @memberof google.protobuf.MessageOptions * @static - * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto + * @param {google.protobuf.MessageOptions} message MessageOptions * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FieldDescriptorProto.toObject = function toObject(message, options) { + MessageOptions.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; if (options.defaults) { - object.name = ""; - object.extendee = ""; - object.number = 0; - object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; - object.type = options.enums === String ? "TYPE_DOUBLE" : 1; - object.typeName = ""; - object.defaultValue = ""; - object.options = null; - object.oneofIndex = 0; - object.jsonName = ""; - object.proto3Optional = false; + object.messageSetWireFormat = false; + object.noStandardDescriptorAccessor = false; + object.deprecated = false; + object.mapEntry = false; + object.deprecatedLegacyJsonFieldConflicts = false; + object.features = null; + object[".google.api.resource"] = null; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.extendee != null && message.hasOwnProperty("extendee")) - object.extendee = message.extendee; - if (message.number != null && message.hasOwnProperty("number")) - object.number = message.number; - if (message.label != null && message.hasOwnProperty("label")) - object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] === undefined ? message.label : $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] === undefined ? message.type : $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; - if (message.typeName != null && message.hasOwnProperty("typeName")) - object.typeName = message.typeName; - if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) - object.defaultValue = message.defaultValue; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); - if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) - object.oneofIndex = message.oneofIndex; - if (message.jsonName != null && message.hasOwnProperty("jsonName")) - object.jsonName = message.jsonName; - if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) - object.proto3Optional = message.proto3Optional; + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + object.messageSetWireFormat = message.messageSetWireFormat; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + object.mapEntry = message.mapEntry; + if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + object.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) + object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); return object; }; /** - * Converts this FieldDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.FieldDescriptorProto + * Converts this MessageOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MessageOptions + * @instance + * @returns {Object.} JSON object + */ + MessageOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MessageOptions + * @function getTypeUrl + * @memberof google.protobuf.MessageOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MessageOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MessageOptions"; + }; + + return MessageOptions; + })(); + + protobuf.FieldOptions = (function() { + + /** + * Properties of a FieldOptions. + * @memberof google.protobuf + * @interface IFieldOptions + * @property {google.protobuf.FieldOptions.CType|null} [ctype] FieldOptions ctype + * @property {boolean|null} [packed] FieldOptions packed + * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype + * @property {boolean|null} [lazy] FieldOptions lazy + * @property {boolean|null} [unverifiedLazy] FieldOptions unverifiedLazy + * @property {boolean|null} [deprecated] FieldOptions deprecated + * @property {boolean|null} [weak] FieldOptions weak + * @property {boolean|null} [debugRedact] FieldOptions debugRedact + * @property {google.protobuf.FieldOptions.OptionRetention|null} [retention] FieldOptions retention + * @property {Array.|null} [targets] FieldOptions targets + * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults + * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] FieldOptions featureSupport + * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption + * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior + * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference + */ + + /** + * Constructs a new FieldOptions. + * @memberof google.protobuf + * @classdesc Represents a FieldOptions. + * @implements IFieldOptions + * @constructor + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + */ + function FieldOptions(properties) { + this.targets = []; + this.editionDefaults = []; + this.uninterpretedOption = []; + this[".google.api.fieldBehavior"] = []; + 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]]; + } + + /** + * FieldOptions ctype. + * @member {google.protobuf.FieldOptions.CType} ctype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.ctype = 0; + + /** + * FieldOptions packed. + * @member {boolean} packed + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.packed = false; + + /** + * FieldOptions jstype. + * @member {google.protobuf.FieldOptions.JSType} jstype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.jstype = 0; + + /** + * FieldOptions lazy. + * @member {boolean} lazy + * @memberof google.protobuf.FieldOptions * @instance - * @returns {Object.} JSON object */ - FieldDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + FieldOptions.prototype.lazy = false; /** - * Gets the default type url for FieldDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url + * FieldOptions unverifiedLazy. + * @member {boolean} unverifiedLazy + * @memberof google.protobuf.FieldOptions + * @instance */ - FieldDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FieldDescriptorProto"; - }; + FieldOptions.prototype.unverifiedLazy = false; /** - * Type enum. - * @name google.protobuf.FieldDescriptorProto.Type - * @enum {number} - * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value - * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value - * @property {number} TYPE_INT64=3 TYPE_INT64 value - * @property {number} TYPE_UINT64=4 TYPE_UINT64 value - * @property {number} TYPE_INT32=5 TYPE_INT32 value - * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value - * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value - * @property {number} TYPE_BOOL=8 TYPE_BOOL value - * @property {number} TYPE_STRING=9 TYPE_STRING value - * @property {number} TYPE_GROUP=10 TYPE_GROUP value - * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value - * @property {number} TYPE_BYTES=12 TYPE_BYTES value - * @property {number} TYPE_UINT32=13 TYPE_UINT32 value - * @property {number} TYPE_ENUM=14 TYPE_ENUM value - * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value - * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value - * @property {number} TYPE_SINT32=17 TYPE_SINT32 value - * @property {number} TYPE_SINT64=18 TYPE_SINT64 value + * FieldOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FieldOptions + * @instance */ - FieldDescriptorProto.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[1] = "TYPE_DOUBLE"] = 1; - values[valuesById[2] = "TYPE_FLOAT"] = 2; - values[valuesById[3] = "TYPE_INT64"] = 3; - values[valuesById[4] = "TYPE_UINT64"] = 4; - values[valuesById[5] = "TYPE_INT32"] = 5; - values[valuesById[6] = "TYPE_FIXED64"] = 6; - values[valuesById[7] = "TYPE_FIXED32"] = 7; - values[valuesById[8] = "TYPE_BOOL"] = 8; - values[valuesById[9] = "TYPE_STRING"] = 9; - values[valuesById[10] = "TYPE_GROUP"] = 10; - values[valuesById[11] = "TYPE_MESSAGE"] = 11; - values[valuesById[12] = "TYPE_BYTES"] = 12; - values[valuesById[13] = "TYPE_UINT32"] = 13; - values[valuesById[14] = "TYPE_ENUM"] = 14; - values[valuesById[15] = "TYPE_SFIXED32"] = 15; - values[valuesById[16] = "TYPE_SFIXED64"] = 16; - values[valuesById[17] = "TYPE_SINT32"] = 17; - values[valuesById[18] = "TYPE_SINT64"] = 18; - return values; - })(); + FieldOptions.prototype.deprecated = false; /** - * Label enum. - * @name google.protobuf.FieldDescriptorProto.Label - * @enum {number} - * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value - * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value - * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value + * FieldOptions weak. + * @member {boolean} weak + * @memberof google.protobuf.FieldOptions + * @instance */ - FieldDescriptorProto.Label = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[1] = "LABEL_OPTIONAL"] = 1; - values[valuesById[3] = "LABEL_REPEATED"] = 3; - values[valuesById[2] = "LABEL_REQUIRED"] = 2; - return values; - })(); + FieldOptions.prototype.weak = false; - return FieldDescriptorProto; - })(); + /** + * FieldOptions debugRedact. + * @member {boolean} debugRedact + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.debugRedact = false; - protobuf.OneofDescriptorProto = (function() { + /** + * FieldOptions retention. + * @member {google.protobuf.FieldOptions.OptionRetention} retention + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.retention = 0; /** - * Properties of an OneofDescriptorProto. - * @memberof google.protobuf - * @interface IOneofDescriptorProto - * @property {string|null} [name] OneofDescriptorProto name - * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options + * FieldOptions targets. + * @member {Array.} targets + * @memberof google.protobuf.FieldOptions + * @instance */ + FieldOptions.prototype.targets = $util.emptyArray; /** - * Constructs a new OneofDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents an OneofDescriptorProto. - * @implements IOneofDescriptorProto - * @constructor - * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + * FieldOptions editionDefaults. + * @member {Array.} editionDefaults + * @memberof google.protobuf.FieldOptions + * @instance */ - function OneofDescriptorProto(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]]; - } + FieldOptions.prototype.editionDefaults = $util.emptyArray; /** - * OneofDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.OneofDescriptorProto + * FieldOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.FieldOptions * @instance */ - OneofDescriptorProto.prototype.name = ""; + FieldOptions.prototype.features = null; /** - * OneofDescriptorProto options. - * @member {google.protobuf.IOneofOptions|null|undefined} options - * @memberof google.protobuf.OneofDescriptorProto + * FieldOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.FieldOptions * @instance */ - OneofDescriptorProto.prototype.options = null; + FieldOptions.prototype.featureSupport = null; /** - * Creates a new OneofDescriptorProto instance using the specified properties. + * FieldOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FieldOptions .google.api.fieldBehavior. + * @member {Array.} .google.api.fieldBehavior + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; + + /** + * FieldOptions .google.api.resourceReference. + * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.resourceReference"] = null; + + /** + * Creates a new FieldOptions instance using the specified properties. * @function create - * @memberof google.protobuf.OneofDescriptorProto + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions} FieldOptions instance + */ + FieldOptions.create = function create(properties) { + return new FieldOptions(properties); + }; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) + writer.uint32(/* id 15, wireType 0 =*/120).bool(message.unverifiedLazy); + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.debugRedact); + if (message.retention != null && Object.hasOwnProperty.call(message, "retention")) + writer.uint32(/* id 17, wireType 0 =*/136).int32(message.retention); + if (message.targets != null && message.targets.length) + for (var i = 0; i < message.targets.length; ++i) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.targets[i]); + if (message.editionDefaults != null && message.editionDefaults.length) + for (var i = 0; i < message.editionDefaults.length; ++i) + $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + writer.uint32(/* id 1052, wireType 0 =*/8416).int32(message[".google.api.fieldBehavior"][i]); + if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) + $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions * @static - * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OneofDescriptorProto.create = function create(properties) { - return new OneofDescriptorProto(properties); + FieldOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.ctype = reader.int32(); + break; + } + case 2: { + message.packed = reader.bool(); + break; + } + case 6: { + message.jstype = reader.int32(); + break; + } + case 5: { + message.lazy = reader.bool(); + break; + } + case 15: { + message.unverifiedLazy = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 10: { + message.weak = reader.bool(); + break; + } + case 16: { + message.debugRedact = reader.bool(); + break; + } + case 17: { + message.retention = reader.int32(); + break; + } + case 19: { + if (!(message.targets && message.targets.length)) + message.targets = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.targets.push(reader.int32()); + } else + message.targets.push(reader.int32()); + break; + } + case 20: { + if (!(message.editionDefaults && message.editionDefaults.length)) + message.editionDefaults = []; + message.editionDefaults.push($root.google.protobuf.FieldOptions.EditionDefault.decode(reader, reader.uint32())); + break; + } + case 21: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 22: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1052: { + if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) + message[".google.api.fieldBehavior"] = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message[".google.api.fieldBehavior"].push(reader.int32()); + } else + message[".google.api.fieldBehavior"].push(reader.int32()); + break; + } + case 1055: { + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; }; /** - * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.OneofDescriptorProto + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions * @static - * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OneofDescriptorProto.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); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; + FieldOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); }; /** - * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.OneofDescriptorProto + * Verifies a FieldOptions message. + * @function verify + * @memberof google.protobuf.FieldOptions * @static - * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); + FieldOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ctype != null && message.hasOwnProperty("ctype")) + switch (message.ctype) { + default: + return "ctype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.packed != null && message.hasOwnProperty("packed")) + if (typeof message.packed !== "boolean") + return "packed: boolean expected"; + if (message.jstype != null && message.hasOwnProperty("jstype")) + switch (message.jstype) { + default: + return "jstype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.lazy != null && message.hasOwnProperty("lazy")) + if (typeof message.lazy !== "boolean") + return "lazy: boolean expected"; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + if (typeof message.unverifiedLazy !== "boolean") + return "unverifiedLazy: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.weak != null && message.hasOwnProperty("weak")) + if (typeof message.weak !== "boolean") + return "weak: boolean expected"; + if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + if (typeof message.debugRedact !== "boolean") + return "debugRedact: boolean expected"; + if (message.retention != null && message.hasOwnProperty("retention")) + switch (message.retention) { + default: + return "retention: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.targets != null && message.hasOwnProperty("targets")) { + if (!Array.isArray(message.targets)) + return "targets: array expected"; + for (var i = 0; i < message.targets.length; ++i) + switch (message.targets[i]) { + default: + return "targets: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + break; + } + } + if (message.editionDefaults != null && message.hasOwnProperty("editionDefaults")) { + if (!Array.isArray(message.editionDefaults)) + return "editionDefaults: array expected"; + for (var i = 0; i < message.editionDefaults.length; ++i) { + var error = $root.google.protobuf.FieldOptions.EditionDefault.verify(message.editionDefaults[i]); + if (error) + return "editionDefaults." + error; + } + } + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.fieldBehavior"] != null && message.hasOwnProperty(".google.api.fieldBehavior")) { + if (!Array.isArray(message[".google.api.fieldBehavior"])) + return ".google.api.fieldBehavior: array expected"; + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + switch (message[".google.api.fieldBehavior"][i]) { + default: + return ".google.api.fieldBehavior: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + break; + } + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { + var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); + if (error) + return ".google.api.resourceReference." + error; + } + return null; }; /** - * Decodes an OneofDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.OneofDescriptorProto + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions} FieldOptions */ - OneofDescriptorProto.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) + FieldOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions) + return object; + var message = new $root.google.protobuf.FieldOptions(); + switch (object.ctype) { + default: + if (typeof object.ctype === "number") { + message.ctype = object.ctype; break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); + } + break; + case "STRING": + case 0: + message.ctype = 0; + break; + case "CORD": + case 1: + message.ctype = 1; + break; + case "STRING_PIECE": + case 2: + message.ctype = 2; + break; + } + if (object.packed != null) + message.packed = Boolean(object.packed); + switch (object.jstype) { + default: + if (typeof object.jstype === "number") { + message.jstype = object.jstype; + break; + } + break; + case "JS_NORMAL": + case 0: + message.jstype = 0; + break; + case "JS_STRING": + case 1: + message.jstype = 1; + break; + case "JS_NUMBER": + case 2: + message.jstype = 2; + break; + } + if (object.lazy != null) + message.lazy = Boolean(object.lazy); + if (object.unverifiedLazy != null) + message.unverifiedLazy = Boolean(object.unverifiedLazy); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.weak != null) + message.weak = Boolean(object.weak); + if (object.debugRedact != null) + message.debugRedact = Boolean(object.debugRedact); + switch (object.retention) { + default: + if (typeof object.retention === "number") { + message.retention = object.retention; + break; + } + break; + case "RETENTION_UNKNOWN": + case 0: + message.retention = 0; + break; + case "RETENTION_RUNTIME": + case 1: + message.retention = 1; + break; + case "RETENTION_SOURCE": + case 2: + message.retention = 2; + break; + } + if (object.targets) { + if (!Array.isArray(object.targets)) + throw TypeError(".google.protobuf.FieldOptions.targets: array expected"); + message.targets = []; + for (var i = 0; i < object.targets.length; ++i) + switch (object.targets[i]) { + default: + if (typeof object.targets[i] === "number") { + message.targets[i] = object.targets[i]; + break; + } + case "TARGET_TYPE_UNKNOWN": + case 0: + message.targets[i] = 0; break; - } - case 2: { - message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + case "TARGET_TYPE_FILE": + case 1: + message.targets[i] = 1; + break; + case "TARGET_TYPE_EXTENSION_RANGE": + case 2: + message.targets[i] = 2; + break; + case "TARGET_TYPE_MESSAGE": + case 3: + message.targets[i] = 3; + break; + case "TARGET_TYPE_FIELD": + case 4: + message.targets[i] = 4; + break; + case "TARGET_TYPE_ONEOF": + case 5: + message.targets[i] = 5; + break; + case "TARGET_TYPE_ENUM": + case 6: + message.targets[i] = 6; + break; + case "TARGET_TYPE_ENUM_ENTRY": + case 7: + message.targets[i] = 7; + break; + case "TARGET_TYPE_SERVICE": + case 8: + message.targets[i] = 8; + break; + case "TARGET_TYPE_METHOD": + case 9: + message.targets[i] = 9; break; } - default: - reader.skipType(tag & 7); - break; + } + if (object.editionDefaults) { + if (!Array.isArray(object.editionDefaults)) + throw TypeError(".google.protobuf.FieldOptions.editionDefaults: array expected"); + message.editionDefaults = []; + for (var i = 0; i < object.editionDefaults.length; ++i) { + if (typeof object.editionDefaults[i] !== "object") + throw TypeError(".google.protobuf.FieldOptions.editionDefaults: object expected"); + message.editionDefaults[i] = $root.google.protobuf.FieldOptions.EditionDefault.fromObject(object.editionDefaults[i]); } } - return message; - }; - - /** - * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OneofDescriptorProto message. - * @function verify - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OneofDescriptorProto.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"; - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.OneofOptions.verify(message.options); - if (error) - return "options." + error; + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.FieldOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.fieldBehavior"]) { + if (!Array.isArray(object[".google.api.fieldBehavior"])) + throw TypeError(".google.protobuf.FieldOptions..google.api.fieldBehavior: array expected"); + message[".google.api.fieldBehavior"] = []; + for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) + switch (object[".google.api.fieldBehavior"][i]) { + default: + if (typeof object[".google.api.fieldBehavior"][i] === "number") { + message[".google.api.fieldBehavior"][i] = object[".google.api.fieldBehavior"][i]; + break; + } + case "FIELD_BEHAVIOR_UNSPECIFIED": + case 0: + message[".google.api.fieldBehavior"][i] = 0; + break; + case "OPTIONAL": + case 1: + message[".google.api.fieldBehavior"][i] = 1; + break; + case "REQUIRED": + case 2: + message[".google.api.fieldBehavior"][i] = 2; + break; + case "OUTPUT_ONLY": + case 3: + message[".google.api.fieldBehavior"][i] = 3; + break; + case "INPUT_ONLY": + case 4: + message[".google.api.fieldBehavior"][i] = 4; + break; + case "IMMUTABLE": + case 5: + message[".google.api.fieldBehavior"][i] = 5; + break; + case "UNORDERED_LIST": + case 6: + message[".google.api.fieldBehavior"][i] = 6; + break; + case "NON_EMPTY_DEFAULT": + case 7: + message[".google.api.fieldBehavior"][i] = 7; + break; + case "IDENTIFIER": + case 8: + message[".google.api.fieldBehavior"][i] = 8; + break; + } } - return null; - }; - - /** - * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto - */ - OneofDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.OneofDescriptorProto) - return object; - var message = new $root.google.protobuf.OneofDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); + if (object[".google.api.resourceReference"] != null) { + if (typeof object[".google.api.resourceReference"] !== "object") + throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); } return message; }; /** - * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.OneofDescriptorProto + * @memberof google.protobuf.FieldOptions * @static - * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto + * @param {google.protobuf.FieldOptions} message FieldOptions * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OneofDescriptorProto.toObject = function toObject(message, options) { + FieldOptions.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.targets = []; + object.editionDefaults = []; + object.uninterpretedOption = []; + object[".google.api.fieldBehavior"] = []; + } if (options.defaults) { - object.name = ""; - object.options = null; + object.ctype = options.enums === String ? "STRING" : 0; + object.packed = false; + object.deprecated = false; + object.lazy = false; + object.jstype = options.enums === String ? "JS_NORMAL" : 0; + object.weak = false; + object.unverifiedLazy = false; + object.debugRedact = false; + object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; + object.features = null; + object.featureSupport = null; + object[".google.api.resourceReference"] = null; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); + if (message.ctype != null && message.hasOwnProperty("ctype")) + object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; + if (message.packed != null && message.hasOwnProperty("packed")) + object.packed = message.packed; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.lazy != null && message.hasOwnProperty("lazy")) + object.lazy = message.lazy; + if (message.jstype != null && message.hasOwnProperty("jstype")) + object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] === undefined ? message.jstype : $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; + if (message.weak != null && message.hasOwnProperty("weak")) + object.weak = message.weak; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + object.unverifiedLazy = message.unverifiedLazy; + if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + object.debugRedact = message.debugRedact; + if (message.retention != null && message.hasOwnProperty("retention")) + object.retention = options.enums === String ? $root.google.protobuf.FieldOptions.OptionRetention[message.retention] === undefined ? message.retention : $root.google.protobuf.FieldOptions.OptionRetention[message.retention] : message.retention; + if (message.targets && message.targets.length) { + object.targets = []; + for (var j = 0; j < message.targets.length; ++j) + object.targets[j] = options.enums === String ? $root.google.protobuf.FieldOptions.OptionTargetType[message.targets[j]] === undefined ? message.targets[j] : $root.google.protobuf.FieldOptions.OptionTargetType[message.targets[j]] : message.targets[j]; + } + if (message.editionDefaults && message.editionDefaults.length) { + object.editionDefaults = []; + for (var j = 0; j < message.editionDefaults.length; ++j) + object.editionDefaults[j] = $root.google.protobuf.FieldOptions.EditionDefault.toObject(message.editionDefaults[j], options); + } + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { + object[".google.api.fieldBehavior"] = []; + for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) + object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] === undefined ? message[".google.api.fieldBehavior"][j] : $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) + object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); return object; }; /** - * Converts this OneofDescriptorProto to JSON. + * Converts this FieldOptions to JSON. * @function toJSON - * @memberof google.protobuf.OneofDescriptorProto + * @memberof google.protobuf.FieldOptions * @instance * @returns {Object.} JSON object */ - OneofDescriptorProto.prototype.toJSON = function toJSON() { + FieldOptions.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for OneofDescriptorProto + * Gets the default type url for FieldOptions * @function getTypeUrl - * @memberof google.protobuf.OneofDescriptorProto + * @memberof google.protobuf.FieldOptions * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - OneofDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FieldOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.OneofDescriptorProto"; + return typeUrlPrefix + "/google.protobuf.FieldOptions"; }; - return OneofDescriptorProto; - })(); - - protobuf.EnumDescriptorProto = (function() { - /** - * Properties of an EnumDescriptorProto. - * @memberof google.protobuf - * @interface IEnumDescriptorProto - * @property {string|null} [name] EnumDescriptorProto name - * @property {Array.|null} [value] EnumDescriptorProto value - * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options - * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange - * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + * CType enum. + * @name google.protobuf.FieldOptions.CType + * @enum {number} + * @property {number} STRING=0 STRING value + * @property {number} CORD=1 CORD value + * @property {number} STRING_PIECE=2 STRING_PIECE value */ + FieldOptions.CType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STRING"] = 0; + values[valuesById[1] = "CORD"] = 1; + values[valuesById[2] = "STRING_PIECE"] = 2; + return values; + })(); /** - * Constructs a new EnumDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents an EnumDescriptorProto. - * @implements IEnumDescriptorProto - * @constructor - * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + * JSType enum. + * @name google.protobuf.FieldOptions.JSType + * @enum {number} + * @property {number} JS_NORMAL=0 JS_NORMAL value + * @property {number} JS_STRING=1 JS_STRING value + * @property {number} JS_NUMBER=2 JS_NUMBER value */ - function EnumDescriptorProto(properties) { - this.value = []; - this.reservedRange = []; - this.reservedName = []; - 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]]; - } + FieldOptions.JSType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JS_NORMAL"] = 0; + values[valuesById[1] = "JS_STRING"] = 1; + values[valuesById[2] = "JS_NUMBER"] = 2; + return values; + })(); /** - * EnumDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.EnumDescriptorProto - * @instance + * OptionRetention enum. + * @name google.protobuf.FieldOptions.OptionRetention + * @enum {number} + * @property {number} RETENTION_UNKNOWN=0 RETENTION_UNKNOWN value + * @property {number} RETENTION_RUNTIME=1 RETENTION_RUNTIME value + * @property {number} RETENTION_SOURCE=2 RETENTION_SOURCE value */ - EnumDescriptorProto.prototype.name = ""; + FieldOptions.OptionRetention = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RETENTION_UNKNOWN"] = 0; + values[valuesById[1] = "RETENTION_RUNTIME"] = 1; + values[valuesById[2] = "RETENTION_SOURCE"] = 2; + return values; + })(); /** - * EnumDescriptorProto value. - * @member {Array.} value - * @memberof google.protobuf.EnumDescriptorProto - * @instance + * OptionTargetType enum. + * @name google.protobuf.FieldOptions.OptionTargetType + * @enum {number} + * @property {number} TARGET_TYPE_UNKNOWN=0 TARGET_TYPE_UNKNOWN value + * @property {number} TARGET_TYPE_FILE=1 TARGET_TYPE_FILE value + * @property {number} TARGET_TYPE_EXTENSION_RANGE=2 TARGET_TYPE_EXTENSION_RANGE value + * @property {number} TARGET_TYPE_MESSAGE=3 TARGET_TYPE_MESSAGE value + * @property {number} TARGET_TYPE_FIELD=4 TARGET_TYPE_FIELD value + * @property {number} TARGET_TYPE_ONEOF=5 TARGET_TYPE_ONEOF value + * @property {number} TARGET_TYPE_ENUM=6 TARGET_TYPE_ENUM value + * @property {number} TARGET_TYPE_ENUM_ENTRY=7 TARGET_TYPE_ENUM_ENTRY value + * @property {number} TARGET_TYPE_SERVICE=8 TARGET_TYPE_SERVICE value + * @property {number} TARGET_TYPE_METHOD=9 TARGET_TYPE_METHOD value */ - EnumDescriptorProto.prototype.value = $util.emptyArray; + FieldOptions.OptionTargetType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TARGET_TYPE_UNKNOWN"] = 0; + values[valuesById[1] = "TARGET_TYPE_FILE"] = 1; + values[valuesById[2] = "TARGET_TYPE_EXTENSION_RANGE"] = 2; + values[valuesById[3] = "TARGET_TYPE_MESSAGE"] = 3; + values[valuesById[4] = "TARGET_TYPE_FIELD"] = 4; + values[valuesById[5] = "TARGET_TYPE_ONEOF"] = 5; + values[valuesById[6] = "TARGET_TYPE_ENUM"] = 6; + values[valuesById[7] = "TARGET_TYPE_ENUM_ENTRY"] = 7; + values[valuesById[8] = "TARGET_TYPE_SERVICE"] = 8; + values[valuesById[9] = "TARGET_TYPE_METHOD"] = 9; + return values; + })(); - /** - * EnumDescriptorProto options. - * @member {google.protobuf.IEnumOptions|null|undefined} options - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.options = null; + FieldOptions.EditionDefault = (function() { + + /** + * Properties of an EditionDefault. + * @memberof google.protobuf.FieldOptions + * @interface IEditionDefault + * @property {google.protobuf.Edition|null} [edition] EditionDefault edition + * @property {string|null} [value] EditionDefault value + */ + + /** + * Constructs a new EditionDefault. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents an EditionDefault. + * @implements IEditionDefault + * @constructor + * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set + */ + function EditionDefault(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]]; + } - /** - * EnumDescriptorProto reservedRange. - * @member {Array.} reservedRange - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.reservedRange = $util.emptyArray; + /** + * EditionDefault edition. + * @member {google.protobuf.Edition} edition + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + */ + EditionDefault.prototype.edition = 0; - /** - * EnumDescriptorProto reservedName. - * @member {Array.} reservedName - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * EditionDefault value. + * @member {string} value + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + */ + EditionDefault.prototype.value = ""; - /** - * Creates a new EnumDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance - */ - EnumDescriptorProto.create = function create(properties) { - return new EnumDescriptorProto(properties); - }; + /** + * Creates a new EditionDefault instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault instance + */ + EditionDefault.create = function create(properties) { + return new EditionDefault(properties); + }; - /** - * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumDescriptorProto.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); - if (message.value != null && message.value.length) - for (var i = 0; i < message.value.length; ++i) - $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.reservedRange != null && message.reservedRange.length) - for (var i = 0; i < message.reservedRange.length; ++i) - $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.reservedName != null && message.reservedName.length) - for (var i = 0; i < message.reservedName.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); - return writer; - }; + /** + * Encodes the specified EditionDefault message. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EditionDefault.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + return writer; + }; - /** - * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified EditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EditionDefault.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes an EnumDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumDescriptorProto.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - if (!(message.value && message.value.length)) - message.value = []; - message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + /** + * Decodes an EditionDefault message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EditionDefault.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.EditionDefault(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) break; - } - case 3: { - message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + switch (tag >>> 3) { + case 3: { + message.edition = reader.int32(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); break; } - case 4: { - if (!(message.reservedRange && message.reservedRange.length)) - message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + } + return message; + }; + + /** + * Decodes an EditionDefault message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EditionDefault.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EditionDefault message. + * @function verify + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EditionDefault.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: break; } - case 5: { - if (!(message.reservedName && message.reservedName.length)) - message.reservedName = []; - message.reservedName.push(reader.string()); + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates an EditionDefault message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + */ + EditionDefault.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.EditionDefault) + return object; + var message = new $root.google.protobuf.FieldOptions.EditionDefault(); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; break; } - default: - reader.skipType(tag & 7); + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; break; } - } - return message; - }; - - /** - * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + if (object.value != null) + message.value = String(object.value); + return message; + }; - /** - * Verifies an EnumDescriptorProto message. - * @function verify - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumDescriptorProto.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"; - if (message.value != null && message.hasOwnProperty("value")) { - if (!Array.isArray(message.value)) - return "value: array expected"; - for (var i = 0; i < message.value.length; ++i) { - var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); - if (error) - return "value." + error; - } - } - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.EnumOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { - if (!Array.isArray(message.reservedRange)) - return "reservedRange: array expected"; - for (var i = 0; i < message.reservedRange.length; ++i) { - var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i]); - if (error) - return "reservedRange." + error; + /** + * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EditionDefault.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; } - } - if (message.reservedName != null && message.hasOwnProperty("reservedName")) { - if (!Array.isArray(message.reservedName)) - return "reservedName: array expected"; - for (var i = 0; i < message.reservedName.length; ++i) - if (!$util.isString(message.reservedName[i])) - return "reservedName: string[] expected"; - } - return null; - }; - - /** - * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto - */ - EnumDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumDescriptorProto) + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; return object; - var message = new $root.google.protobuf.EnumDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.value) { - if (!Array.isArray(object.value)) - throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); - message.value = []; - for (var i = 0; i < object.value.length; ++i) { - if (typeof object.value[i] !== "object") - throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); - message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); - } - if (object.reservedRange) { - if (!Array.isArray(object.reservedRange)) - throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: array expected"); - message.reservedRange = []; - for (var i = 0; i < object.reservedRange.length; ++i) { - if (typeof object.reservedRange[i] !== "object") - throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); - message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i]); - } - } - if (object.reservedName) { - if (!Array.isArray(object.reservedName)) - throw TypeError(".google.protobuf.EnumDescriptorProto.reservedName: array expected"); - message.reservedName = []; - for (var i = 0; i < object.reservedName.length; ++i) - message.reservedName[i] = String(object.reservedName[i]); - } - return message; - }; + }; - /** - * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.value = []; - object.reservedRange = []; - object.reservedName = []; - } - if (options.defaults) { - object.name = ""; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value && message.value.length) { - object.value = []; - for (var j = 0; j < message.value.length; ++j) - object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); - if (message.reservedRange && message.reservedRange.length) { - object.reservedRange = []; - for (var j = 0; j < message.reservedRange.length; ++j) - object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options); - } - if (message.reservedName && message.reservedName.length) { - object.reservedName = []; - for (var j = 0; j < message.reservedName.length; ++j) - object.reservedName[j] = message.reservedName[j]; - } - return object; - }; + /** + * Converts this EditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + * @returns {Object.} JSON object + */ + EditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this EnumDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.EnumDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - EnumDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Gets the default type url for EditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + }; - /** - * Gets the default type url for EnumDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EnumDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto"; - }; + return EditionDefault; + })(); - EnumDescriptorProto.EnumReservedRange = (function() { + FieldOptions.FeatureSupport = (function() { /** - * Properties of an EnumReservedRange. - * @memberof google.protobuf.EnumDescriptorProto - * @interface IEnumReservedRange - * @property {number|null} [start] EnumReservedRange start - * @property {number|null} [end] EnumReservedRange end + * Properties of a FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @interface IFeatureSupport + * @property {google.protobuf.Edition|null} [editionIntroduced] FeatureSupport editionIntroduced + * @property {google.protobuf.Edition|null} [editionDeprecated] FeatureSupport editionDeprecated + * @property {string|null} [deprecationWarning] FeatureSupport deprecationWarning + * @property {google.protobuf.Edition|null} [editionRemoved] FeatureSupport editionRemoved */ /** - * Constructs a new EnumReservedRange. - * @memberof google.protobuf.EnumDescriptorProto - * @classdesc Represents an EnumReservedRange. - * @implements IEnumReservedRange + * Constructs a new FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents a FeatureSupport. + * @implements IFeatureSupport * @constructor - * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set */ - function EnumReservedRange(properties) { + function FeatureSupport(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15684,91 +26211,119 @@ } /** - * EnumReservedRange start. - * @member {number} start - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * FeatureSupport editionIntroduced. + * @member {google.protobuf.Edition} editionIntroduced + * @memberof google.protobuf.FieldOptions.FeatureSupport * @instance */ - EnumReservedRange.prototype.start = 0; + FeatureSupport.prototype.editionIntroduced = 0; /** - * EnumReservedRange end. - * @member {number} end - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * FeatureSupport editionDeprecated. + * @member {google.protobuf.Edition} editionDeprecated + * @memberof google.protobuf.FieldOptions.FeatureSupport * @instance */ - EnumReservedRange.prototype.end = 0; + FeatureSupport.prototype.editionDeprecated = 0; /** - * Creates a new EnumReservedRange instance using the specified properties. + * FeatureSupport deprecationWarning. + * @member {string} deprecationWarning + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.deprecationWarning = ""; + + /** + * FeatureSupport editionRemoved. + * @member {google.protobuf.Edition} editionRemoved + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionRemoved = 0; + + /** + * Creates a new FeatureSupport instance using the specified properties. * @function create - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set - * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange instance + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport instance */ - EnumReservedRange.create = function create(properties) { - return new EnumReservedRange(properties); + FeatureSupport.create = function create(properties) { + return new FeatureSupport(properties); }; /** - * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. * @function encode - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumReservedRange.encode = function encode(message, writer) { + FeatureSupport.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.start != null && Object.hasOwnProperty.call(message, "start")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editionDeprecated); + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.deprecationWarning); + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.editionRemoved); return writer; }; /** - * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EnumReservedRange message from the specified reader or buffer. + * Decodes a FeatureSupport message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnumReservedRange.decode = function decode(reader, length, error) { + FeatureSupport.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - message.start = reader.int32(); + message.editionIntroduced = reader.int32(); break; } case 2: { - message.end = reader.int32(); + message.editionDeprecated = reader.int32(); + break; + } + case 3: { + message.deprecationWarning = reader.string(); + break; + } + case 4: { + message.editionRemoved = reader.int32(); break; } default: @@ -15780,136 +26335,617 @@ }; /** - * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnumReservedRange.decodeDelimited = function decodeDelimited(reader) { + FeatureSupport.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EnumReservedRange message. + * Verifies a FeatureSupport message. * @function verify - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EnumReservedRange.verify = function verify(message) { + FeatureSupport.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.start != null && message.hasOwnProperty("start")) - if (!$util.isInteger(message.start)) - return "start: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + switch (message.editionIntroduced) { + default: + return "editionIntroduced: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + switch (message.editionDeprecated) { + default: + return "editionDeprecated: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + if (!$util.isString(message.deprecationWarning)) + return "deprecationWarning: string expected"; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + switch (message.editionRemoved) { + default: + return "editionRemoved: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } return null; }; /** - * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {Object.} object Plain object - * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport */ - EnumReservedRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) + FeatureSupport.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) return object; - var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); - if (object.start != null) - message.start = object.start | 0; - if (object.end != null) - message.end = object.end | 0; + var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + switch (object.editionIntroduced) { + default: + if (typeof object.editionIntroduced === "number") { + message.editionIntroduced = object.editionIntroduced; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionIntroduced = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionIntroduced = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionIntroduced = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionIntroduced = 999; + break; + case "EDITION_2023": + case 1000: + message.editionIntroduced = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionIntroduced = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionIntroduced = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionIntroduced = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionIntroduced = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionIntroduced = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionIntroduced = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionIntroduced = 2147483647; + break; + } + switch (object.editionDeprecated) { + default: + if (typeof object.editionDeprecated === "number") { + message.editionDeprecated = object.editionDeprecated; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionDeprecated = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionDeprecated = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionDeprecated = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionDeprecated = 999; + break; + case "EDITION_2023": + case 1000: + message.editionDeprecated = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionDeprecated = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionDeprecated = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionDeprecated = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionDeprecated = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionDeprecated = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionDeprecated = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionDeprecated = 2147483647; + break; + } + if (object.deprecationWarning != null) + message.deprecationWarning = String(object.deprecationWarning); + switch (object.editionRemoved) { + default: + if (typeof object.editionRemoved === "number") { + message.editionRemoved = object.editionRemoved; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionRemoved = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionRemoved = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionRemoved = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionRemoved = 999; + break; + case "EDITION_2023": + case 1000: + message.editionRemoved = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionRemoved = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionRemoved = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionRemoved = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionRemoved = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionRemoved = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionRemoved = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionRemoved = 2147483647; + break; + } return message; }; /** - * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.EnumDescriptorProto.EnumReservedRange} message EnumReservedRange + * @param {google.protobuf.FieldOptions.FeatureSupport} message FeatureSupport * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EnumReservedRange.toObject = function toObject(message, options) { + FeatureSupport.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.start = 0; - object.end = 0; + object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionDeprecated = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.deprecationWarning = ""; + object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; } - if (message.start != null && message.hasOwnProperty("start")) - object.start = message.start; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + object.deprecationWarning = message.deprecationWarning; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; return object; }; /** - * Converts this EnumReservedRange to JSON. + * Converts this FeatureSupport to JSON. * @function toJSON - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @memberof google.protobuf.FieldOptions.FeatureSupport * @instance * @returns {Object.} JSON object */ - EnumReservedRange.prototype.toJSON = function toJSON() { + FeatureSupport.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for EnumReservedRange + * Gets the default type url for FeatureSupport * @function getTypeUrl - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - EnumReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FeatureSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto.EnumReservedRange"; + return typeUrlPrefix + "/google.protobuf.FieldOptions.FeatureSupport"; }; - return EnumReservedRange; - })(); + return FeatureSupport; + })(); + + return FieldOptions; + })(); + + protobuf.OneofOptions = (function() { + + /** + * Properties of an OneofOptions. + * @memberof google.protobuf + * @interface IOneofOptions + * @property {google.protobuf.IFeatureSet|null} [features] OneofOptions features + * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption + */ + + /** + * Constructs a new OneofOptions. + * @memberof google.protobuf + * @classdesc Represents an OneofOptions. + * @implements IOneofOptions + * @constructor + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + */ + function OneofOptions(properties) { + this.uninterpretedOption = []; + 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]]; + } + + /** + * OneofOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.features = null; + + /** + * OneofOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + * @returns {google.protobuf.OneofOptions} OneofOptions instance + */ + OneofOptions.create = function create(properties) { + return new OneofOptions(properties); + }; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofOptions message. + * @function verify + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofOptions} OneofOptions + */ + OneofOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofOptions) + return object; + var message = new $root.google.protobuf.OneofOptions(); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.OneofOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.OneofOptions} message OneofOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) + object.features = null; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this OneofOptions to JSON. + * @function toJSON + * @memberof google.protobuf.OneofOptions + * @instance + * @returns {Object.} JSON object + */ + OneofOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return EnumDescriptorProto; + /** + * Gets the default type url for OneofOptions + * @function getTypeUrl + * @memberof google.protobuf.OneofOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofOptions"; + }; + + return OneofOptions; })(); - protobuf.EnumValueDescriptorProto = (function() { + protobuf.EnumOptions = (function() { /** - * Properties of an EnumValueDescriptorProto. + * Properties of an EnumOptions. * @memberof google.protobuf - * @interface IEnumValueDescriptorProto - * @property {string|null} [name] EnumValueDescriptorProto name - * @property {number|null} [number] EnumValueDescriptorProto number - * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options + * @interface IEnumOptions + * @property {boolean|null} [allowAlias] EnumOptions allowAlias + * @property {boolean|null} [deprecated] EnumOptions deprecated + * @property {boolean|null} [deprecatedLegacyJsonFieldConflicts] EnumOptions deprecatedLegacyJsonFieldConflicts + * @property {google.protobuf.IFeatureSet|null} [features] EnumOptions features + * @property {Array.|null} [uninterpretedOption] EnumOptions uninterpretedOption */ /** - * Constructs a new EnumValueDescriptorProto. + * Constructs a new EnumOptions. * @memberof google.protobuf - * @classdesc Represents an EnumValueDescriptorProto. - * @implements IEnumValueDescriptorProto + * @classdesc Represents an EnumOptions. + * @implements IEnumOptions * @constructor - * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set */ - function EnumValueDescriptorProto(properties) { + function EnumOptions(properties) { + this.uninterpretedOption = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15917,105 +26953,136 @@ } /** - * EnumValueDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.EnumValueDescriptorProto + * EnumOptions allowAlias. + * @member {boolean} allowAlias + * @memberof google.protobuf.EnumOptions * @instance */ - EnumValueDescriptorProto.prototype.name = ""; + EnumOptions.prototype.allowAlias = false; /** - * EnumValueDescriptorProto number. - * @member {number} number - * @memberof google.protobuf.EnumValueDescriptorProto + * EnumOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumOptions * @instance */ - EnumValueDescriptorProto.prototype.number = 0; + EnumOptions.prototype.deprecated = false; /** - * EnumValueDescriptorProto options. - * @member {google.protobuf.IEnumValueOptions|null|undefined} options - * @memberof google.protobuf.EnumValueDescriptorProto + * EnumOptions deprecatedLegacyJsonFieldConflicts. + * @member {boolean} deprecatedLegacyJsonFieldConflicts + * @memberof google.protobuf.EnumOptions * @instance */ - EnumValueDescriptorProto.prototype.options = null; + EnumOptions.prototype.deprecatedLegacyJsonFieldConflicts = false; /** - * Creates a new EnumValueDescriptorProto instance using the specified properties. + * EnumOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.features = null; + + /** + * EnumOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumOptions instance using the specified properties. * @function create - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.EnumOptions * @static - * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumOptions} EnumOptions instance */ - EnumValueDescriptorProto.create = function create(properties) { - return new EnumValueDescriptorProto(properties); + EnumOptions.create = function create(properties) { + return new EnumOptions(properties); }; /** - * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. * @function encode - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.EnumOptions * @static - * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumValueDescriptorProto.encode = function encode(message, writer) { + EnumOptions.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); - if (message.number != null && Object.hasOwnProperty.call(message, "number")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.deprecatedLegacyJsonFieldConflicts); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); return writer; }; /** - * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.EnumOptions * @static - * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * Decodes an EnumOptions message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.EnumOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @returns {google.protobuf.EnumOptions} EnumOptions * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnumValueDescriptorProto.decode = function decode(reader, length, error) { + EnumOptions.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } case 2: { - message.number = reader.int32(); + message.allowAlias = reader.bool(); break; } case 3: { - message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + message.deprecated = reader.bool(); + break; + } + case 6: { + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + break; + } + case 7: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); break; } default: @@ -16027,147 +27094,183 @@ }; /** - * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.EnumOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @returns {google.protobuf.EnumOptions} EnumOptions * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + EnumOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EnumValueDescriptorProto message. + * Verifies an EnumOptions message. * @function verify - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.EnumOptions * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EnumValueDescriptorProto.verify = function verify(message) { + EnumOptions.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"; - if (message.number != null && message.hasOwnProperty("number")) - if (!$util.isInteger(message.number)) - return "number: integer expected"; - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.EnumValueOptions.verify(message.options); + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + if (typeof message.allowAlias !== "boolean") + return "allowAlias: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") + return "deprecatedLegacyJsonFieldConflicts: boolean expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); if (error) - return "options." + error; + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } } return null; }; /** - * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.EnumOptions * @static * @param {Object.} object Plain object - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @returns {google.protobuf.EnumOptions} EnumOptions */ - EnumValueDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) + EnumOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumOptions) return object; - var message = new $root.google.protobuf.EnumValueDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.number != null) - message.number = object.number | 0; - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); + var message = new $root.google.protobuf.EnumOptions(); + if (object.allowAlias != null) + message.allowAlias = Boolean(object.allowAlias); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.deprecatedLegacyJsonFieldConflicts != null) + message.deprecatedLegacyJsonFieldConflicts = Boolean(object.deprecatedLegacyJsonFieldConflicts); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.EnumOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } } return message; }; /** - * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.EnumOptions * @static - * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto + * @param {google.protobuf.EnumOptions} message EnumOptions * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EnumValueDescriptorProto.toObject = function toObject(message, options) { + EnumOptions.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; if (options.defaults) { - object.name = ""; - object.number = 0; - object.options = null; + object.allowAlias = false; + object.deprecated = false; + object.deprecatedLegacyJsonFieldConflicts = false; + object.features = null; + } + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + object.allowAlias = message.allowAlias; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + object.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.number != null && message.hasOwnProperty("number")) - object.number = message.number; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); return object; }; /** - * Converts this EnumValueDescriptorProto to JSON. + * Converts this EnumOptions to JSON. * @function toJSON - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.EnumOptions * @instance * @returns {Object.} JSON object */ - EnumValueDescriptorProto.prototype.toJSON = function toJSON() { + EnumOptions.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for EnumValueDescriptorProto + * Gets the default type url for EnumOptions * @function getTypeUrl - * @memberof google.protobuf.EnumValueDescriptorProto + * @memberof google.protobuf.EnumOptions * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - EnumValueDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + EnumOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.EnumValueDescriptorProto"; + return typeUrlPrefix + "/google.protobuf.EnumOptions"; }; - return EnumValueDescriptorProto; + return EnumOptions; })(); - protobuf.ServiceDescriptorProto = (function() { + protobuf.EnumValueOptions = (function() { /** - * Properties of a ServiceDescriptorProto. + * Properties of an EnumValueOptions. * @memberof google.protobuf - * @interface IServiceDescriptorProto - * @property {string|null} [name] ServiceDescriptorProto name - * @property {Array.|null} [method] ServiceDescriptorProto method - * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options + * @interface IEnumValueOptions + * @property {boolean|null} [deprecated] EnumValueOptions deprecated + * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features + * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] EnumValueOptions featureSupport + * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption */ /** - * Constructs a new ServiceDescriptorProto. + * Constructs a new EnumValueOptions. * @memberof google.protobuf - * @classdesc Represents a ServiceDescriptorProto. - * @implements IServiceDescriptorProto + * @classdesc Represents an EnumValueOptions. + * @implements IEnumValueOptions * @constructor - * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set */ - function ServiceDescriptorProto(properties) { - this.method = []; + function EnumValueOptions(properties) { + this.uninterpretedOption = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16175,108 +27278,136 @@ } /** - * ServiceDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.ServiceDescriptorProto + * EnumValueOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumValueOptions * @instance */ - ServiceDescriptorProto.prototype.name = ""; + EnumValueOptions.prototype.deprecated = false; /** - * ServiceDescriptorProto method. - * @member {Array.} method - * @memberof google.protobuf.ServiceDescriptorProto + * EnumValueOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.EnumValueOptions * @instance */ - ServiceDescriptorProto.prototype.method = $util.emptyArray; + EnumValueOptions.prototype.features = null; /** - * ServiceDescriptorProto options. - * @member {google.protobuf.IServiceOptions|null|undefined} options - * @memberof google.protobuf.ServiceDescriptorProto + * EnumValueOptions debugRedact. + * @member {boolean} debugRedact + * @memberof google.protobuf.EnumValueOptions * @instance */ - ServiceDescriptorProto.prototype.options = null; + EnumValueOptions.prototype.debugRedact = false; /** - * Creates a new ServiceDescriptorProto instance using the specified properties. + * EnumValueOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.featureSupport = null; + + /** + * EnumValueOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumValueOptions instance using the specified properties. * @function create - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.EnumValueOptions * @static - * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance */ - ServiceDescriptorProto.create = function create(properties) { - return new ServiceDescriptorProto(properties); + EnumValueOptions.create = function create(properties) { + return new EnumValueOptions(properties); }; /** - * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. * @function encode - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.EnumValueOptions * @static - * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ServiceDescriptorProto.encode = function encode(message, writer) { + EnumValueOptions.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); - if (message.method != null && message.method.length) - for (var i = 0; i < message.method.length; ++i) - $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); return writer; }; /** - * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.EnumValueOptions * @static - * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * Decodes an EnumValueOptions message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.EnumValueOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ServiceDescriptorProto.decode = function decode(reader, length, error) { + EnumValueOptions.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - message.name = reader.string(); + message.deprecated = reader.bool(); break; } case 2: { - if (!(message.method && message.method.length)) - message.method = []; - message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } case 3: { - message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + message.debugRedact = reader.bool(); + break; + } + case 4: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); break; } default: @@ -16288,167 +27419,189 @@ }; /** - * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.EnumValueOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ServiceDescriptorProto message. + * Verifies an EnumValueOptions message. * @function verify - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.EnumValueOptions * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ServiceDescriptorProto.verify = function verify(message) { + EnumValueOptions.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"; - if (message.method != null && message.hasOwnProperty("method")) { - if (!Array.isArray(message.method)) - return "method: array expected"; - for (var i = 0; i < message.method.length; ++i) { - var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); - if (error) - return "method." + error; - } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; } - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.ServiceOptions.verify(message.options); + if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + if (typeof message.debugRedact !== "boolean") + return "debugRedact: boolean expected"; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); if (error) - return "options." + error; + return "featureSupport." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } } return null; }; /** - * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.EnumValueOptions * @static * @param {Object.} object Plain object - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto - */ - ServiceDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ServiceDescriptorProto) - return object; - var message = new $root.google.protobuf.ServiceDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.method) { - if (!Array.isArray(object.method)) - throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); - message.method = []; - for (var i = 0; i < object.method.length; ++i) { - if (typeof object.method[i] !== "object") - throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); - message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); - } + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + */ + EnumValueOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueOptions) + return object; + var message = new $root.google.protobuf.EnumValueOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); + if (object.debugRedact != null) + message.debugRedact = Boolean(object.debugRedact); + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } } return message; }; /** - * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.EnumValueOptions * @static - * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto + * @param {google.protobuf.EnumValueOptions} message EnumValueOptions * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ServiceDescriptorProto.toObject = function toObject(message, options) { + EnumValueOptions.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.method = []; + object.uninterpretedOption = []; if (options.defaults) { - object.name = ""; - object.options = null; + object.deprecated = false; + object.features = null; + object.debugRedact = false; + object.featureSupport = null; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.method && message.method.length) { - object.method = []; - for (var j = 0; j < message.method.length; ++j) - object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + object.debugRedact = message.debugRedact; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); return object; }; /** - * Converts this ServiceDescriptorProto to JSON. + * Converts this EnumValueOptions to JSON. * @function toJSON - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.EnumValueOptions * @instance * @returns {Object.} JSON object */ - ServiceDescriptorProto.prototype.toJSON = function toJSON() { + EnumValueOptions.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ServiceDescriptorProto + * Gets the default type url for EnumValueOptions * @function getTypeUrl - * @memberof google.protobuf.ServiceDescriptorProto + * @memberof google.protobuf.EnumValueOptions * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ServiceDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + EnumValueOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.ServiceDescriptorProto"; + return typeUrlPrefix + "/google.protobuf.EnumValueOptions"; }; - return ServiceDescriptorProto; + return EnumValueOptions; })(); - protobuf.MethodDescriptorProto = (function() { + protobuf.ServiceOptions = (function() { /** - * Properties of a MethodDescriptorProto. + * Properties of a ServiceOptions. * @memberof google.protobuf - * @interface IMethodDescriptorProto - * @property {string|null} [name] MethodDescriptorProto name - * @property {string|null} [inputType] MethodDescriptorProto inputType - * @property {string|null} [outputType] MethodDescriptorProto outputType - * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options - * @property {boolean|null} [clientStreaming] MethodDescriptorProto clientStreaming - * @property {boolean|null} [serverStreaming] MethodDescriptorProto serverStreaming + * @interface IServiceOptions + * @property {google.protobuf.IFeatureSet|null} [features] ServiceOptions features + * @property {boolean|null} [deprecated] ServiceOptions deprecated + * @property {Array.|null} [uninterpretedOption] ServiceOptions uninterpretedOption + * @property {string|null} [".google.api.defaultHost"] ServiceOptions .google.api.defaultHost + * @property {string|null} [".google.api.oauthScopes"] ServiceOptions .google.api.oauthScopes + * @property {string|null} [".google.api.apiVersion"] ServiceOptions .google.api.apiVersion */ /** - * Constructs a new MethodDescriptorProto. + * Constructs a new ServiceOptions. * @memberof google.protobuf - * @classdesc Represents a MethodDescriptorProto. - * @implements IMethodDescriptorProto + * @classdesc Represents a ServiceOptions. + * @implements IServiceOptions * @constructor - * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set */ - function MethodDescriptorProto(properties) { + function ServiceOptions(properties) { + this.uninterpretedOption = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16456,147 +27609,150 @@ } /** - * MethodDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.MethodDescriptorProto + * ServiceOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.ServiceOptions * @instance */ - MethodDescriptorProto.prototype.name = ""; + ServiceOptions.prototype.features = null; /** - * MethodDescriptorProto inputType. - * @member {string} inputType - * @memberof google.protobuf.MethodDescriptorProto + * ServiceOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.ServiceOptions * @instance */ - MethodDescriptorProto.prototype.inputType = ""; + ServiceOptions.prototype.deprecated = false; /** - * MethodDescriptorProto outputType. - * @member {string} outputType - * @memberof google.protobuf.MethodDescriptorProto + * ServiceOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ServiceOptions * @instance */ - MethodDescriptorProto.prototype.outputType = ""; + ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; /** - * MethodDescriptorProto options. - * @member {google.protobuf.IMethodOptions|null|undefined} options - * @memberof google.protobuf.MethodDescriptorProto + * ServiceOptions .google.api.defaultHost. + * @member {string} .google.api.defaultHost + * @memberof google.protobuf.ServiceOptions * @instance */ - MethodDescriptorProto.prototype.options = null; + ServiceOptions.prototype[".google.api.defaultHost"] = ""; /** - * MethodDescriptorProto clientStreaming. - * @member {boolean} clientStreaming - * @memberof google.protobuf.MethodDescriptorProto + * ServiceOptions .google.api.oauthScopes. + * @member {string} .google.api.oauthScopes + * @memberof google.protobuf.ServiceOptions * @instance */ - MethodDescriptorProto.prototype.clientStreaming = false; + ServiceOptions.prototype[".google.api.oauthScopes"] = ""; /** - * MethodDescriptorProto serverStreaming. - * @member {boolean} serverStreaming - * @memberof google.protobuf.MethodDescriptorProto + * ServiceOptions .google.api.apiVersion. + * @member {string} .google.api.apiVersion + * @memberof google.protobuf.ServiceOptions * @instance */ - MethodDescriptorProto.prototype.serverStreaming = false; + ServiceOptions.prototype[".google.api.apiVersion"] = ""; /** - * Creates a new MethodDescriptorProto instance using the specified properties. + * Creates a new ServiceOptions instance using the specified properties. * @function create - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.ServiceOptions * @static - * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + * @returns {google.protobuf.ServiceOptions} ServiceOptions instance */ - MethodDescriptorProto.create = function create(properties) { - return new MethodDescriptorProto(properties); + ServiceOptions.create = function create(properties) { + return new ServiceOptions(properties); }; /** - * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. * @function encode - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.ServiceOptions * @static - * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MethodDescriptorProto.encode = function encode(message, writer) { + ServiceOptions.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); - if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); - if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); - if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) + writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); + if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) + writer.uint32(/* id 1050, wireType 2 =*/8402).string(message[".google.api.oauthScopes"]); + if (message[".google.api.apiVersion"] != null && Object.hasOwnProperty.call(message, ".google.api.apiVersion")) + writer.uint32(/* id 525000001, wireType 2 =*/4200000010).string(message[".google.api.apiVersion"]); return writer; }; /** - * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.ServiceOptions * @static - * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * Decodes a ServiceOptions message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.ServiceOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @returns {google.protobuf.ServiceOptions} ServiceOptions * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MethodDescriptorProto.decode = function decode(reader, length, error) { + ServiceOptions.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { - case 1: { - message.name = reader.string(); + case 34: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } - case 2: { - message.inputType = reader.string(); + case 33: { + message.deprecated = reader.bool(); break; } - case 3: { - message.outputType = reader.string(); + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); break; } - case 4: { - message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + case 1049: { + message[".google.api.defaultHost"] = reader.string(); break; } - case 5: { - message.clientStreaming = reader.bool(); + case 1050: { + message[".google.api.oauthScopes"] = reader.string(); break; } - case 6: { - message.serverStreaming = reader.bool(); + case 525000001: { + message[".google.api.apiVersion"] = reader.string(); break; } default: @@ -16608,191 +27764,194 @@ }; /** - * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.ServiceOptions * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @returns {google.protobuf.ServiceOptions} ServiceOptions * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + ServiceOptions.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a MethodDescriptorProto message. + * Verifies a ServiceOptions message. * @function verify - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.ServiceOptions * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MethodDescriptorProto.verify = function verify(message) { + ServiceOptions.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"; - if (message.inputType != null && message.hasOwnProperty("inputType")) - if (!$util.isString(message.inputType)) - return "inputType: string expected"; - if (message.outputType != null && message.hasOwnProperty("outputType")) - if (!$util.isString(message.outputType)) - return "outputType: string expected"; - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.MethodOptions.verify(message.options); + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); if (error) - return "options." + error; + return "features." + error; } - if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) - if (typeof message.clientStreaming !== "boolean") - return "clientStreaming: boolean expected"; - if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) - if (typeof message.serverStreaming !== "boolean") - return "serverStreaming: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + if (!$util.isString(message[".google.api.defaultHost"])) + return ".google.api.defaultHost: string expected"; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + if (!$util.isString(message[".google.api.oauthScopes"])) + return ".google.api.oauthScopes: string expected"; + if (message[".google.api.apiVersion"] != null && message.hasOwnProperty(".google.api.apiVersion")) + if (!$util.isString(message[".google.api.apiVersion"])) + return ".google.api.apiVersion: string expected"; return null; }; /** - * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.ServiceOptions * @static * @param {Object.} object Plain object - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @returns {google.protobuf.ServiceOptions} ServiceOptions */ - MethodDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MethodDescriptorProto) + ServiceOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceOptions) return object; - var message = new $root.google.protobuf.MethodDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.inputType != null) - message.inputType = String(object.inputType); - if (object.outputType != null) - message.outputType = String(object.outputType); - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); + var message = new $root.google.protobuf.ServiceOptions(); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.ServiceOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); } - if (object.clientStreaming != null) - message.clientStreaming = Boolean(object.clientStreaming); - if (object.serverStreaming != null) - message.serverStreaming = Boolean(object.serverStreaming); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.defaultHost"] != null) + message[".google.api.defaultHost"] = String(object[".google.api.defaultHost"]); + if (object[".google.api.oauthScopes"] != null) + message[".google.api.oauthScopes"] = String(object[".google.api.oauthScopes"]); + if (object[".google.api.apiVersion"] != null) + message[".google.api.apiVersion"] = String(object[".google.api.apiVersion"]); return message; }; /** - * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.ServiceOptions * @static - * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto + * @param {google.protobuf.ServiceOptions} message ServiceOptions * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - MethodDescriptorProto.toObject = function toObject(message, options) { + ServiceOptions.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; if (options.defaults) { - object.name = ""; - object.inputType = ""; - object.outputType = ""; - object.options = null; - object.clientStreaming = false; - object.serverStreaming = false; + object.deprecated = false; + object.features = null; + object[".google.api.defaultHost"] = ""; + object[".google.api.oauthScopes"] = ""; + object[".google.api.apiVersion"] = ""; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.inputType != null && message.hasOwnProperty("inputType")) - object.inputType = message.inputType; - if (message.outputType != null && message.hasOwnProperty("outputType")) - object.outputType = message.outputType; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); - if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) - object.clientStreaming = message.clientStreaming; - if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) - object.serverStreaming = message.serverStreaming; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; + if (message[".google.api.apiVersion"] != null && message.hasOwnProperty(".google.api.apiVersion")) + object[".google.api.apiVersion"] = message[".google.api.apiVersion"]; return object; }; /** - * Converts this MethodDescriptorProto to JSON. + * Converts this ServiceOptions to JSON. * @function toJSON - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.ServiceOptions * @instance * @returns {Object.} JSON object */ - MethodDescriptorProto.prototype.toJSON = function toJSON() { + ServiceOptions.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for MethodDescriptorProto + * Gets the default type url for ServiceOptions * @function getTypeUrl - * @memberof google.protobuf.MethodDescriptorProto + * @memberof google.protobuf.ServiceOptions * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - MethodDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ServiceOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.MethodDescriptorProto"; + return typeUrlPrefix + "/google.protobuf.ServiceOptions"; }; - return MethodDescriptorProto; + return ServiceOptions; })(); - protobuf.FileOptions = (function() { + protobuf.MethodOptions = (function() { /** - * Properties of a FileOptions. + * Properties of a MethodOptions. * @memberof google.protobuf - * @interface IFileOptions - * @property {string|null} [javaPackage] FileOptions javaPackage - * @property {string|null} [javaOuterClassname] FileOptions javaOuterClassname - * @property {boolean|null} [javaMultipleFiles] FileOptions javaMultipleFiles - * @property {boolean|null} [javaGenerateEqualsAndHash] FileOptions javaGenerateEqualsAndHash - * @property {boolean|null} [javaStringCheckUtf8] FileOptions javaStringCheckUtf8 - * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimizeFor] FileOptions optimizeFor - * @property {string|null} [goPackage] FileOptions goPackage - * @property {boolean|null} [ccGenericServices] FileOptions ccGenericServices - * @property {boolean|null} [javaGenericServices] FileOptions javaGenericServices - * @property {boolean|null} [pyGenericServices] FileOptions pyGenericServices - * @property {boolean|null} [deprecated] FileOptions deprecated - * @property {boolean|null} [ccEnableArenas] FileOptions ccEnableArenas - * @property {string|null} [objcClassPrefix] FileOptions objcClassPrefix - * @property {string|null} [csharpNamespace] FileOptions csharpNamespace - * @property {string|null} [swiftPrefix] FileOptions swiftPrefix - * @property {string|null} [phpClassPrefix] FileOptions phpClassPrefix - * @property {string|null} [phpNamespace] FileOptions phpNamespace - * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace - * @property {string|null} [rubyPackage] FileOptions rubyPackage - * @property {google.protobuf.IFeatureSet|null} [features] FileOptions features - * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption - * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition + * @interface IMethodOptions + * @property {boolean|null} [deprecated] MethodOptions deprecated + * @property {google.protobuf.MethodOptions.IdempotencyLevel|null} [idempotencyLevel] MethodOptions idempotencyLevel + * @property {google.protobuf.IFeatureSet|null} [features] MethodOptions features + * @property {Array.|null} [uninterpretedOption] MethodOptions uninterpretedOption + * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http + * @property {Array.|null} [".google.api.methodSignature"] MethodOptions .google.api.methodSignature + * @property {google.longrunning.IOperationInfo|null} [".google.longrunning.operationInfo"] MethodOptions .google.longrunning.operationInfo */ /** - * Constructs a new FileOptions. + * Constructs a new MethodOptions. * @memberof google.protobuf - * @classdesc Represents a FileOptions. - * @implements IFileOptions + * @classdesc Represents a MethodOptions. + * @implements IMethodOptions * @constructor - * @param {google.protobuf.IFileOptions=} [properties] Properties to set + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set */ - function FileOptions(properties) { + function MethodOptions(properties) { this.uninterpretedOption = []; - this[".google.api.resourceDefinition"] = []; + this[".google.api.methodSignature"] = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -16800,377 +27959,601 @@ } /** - * FileOptions javaPackage. - * @member {string} javaPackage - * @memberof google.protobuf.FileOptions + * MethodOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MethodOptions * @instance */ - FileOptions.prototype.javaPackage = ""; + MethodOptions.prototype.deprecated = false; /** - * FileOptions javaOuterClassname. - * @member {string} javaOuterClassname - * @memberof google.protobuf.FileOptions + * MethodOptions idempotencyLevel. + * @member {google.protobuf.MethodOptions.IdempotencyLevel} idempotencyLevel + * @memberof google.protobuf.MethodOptions * @instance */ - FileOptions.prototype.javaOuterClassname = ""; + MethodOptions.prototype.idempotencyLevel = 0; /** - * FileOptions javaMultipleFiles. - * @member {boolean} javaMultipleFiles - * @memberof google.protobuf.FileOptions + * MethodOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.features = null; + + /** + * MethodOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MethodOptions .google.api.http. + * @member {google.api.IHttpRule|null|undefined} .google.api.http + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.http"] = null; + + /** + * MethodOptions .google.api.methodSignature. + * @member {Array.} .google.api.methodSignature + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.methodSignature"] = $util.emptyArray; + + /** + * MethodOptions .google.longrunning.operationInfo. + * @member {google.longrunning.IOperationInfo|null|undefined} .google.longrunning.operationInfo + * @memberof google.protobuf.MethodOptions * @instance */ - FileOptions.prototype.javaMultipleFiles = false; + MethodOptions.prototype[".google.longrunning.operationInfo"] = null; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + * @returns {google.protobuf.MethodOptions} MethodOptions instance + */ + MethodOptions.create = function create(properties) { + return new MethodOptions(properties); + }; /** - * FileOptions javaGenerateEqualsAndHash. - * @member {boolean} javaGenerateEqualsAndHash - * @memberof google.protobuf.FileOptions - * @instance + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - FileOptions.prototype.javaGenerateEqualsAndHash = false; + MethodOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) + writer.uint32(/* id 34, wireType 0 =*/272).int32(message.idempotencyLevel); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.longrunning.operationInfo"] != null && Object.hasOwnProperty.call(message, ".google.longrunning.operationInfo")) + $root.google.longrunning.OperationInfo.encode(message[".google.longrunning.operationInfo"], writer.uint32(/* id 1049, wireType 2 =*/8394).fork()).ldelim(); + if (message[".google.api.methodSignature"] != null && message[".google.api.methodSignature"].length) + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + writer.uint32(/* id 1051, wireType 2 =*/8410).string(message[".google.api.methodSignature"][i]); + if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) + $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); + return writer; + }; /** - * FileOptions javaStringCheckUtf8. - * @member {boolean} javaStringCheckUtf8 - * @memberof google.protobuf.FileOptions - * @instance + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - FileOptions.prototype.javaStringCheckUtf8 = false; + MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * FileOptions optimizeFor. - * @member {google.protobuf.FileOptions.OptimizeMode} optimizeFor - * @memberof google.protobuf.FileOptions - * @instance + * Decodes a MethodOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FileOptions.prototype.optimizeFor = 1; + MethodOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 33: { + message.deprecated = reader.bool(); + break; + } + case 34: { + message.idempotencyLevel = reader.int32(); + break; + } + case 35: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 72295728: { + message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); + break; + } + case 1051: { + if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) + message[".google.api.methodSignature"] = []; + message[".google.api.methodSignature"].push(reader.string()); + break; + } + case 1049: { + message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * FileOptions goPackage. - * @member {string} goPackage - * @memberof google.protobuf.FileOptions - * @instance + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FileOptions.prototype.goPackage = ""; + MethodOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * FileOptions ccGenericServices. - * @member {boolean} ccGenericServices - * @memberof google.protobuf.FileOptions - * @instance + * Verifies a MethodOptions message. + * @function verify + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FileOptions.prototype.ccGenericServices = false; + MethodOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + switch (message.idempotencyLevel) { + default: + return "idempotencyLevel: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) { + var error = $root.google.api.HttpRule.verify(message[".google.api.http"]); + if (error) + return ".google.api.http." + error; + } + if (message[".google.api.methodSignature"] != null && message.hasOwnProperty(".google.api.methodSignature")) { + if (!Array.isArray(message[".google.api.methodSignature"])) + return ".google.api.methodSignature: array expected"; + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + if (!$util.isString(message[".google.api.methodSignature"][i])) + return ".google.api.methodSignature: string[] expected"; + } + if (message[".google.longrunning.operationInfo"] != null && message.hasOwnProperty(".google.longrunning.operationInfo")) { + var error = $root.google.longrunning.OperationInfo.verify(message[".google.longrunning.operationInfo"]); + if (error) + return ".google.longrunning.operationInfo." + error; + } + return null; + }; /** - * FileOptions javaGenericServices. - * @member {boolean} javaGenericServices - * @memberof google.protobuf.FileOptions - * @instance + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodOptions} MethodOptions */ - FileOptions.prototype.javaGenericServices = false; + MethodOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodOptions) + return object; + var message = new $root.google.protobuf.MethodOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + switch (object.idempotencyLevel) { + default: + if (typeof object.idempotencyLevel === "number") { + message.idempotencyLevel = object.idempotencyLevel; + break; + } + break; + case "IDEMPOTENCY_UNKNOWN": + case 0: + message.idempotencyLevel = 0; + break; + case "NO_SIDE_EFFECTS": + case 1: + message.idempotencyLevel = 1; + break; + case "IDEMPOTENT": + case 2: + message.idempotencyLevel = 2; + break; + } + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.MethodOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.http"] != null) { + if (typeof object[".google.api.http"] !== "object") + throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); + message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"]); + } + if (object[".google.api.methodSignature"]) { + if (!Array.isArray(object[".google.api.methodSignature"])) + throw TypeError(".google.protobuf.MethodOptions..google.api.methodSignature: array expected"); + message[".google.api.methodSignature"] = []; + for (var i = 0; i < object[".google.api.methodSignature"].length; ++i) + message[".google.api.methodSignature"][i] = String(object[".google.api.methodSignature"][i]); + } + if (object[".google.longrunning.operationInfo"] != null) { + if (typeof object[".google.longrunning.operationInfo"] !== "object") + throw TypeError(".google.protobuf.MethodOptions..google.longrunning.operationInfo: object expected"); + message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.fromObject(object[".google.longrunning.operationInfo"]); + } + return message; + }; /** - * FileOptions pyGenericServices. - * @member {boolean} pyGenericServices - * @memberof google.protobuf.FileOptions - * @instance + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.MethodOptions} message MethodOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - FileOptions.prototype.pyGenericServices = false; + MethodOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.methodSignature"] = []; + } + if (options.defaults) { + object.deprecated = false; + object.idempotencyLevel = options.enums === String ? "IDEMPOTENCY_UNKNOWN" : 0; + object.features = null; + object[".google.longrunning.operationInfo"] = null; + object[".google.api.http"] = null; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] === undefined ? message.idempotencyLevel : $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.longrunning.operationInfo"] != null && message.hasOwnProperty(".google.longrunning.operationInfo")) + object[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.toObject(message[".google.longrunning.operationInfo"], options); + if (message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length) { + object[".google.api.methodSignature"] = []; + for (var j = 0; j < message[".google.api.methodSignature"].length; ++j) + object[".google.api.methodSignature"][j] = message[".google.api.methodSignature"][j]; + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) + object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); + return object; + }; /** - * FileOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.FileOptions + * Converts this MethodOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MethodOptions * @instance + * @returns {Object.} JSON object */ - FileOptions.prototype.deprecated = false; + MethodOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; /** - * FileOptions ccEnableArenas. - * @member {boolean} ccEnableArenas - * @memberof google.protobuf.FileOptions - * @instance + * Gets the default type url for MethodOptions + * @function getTypeUrl + * @memberof google.protobuf.MethodOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url */ - FileOptions.prototype.ccEnableArenas = true; + MethodOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodOptions"; + }; /** - * FileOptions objcClassPrefix. - * @member {string} objcClassPrefix - * @memberof google.protobuf.FileOptions - * @instance + * IdempotencyLevel enum. + * @name google.protobuf.MethodOptions.IdempotencyLevel + * @enum {number} + * @property {number} IDEMPOTENCY_UNKNOWN=0 IDEMPOTENCY_UNKNOWN value + * @property {number} NO_SIDE_EFFECTS=1 NO_SIDE_EFFECTS value + * @property {number} IDEMPOTENT=2 IDEMPOTENT value */ - FileOptions.prototype.objcClassPrefix = ""; + MethodOptions.IdempotencyLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IDEMPOTENCY_UNKNOWN"] = 0; + values[valuesById[1] = "NO_SIDE_EFFECTS"] = 1; + values[valuesById[2] = "IDEMPOTENT"] = 2; + return values; + })(); - /** - * FileOptions csharpNamespace. - * @member {string} csharpNamespace - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.csharpNamespace = ""; + return MethodOptions; + })(); - /** - * FileOptions swiftPrefix. - * @member {string} swiftPrefix - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.swiftPrefix = ""; + protobuf.UninterpretedOption = (function() { /** - * FileOptions phpClassPrefix. - * @member {string} phpClassPrefix - * @memberof google.protobuf.FileOptions - * @instance + * Properties of an UninterpretedOption. + * @memberof google.protobuf + * @interface IUninterpretedOption + * @property {Array.|null} [name] UninterpretedOption name + * @property {string|null} [identifierValue] UninterpretedOption identifierValue + * @property {number|Long|null} [positiveIntValue] UninterpretedOption positiveIntValue + * @property {number|Long|null} [negativeIntValue] UninterpretedOption negativeIntValue + * @property {number|null} [doubleValue] UninterpretedOption doubleValue + * @property {Uint8Array|null} [stringValue] UninterpretedOption stringValue + * @property {string|null} [aggregateValue] UninterpretedOption aggregateValue */ - FileOptions.prototype.phpClassPrefix = ""; /** - * FileOptions phpNamespace. - * @member {string} phpNamespace - * @memberof google.protobuf.FileOptions - * @instance + * Constructs a new UninterpretedOption. + * @memberof google.protobuf + * @classdesc Represents an UninterpretedOption. + * @implements IUninterpretedOption + * @constructor + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set */ - FileOptions.prototype.phpNamespace = ""; + function UninterpretedOption(properties) { + this.name = []; + 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]]; + } /** - * FileOptions phpMetadataNamespace. - * @member {string} phpMetadataNamespace - * @memberof google.protobuf.FileOptions + * UninterpretedOption name. + * @member {Array.} name + * @memberof google.protobuf.UninterpretedOption * @instance */ - FileOptions.prototype.phpMetadataNamespace = ""; + UninterpretedOption.prototype.name = $util.emptyArray; /** - * FileOptions rubyPackage. - * @member {string} rubyPackage - * @memberof google.protobuf.FileOptions + * UninterpretedOption identifierValue. + * @member {string} identifierValue + * @memberof google.protobuf.UninterpretedOption * @instance */ - FileOptions.prototype.rubyPackage = ""; + UninterpretedOption.prototype.identifierValue = ""; /** - * FileOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.FileOptions + * UninterpretedOption positiveIntValue. + * @member {number|Long} positiveIntValue + * @memberof google.protobuf.UninterpretedOption * @instance */ - FileOptions.prototype.features = null; + UninterpretedOption.prototype.positiveIntValue = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** - * FileOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.FileOptions + * UninterpretedOption negativeIntValue. + * @member {number|Long} negativeIntValue + * @memberof google.protobuf.UninterpretedOption * @instance */ - FileOptions.prototype.uninterpretedOption = $util.emptyArray; + UninterpretedOption.prototype.negativeIntValue = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * FileOptions .google.api.resourceDefinition. - * @member {Array.} .google.api.resourceDefinition - * @memberof google.protobuf.FileOptions + * UninterpretedOption doubleValue. + * @member {number} doubleValue + * @memberof google.protobuf.UninterpretedOption * @instance */ - FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; + UninterpretedOption.prototype.doubleValue = 0; /** - * Creates a new FileOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.FileOptions - * @static - * @param {google.protobuf.IFileOptions=} [properties] Properties to set - * @returns {google.protobuf.FileOptions} FileOptions instance + * UninterpretedOption stringValue. + * @member {Uint8Array} stringValue + * @memberof google.protobuf.UninterpretedOption + * @instance */ - FileOptions.create = function create(properties) { - return new FileOptions(properties); - }; + UninterpretedOption.prototype.stringValue = $util.newBuffer([]); /** - * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FileOptions - * @static - * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); - if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); - if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); - if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) - writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); - if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); - if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) - writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); - if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) - writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); - if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) - writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); - if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) - writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); - if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) - writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); - if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) - writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); - if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) - writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); - if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) - writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); - if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) - writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); - if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) - writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); - if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) - writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); - if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) - writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); - if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) - writer.uint32(/* id 45, wireType 2 =*/362).string(message.rubyPackage); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) - for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) - $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + * UninterpretedOption aggregateValue. + * @member {string} aggregateValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.aggregateValue = ""; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance + */ + UninterpretedOption.create = function create(properties) { + return new UninterpretedOption(properties); + }; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.name.length) + for (var i = 0; i < message.name.length; ++i) + $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); + if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); + if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); + if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); return writer; }; /** - * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.UninterpretedOption * @static - * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FileOptions.encodeDelimited = function encodeDelimited(message, writer) { + UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FileOptions message from the specified reader or buffer. + * Decodes an UninterpretedOption message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.UninterpretedOption * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileOptions} FileOptions + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FileOptions.decode = function decode(reader, length, error) { + UninterpretedOption.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { - case 1: { - message.javaPackage = reader.string(); - break; - } - case 8: { - message.javaOuterClassname = reader.string(); - break; - } - case 10: { - message.javaMultipleFiles = reader.bool(); - break; - } - case 20: { - message.javaGenerateEqualsAndHash = reader.bool(); - break; - } - case 27: { - message.javaStringCheckUtf8 = reader.bool(); - break; - } - case 9: { - message.optimizeFor = reader.int32(); - break; - } - case 11: { - message.goPackage = reader.string(); - break; - } - case 16: { - message.ccGenericServices = reader.bool(); - break; - } - case 17: { - message.javaGenericServices = reader.bool(); - break; - } - case 18: { - message.pyGenericServices = reader.bool(); - break; - } - case 23: { - message.deprecated = reader.bool(); - break; - } - case 31: { - message.ccEnableArenas = reader.bool(); - break; - } - case 36: { - message.objcClassPrefix = reader.string(); - break; - } - case 37: { - message.csharpNamespace = reader.string(); - break; - } - case 39: { - message.swiftPrefix = reader.string(); - break; - } - case 40: { - message.phpClassPrefix = reader.string(); + case 2: { + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); break; } - case 41: { - message.phpNamespace = reader.string(); + case 3: { + message.identifierValue = reader.string(); break; } - case 44: { - message.phpMetadataNamespace = reader.string(); + case 4: { + message.positiveIntValue = reader.uint64(); break; } - case 45: { - message.rubyPackage = reader.string(); + case 5: { + message.negativeIntValue = reader.int64(); break; } - case 50: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + case 6: { + message.doubleValue = reader.double(); break; } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + case 7: { + message.stringValue = reader.bytes(); break; } - case 1053: { - if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) - message[".google.api.resourceDefinition"] = []; - message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + case 8: { + message.aggregateValue = reader.string(); break; } default: @@ -17182,380 +28565,462 @@ }; /** - * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.UninterpretedOption * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileOptions} FileOptions + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FileOptions.decodeDelimited = function decodeDelimited(reader) { + UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FileOptions message. + * Verifies an UninterpretedOption message. * @function verify - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.UninterpretedOption * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FileOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) - if (!$util.isString(message.javaPackage)) - return "javaPackage: string expected"; - if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) - if (!$util.isString(message.javaOuterClassname)) - return "javaOuterClassname: string expected"; - if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) - if (typeof message.javaMultipleFiles !== "boolean") - return "javaMultipleFiles: boolean expected"; - if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) - if (typeof message.javaGenerateEqualsAndHash !== "boolean") - return "javaGenerateEqualsAndHash: boolean expected"; - if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) - if (typeof message.javaStringCheckUtf8 !== "boolean") - return "javaStringCheckUtf8: boolean expected"; - if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) - switch (message.optimizeFor) { - default: - return "optimizeFor: enum value expected"; - case 1: - case 2: - case 3: - break; - } - if (message.goPackage != null && message.hasOwnProperty("goPackage")) - if (!$util.isString(message.goPackage)) - return "goPackage: string expected"; - if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) - if (typeof message.ccGenericServices !== "boolean") - return "ccGenericServices: boolean expected"; - if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) - if (typeof message.javaGenericServices !== "boolean") - return "javaGenericServices: boolean expected"; - if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) - if (typeof message.pyGenericServices !== "boolean") - return "pyGenericServices: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) - if (typeof message.ccEnableArenas !== "boolean") - return "ccEnableArenas: boolean expected"; - if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) - if (!$util.isString(message.objcClassPrefix)) - return "objcClassPrefix: string expected"; - if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) - if (!$util.isString(message.csharpNamespace)) - return "csharpNamespace: string expected"; - if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) - if (!$util.isString(message.swiftPrefix)) - return "swiftPrefix: string expected"; - if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) - if (!$util.isString(message.phpClassPrefix)) - return "phpClassPrefix: string expected"; - if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) - if (!$util.isString(message.phpNamespace)) - return "phpNamespace: string expected"; - if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) - if (!$util.isString(message.phpMetadataNamespace)) - return "phpMetadataNamespace: string expected"; - if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) - if (!$util.isString(message.rubyPackage)) - return "rubyPackage: string expected"; - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { - if (!Array.isArray(message[".google.api.resourceDefinition"])) - return ".google.api.resourceDefinition: array expected"; - for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { - var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UninterpretedOption.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) { + if (!Array.isArray(message.name)) + return "name: array expected"; + for (var i = 0; i < message.name.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); if (error) - return ".google.api.resourceDefinition." + error; + return "name." + error; } } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + if (!$util.isString(message.identifierValue)) + return "identifierValue: string expected"; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (!$util.isInteger(message.positiveIntValue) && !(message.positiveIntValue && $util.isInteger(message.positiveIntValue.low) && $util.isInteger(message.positiveIntValue.high))) + return "positiveIntValue: integer|Long expected"; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (!$util.isInteger(message.negativeIntValue) && !(message.negativeIntValue && $util.isInteger(message.negativeIntValue.low) && $util.isInteger(message.negativeIntValue.high))) + return "negativeIntValue: integer|Long expected"; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + if (typeof message.doubleValue !== "number") + return "doubleValue: number expected"; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + if (!(message.stringValue && typeof message.stringValue.length === "number" || $util.isString(message.stringValue))) + return "stringValue: buffer expected"; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + if (!$util.isString(message.aggregateValue)) + return "aggregateValue: string expected"; return null; }; /** - * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.UninterpretedOption * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FileOptions} FileOptions + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption */ - FileOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileOptions) + UninterpretedOption.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption) return object; - var message = new $root.google.protobuf.FileOptions(); - if (object.javaPackage != null) - message.javaPackage = String(object.javaPackage); - if (object.javaOuterClassname != null) - message.javaOuterClassname = String(object.javaOuterClassname); - if (object.javaMultipleFiles != null) - message.javaMultipleFiles = Boolean(object.javaMultipleFiles); - if (object.javaGenerateEqualsAndHash != null) - message.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); - if (object.javaStringCheckUtf8 != null) - message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); - switch (object.optimizeFor) { - default: - if (typeof object.optimizeFor === "number") { - message.optimizeFor = object.optimizeFor; - break; - } - break; - case "SPEED": - case 1: - message.optimizeFor = 1; - break; - case "CODE_SIZE": - case 2: - message.optimizeFor = 2; - break; - case "LITE_RUNTIME": - case 3: - message.optimizeFor = 3; - break; - } - if (object.goPackage != null) - message.goPackage = String(object.goPackage); - if (object.ccGenericServices != null) - message.ccGenericServices = Boolean(object.ccGenericServices); - if (object.javaGenericServices != null) - message.javaGenericServices = Boolean(object.javaGenericServices); - if (object.pyGenericServices != null) - message.pyGenericServices = Boolean(object.pyGenericServices); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.ccEnableArenas != null) - message.ccEnableArenas = Boolean(object.ccEnableArenas); - if (object.objcClassPrefix != null) - message.objcClassPrefix = String(object.objcClassPrefix); - if (object.csharpNamespace != null) - message.csharpNamespace = String(object.csharpNamespace); - if (object.swiftPrefix != null) - message.swiftPrefix = String(object.swiftPrefix); - if (object.phpClassPrefix != null) - message.phpClassPrefix = String(object.phpClassPrefix); - if (object.phpNamespace != null) - message.phpNamespace = String(object.phpNamespace); - if (object.phpMetadataNamespace != null) - message.phpMetadataNamespace = String(object.phpMetadataNamespace); - if (object.rubyPackage != null) - message.rubyPackage = String(object.rubyPackage); - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FileOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object[".google.api.resourceDefinition"]) { - if (!Array.isArray(object[".google.api.resourceDefinition"])) - throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); - message[".google.api.resourceDefinition"] = []; - for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { - if (typeof object[".google.api.resourceDefinition"][i] !== "object") - throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); - message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]); + var message = new $root.google.protobuf.UninterpretedOption(); + if (object.name) { + if (!Array.isArray(object.name)) + throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); + message.name = []; + for (var i = 0; i < object.name.length; ++i) { + if (typeof object.name[i] !== "object") + throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); + message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); } } + if (object.identifierValue != null) + message.identifierValue = String(object.identifierValue); + if (object.positiveIntValue != null) + if ($util.Long) + (message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue)).unsigned = true; + else if (typeof object.positiveIntValue === "string") + message.positiveIntValue = parseInt(object.positiveIntValue, 10); + else if (typeof object.positiveIntValue === "number") + message.positiveIntValue = object.positiveIntValue; + else if (typeof object.positiveIntValue === "object") + message.positiveIntValue = new $util.LongBits(object.positiveIntValue.low >>> 0, object.positiveIntValue.high >>> 0).toNumber(true); + if (object.negativeIntValue != null) + if ($util.Long) + (message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue)).unsigned = false; + else if (typeof object.negativeIntValue === "string") + message.negativeIntValue = parseInt(object.negativeIntValue, 10); + else if (typeof object.negativeIntValue === "number") + message.negativeIntValue = object.negativeIntValue; + else if (typeof object.negativeIntValue === "object") + message.negativeIntValue = new $util.LongBits(object.negativeIntValue.low >>> 0, object.negativeIntValue.high >>> 0).toNumber(); + if (object.doubleValue != null) + message.doubleValue = Number(object.doubleValue); + if (object.stringValue != null) + if (typeof object.stringValue === "string") + $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); + else if (object.stringValue.length >= 0) + message.stringValue = object.stringValue; + if (object.aggregateValue != null) + message.aggregateValue = String(object.aggregateValue); return message; }; /** - * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.UninterpretedOption * @static - * @param {google.protobuf.FileOptions} message FileOptions + * @param {google.protobuf.UninterpretedOption} message UninterpretedOption * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FileOptions.toObject = function toObject(message, options) { + UninterpretedOption.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.uninterpretedOption = []; - object[".google.api.resourceDefinition"] = []; - } + if (options.arrays || options.defaults) + object.name = []; if (options.defaults) { - object.javaPackage = ""; - object.javaOuterClassname = ""; - object.optimizeFor = options.enums === String ? "SPEED" : 1; - object.javaMultipleFiles = false; - object.goPackage = ""; - object.ccGenericServices = false; - object.javaGenericServices = false; - object.pyGenericServices = false; - object.javaGenerateEqualsAndHash = false; - object.deprecated = false; - object.javaStringCheckUtf8 = false; - object.ccEnableArenas = true; - object.objcClassPrefix = ""; - object.csharpNamespace = ""; - object.swiftPrefix = ""; - object.phpClassPrefix = ""; - object.phpNamespace = ""; - object.phpMetadataNamespace = ""; - object.rubyPackage = ""; - object.features = null; - } - if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) - object.javaPackage = message.javaPackage; - if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) - object.javaOuterClassname = message.javaOuterClassname; - if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) - object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] === undefined ? message.optimizeFor : $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; - if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) - object.javaMultipleFiles = message.javaMultipleFiles; - if (message.goPackage != null && message.hasOwnProperty("goPackage")) - object.goPackage = message.goPackage; - if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) - object.ccGenericServices = message.ccGenericServices; - if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) - object.javaGenericServices = message.javaGenericServices; - if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) - object.pyGenericServices = message.pyGenericServices; - if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) - object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) - object.javaStringCheckUtf8 = message.javaStringCheckUtf8; - if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) - object.ccEnableArenas = message.ccEnableArenas; - if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) - object.objcClassPrefix = message.objcClassPrefix; - if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) - object.csharpNamespace = message.csharpNamespace; - if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) - object.swiftPrefix = message.swiftPrefix; - if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) - object.phpClassPrefix = message.phpClassPrefix; - if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) - object.phpNamespace = message.phpNamespace; - if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) - object.phpMetadataNamespace = message.phpMetadataNamespace; - if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) - object.rubyPackage = message.rubyPackage; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + object.identifierValue = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.positiveIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.positiveIntValue = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.negativeIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.negativeIntValue = options.longs === String ? "0" : 0; + object.doubleValue = 0; + if (options.bytes === String) + object.stringValue = ""; + else { + object.stringValue = []; + if (options.bytes !== Array) + object.stringValue = $util.newBuffer(object.stringValue); + } + object.aggregateValue = ""; } - if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { - object[".google.api.resourceDefinition"] = []; - for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) - object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); + if (message.name && message.name.length) { + object.name = []; + for (var j = 0; j < message.name.length; ++j) + object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options); } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + object.identifierValue = message.identifierValue; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (typeof message.positiveIntValue === "number") + object.positiveIntValue = options.longs === String ? String(message.positiveIntValue) : message.positiveIntValue; + else + object.positiveIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.positiveIntValue) : options.longs === Number ? new $util.LongBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0).toNumber(true) : message.positiveIntValue; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (typeof message.negativeIntValue === "number") + object.negativeIntValue = options.longs === String ? String(message.negativeIntValue) : message.negativeIntValue; + else + object.negativeIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.negativeIntValue) : options.longs === Number ? new $util.LongBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0).toNumber() : message.negativeIntValue; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + object.stringValue = options.bytes === String ? $util.base64.encode(message.stringValue, 0, message.stringValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.stringValue) : message.stringValue; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + object.aggregateValue = message.aggregateValue; return object; }; /** - * Converts this FileOptions to JSON. + * Converts this UninterpretedOption to JSON. * @function toJSON - * @memberof google.protobuf.FileOptions + * @memberof google.protobuf.UninterpretedOption * @instance * @returns {Object.} JSON object */ - FileOptions.prototype.toJSON = function toJSON() { + UninterpretedOption.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Gets the default type url for FileOptions - * @function getTypeUrl - * @memberof google.protobuf.FileOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FileOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FileOptions"; - }; + /** + * Gets the default type url for UninterpretedOption + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UninterpretedOption.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption"; + }; + + UninterpretedOption.NamePart = (function() { + + /** + * Properties of a NamePart. + * @memberof google.protobuf.UninterpretedOption + * @interface INamePart + * @property {string} namePart NamePart namePart + * @property {boolean} isExtension NamePart isExtension + */ + + /** + * Constructs a new NamePart. + * @memberof google.protobuf.UninterpretedOption + * @classdesc Represents a NamePart. + * @implements INamePart + * @constructor + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + */ + function NamePart(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]]; + } + + /** + * NamePart namePart. + * @member {string} namePart + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.namePart = ""; + + /** + * NamePart isExtension. + * @member {boolean} isExtension + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.isExtension = false; + + /** + * Creates a new NamePart instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart instance + */ + NamePart.create = function create(properties) { + return new NamePart(properties); + }; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + writer.uint32(/* id 1, wireType 2 =*/10).string(message.namePart); + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isExtension); + return writer; + }; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.namePart = reader.string(); + break; + } + case 2: { + message.isExtension = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("namePart")) + throw $util.ProtocolError("missing required 'namePart'", { instance: message }); + if (!message.hasOwnProperty("isExtension")) + throw $util.ProtocolError("missing required 'isExtension'", { instance: message }); + return message; + }; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NamePart message. + * @function verify + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NamePart.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (!$util.isString(message.namePart)) + return "namePart: string expected"; + if (typeof message.isExtension !== "boolean") + return "isExtension: boolean expected"; + return null; + }; + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + */ + NamePart.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) + return object; + var message = new $root.google.protobuf.UninterpretedOption.NamePart(); + if (object.namePart != null) + message.namePart = String(object.namePart); + if (object.isExtension != null) + message.isExtension = Boolean(object.isExtension); + return message; + }; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.NamePart} message NamePart + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NamePart.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.namePart = ""; + object.isExtension = false; + } + if (message.namePart != null && message.hasOwnProperty("namePart")) + object.namePart = message.namePart; + if (message.isExtension != null && message.hasOwnProperty("isExtension")) + object.isExtension = message.isExtension; + return object; + }; + + /** + * Converts this NamePart to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + * @returns {Object.} JSON object + */ + NamePart.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NamePart + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NamePart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption.NamePart"; + }; - /** - * OptimizeMode enum. - * @name google.protobuf.FileOptions.OptimizeMode - * @enum {number} - * @property {number} SPEED=1 SPEED value - * @property {number} CODE_SIZE=2 CODE_SIZE value - * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value - */ - FileOptions.OptimizeMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[1] = "SPEED"] = 1; - values[valuesById[2] = "CODE_SIZE"] = 2; - values[valuesById[3] = "LITE_RUNTIME"] = 3; - return values; + return NamePart; })(); - return FileOptions; + return UninterpretedOption; })(); - protobuf.MessageOptions = (function() { + protobuf.FeatureSet = (function() { /** - * Properties of a MessageOptions. + * Properties of a FeatureSet. * @memberof google.protobuf - * @interface IMessageOptions - * @property {boolean|null} [messageSetWireFormat] MessageOptions messageSetWireFormat - * @property {boolean|null} [noStandardDescriptorAccessor] MessageOptions noStandardDescriptorAccessor - * @property {boolean|null} [deprecated] MessageOptions deprecated - * @property {boolean|null} [mapEntry] MessageOptions mapEntry - * @property {boolean|null} [deprecatedLegacyJsonFieldConflicts] MessageOptions deprecatedLegacyJsonFieldConflicts - * @property {google.protobuf.IFeatureSet|null} [features] MessageOptions features - * @property {Array.|null} [uninterpretedOption] MessageOptions uninterpretedOption - * @property {google.api.IResourceDescriptor|null} [".google.api.resource"] MessageOptions .google.api.resource + * @interface IFeatureSet + * @property {google.protobuf.FeatureSet.FieldPresence|null} [fieldPresence] FeatureSet fieldPresence + * @property {google.protobuf.FeatureSet.EnumType|null} [enumType] FeatureSet enumType + * @property {google.protobuf.FeatureSet.RepeatedFieldEncoding|null} [repeatedFieldEncoding] FeatureSet repeatedFieldEncoding + * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation + * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding + * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + * @property {google.protobuf.FeatureSet.EnforceNamingStyle|null} [enforceNamingStyle] FeatureSet enforceNamingStyle + * @property {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null} [defaultSymbolVisibility] FeatureSet defaultSymbolVisibility */ /** - * Constructs a new MessageOptions. + * Constructs a new FeatureSet. * @memberof google.protobuf - * @classdesc Represents a MessageOptions. - * @implements IMessageOptions + * @classdesc Represents a FeatureSet. + * @implements IFeatureSet * @constructor - * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + * @param {google.protobuf.IFeatureSet=} [properties] Properties to set */ - function MessageOptions(properties) { - this.uninterpretedOption = []; + function FeatureSet(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17563,408 +29028,880 @@ } /** - * MessageOptions messageSetWireFormat. - * @member {boolean} messageSetWireFormat - * @memberof google.protobuf.MessageOptions + * FeatureSet fieldPresence. + * @member {google.protobuf.FeatureSet.FieldPresence} fieldPresence + * @memberof google.protobuf.FeatureSet * @instance */ - MessageOptions.prototype.messageSetWireFormat = false; + FeatureSet.prototype.fieldPresence = 0; /** - * MessageOptions noStandardDescriptorAccessor. - * @member {boolean} noStandardDescriptorAccessor - * @memberof google.protobuf.MessageOptions + * FeatureSet enumType. + * @member {google.protobuf.FeatureSet.EnumType} enumType + * @memberof google.protobuf.FeatureSet * @instance */ - MessageOptions.prototype.noStandardDescriptorAccessor = false; + FeatureSet.prototype.enumType = 0; /** - * MessageOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.MessageOptions + * FeatureSet repeatedFieldEncoding. + * @member {google.protobuf.FeatureSet.RepeatedFieldEncoding} repeatedFieldEncoding + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.repeatedFieldEncoding = 0; + + /** + * FeatureSet utf8Validation. + * @member {google.protobuf.FeatureSet.Utf8Validation} utf8Validation + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.utf8Validation = 0; + + /** + * FeatureSet messageEncoding. + * @member {google.protobuf.FeatureSet.MessageEncoding} messageEncoding + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.messageEncoding = 0; + + /** + * FeatureSet jsonFormat. + * @member {google.protobuf.FeatureSet.JsonFormat} jsonFormat + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.jsonFormat = 0; + + /** + * FeatureSet enforceNamingStyle. + * @member {google.protobuf.FeatureSet.EnforceNamingStyle} enforceNamingStyle + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enforceNamingStyle = 0; + + /** + * FeatureSet defaultSymbolVisibility. + * @member {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility} defaultSymbolVisibility + * @memberof google.protobuf.FeatureSet * @instance */ - MessageOptions.prototype.deprecated = false; + FeatureSet.prototype.defaultSymbolVisibility = 0; + + /** + * Creates a new FeatureSet instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.IFeatureSet=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet} FeatureSet instance + */ + FeatureSet.create = function create(properties) { + return new FeatureSet(properties); + }; + + /** + * Encodes the specified FeatureSet message. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.IFeatureSet} message FeatureSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fieldPresence != null && Object.hasOwnProperty.call(message, "fieldPresence")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.fieldPresence); + if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.enumType); + if (message.repeatedFieldEncoding != null && Object.hasOwnProperty.call(message, "repeatedFieldEncoding")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.repeatedFieldEncoding); + if (message.utf8Validation != null && Object.hasOwnProperty.call(message, "utf8Validation")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.utf8Validation); + if (message.messageEncoding != null && Object.hasOwnProperty.call(message, "messageEncoding")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); + if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enforceNamingStyle); + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.defaultSymbolVisibility); + return writer; + }; + + /** + * Encodes the specified FeatureSet message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.IFeatureSet} message FeatureSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet} FeatureSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSet.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.fieldPresence = reader.int32(); + break; + } + case 2: { + message.enumType = reader.int32(); + break; + } + case 3: { + message.repeatedFieldEncoding = reader.int32(); + break; + } + case 4: { + message.utf8Validation = reader.int32(); + break; + } + case 5: { + message.messageEncoding = reader.int32(); + break; + } + case 6: { + message.jsonFormat = reader.int32(); + break; + } + case 7: { + message.enforceNamingStyle = reader.int32(); + break; + } + case 8: { + message.defaultSymbolVisibility = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet} FeatureSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * MessageOptions mapEntry. - * @member {boolean} mapEntry - * @memberof google.protobuf.MessageOptions - * @instance + * Verifies a FeatureSet message. + * @function verify + * @memberof google.protobuf.FeatureSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - MessageOptions.prototype.mapEntry = false; + FeatureSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) + switch (message.fieldPresence) { + default: + return "fieldPresence: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.enumType != null && message.hasOwnProperty("enumType")) + switch (message.enumType) { + default: + return "enumType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.repeatedFieldEncoding != null && message.hasOwnProperty("repeatedFieldEncoding")) + switch (message.repeatedFieldEncoding) { + default: + return "repeatedFieldEncoding: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.utf8Validation != null && message.hasOwnProperty("utf8Validation")) + switch (message.utf8Validation) { + default: + return "utf8Validation: enum value expected"; + case 0: + case 2: + case 3: + break; + } + if (message.messageEncoding != null && message.hasOwnProperty("messageEncoding")) + switch (message.messageEncoding) { + default: + return "messageEncoding: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) + switch (message.jsonFormat) { + default: + return "jsonFormat: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + switch (message.enforceNamingStyle) { + default: + return "enforceNamingStyle: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + switch (message.defaultSymbolVisibility) { + default: + return "defaultSymbolVisibility: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; /** - * MessageOptions deprecatedLegacyJsonFieldConflicts. - * @member {boolean} deprecatedLegacyJsonFieldConflicts - * @memberof google.protobuf.MessageOptions - * @instance + * Creates a FeatureSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet} FeatureSet */ - MessageOptions.prototype.deprecatedLegacyJsonFieldConflicts = false; + FeatureSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet) + return object; + var message = new $root.google.protobuf.FeatureSet(); + switch (object.fieldPresence) { + default: + if (typeof object.fieldPresence === "number") { + message.fieldPresence = object.fieldPresence; + break; + } + break; + case "FIELD_PRESENCE_UNKNOWN": + case 0: + message.fieldPresence = 0; + break; + case "EXPLICIT": + case 1: + message.fieldPresence = 1; + break; + case "IMPLICIT": + case 2: + message.fieldPresence = 2; + break; + case "LEGACY_REQUIRED": + case 3: + message.fieldPresence = 3; + break; + } + switch (object.enumType) { + default: + if (typeof object.enumType === "number") { + message.enumType = object.enumType; + break; + } + break; + case "ENUM_TYPE_UNKNOWN": + case 0: + message.enumType = 0; + break; + case "OPEN": + case 1: + message.enumType = 1; + break; + case "CLOSED": + case 2: + message.enumType = 2; + break; + } + switch (object.repeatedFieldEncoding) { + default: + if (typeof object.repeatedFieldEncoding === "number") { + message.repeatedFieldEncoding = object.repeatedFieldEncoding; + break; + } + break; + case "REPEATED_FIELD_ENCODING_UNKNOWN": + case 0: + message.repeatedFieldEncoding = 0; + break; + case "PACKED": + case 1: + message.repeatedFieldEncoding = 1; + break; + case "EXPANDED": + case 2: + message.repeatedFieldEncoding = 2; + break; + } + switch (object.utf8Validation) { + default: + if (typeof object.utf8Validation === "number") { + message.utf8Validation = object.utf8Validation; + break; + } + break; + case "UTF8_VALIDATION_UNKNOWN": + case 0: + message.utf8Validation = 0; + break; + case "VERIFY": + case 2: + message.utf8Validation = 2; + break; + case "NONE": + case 3: + message.utf8Validation = 3; + break; + } + switch (object.messageEncoding) { + default: + if (typeof object.messageEncoding === "number") { + message.messageEncoding = object.messageEncoding; + break; + } + break; + case "MESSAGE_ENCODING_UNKNOWN": + case 0: + message.messageEncoding = 0; + break; + case "LENGTH_PREFIXED": + case 1: + message.messageEncoding = 1; + break; + case "DELIMITED": + case 2: + message.messageEncoding = 2; + break; + } + switch (object.jsonFormat) { + default: + if (typeof object.jsonFormat === "number") { + message.jsonFormat = object.jsonFormat; + break; + } + break; + case "JSON_FORMAT_UNKNOWN": + case 0: + message.jsonFormat = 0; + break; + case "ALLOW": + case 1: + message.jsonFormat = 1; + break; + case "LEGACY_BEST_EFFORT": + case 2: + message.jsonFormat = 2; + break; + } + switch (object.enforceNamingStyle) { + default: + if (typeof object.enforceNamingStyle === "number") { + message.enforceNamingStyle = object.enforceNamingStyle; + break; + } + break; + case "ENFORCE_NAMING_STYLE_UNKNOWN": + case 0: + message.enforceNamingStyle = 0; + break; + case "STYLE2024": + case 1: + message.enforceNamingStyle = 1; + break; + case "STYLE_LEGACY": + case 2: + message.enforceNamingStyle = 2; + break; + } + switch (object.defaultSymbolVisibility) { + default: + if (typeof object.defaultSymbolVisibility === "number") { + message.defaultSymbolVisibility = object.defaultSymbolVisibility; + break; + } + break; + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + case 0: + message.defaultSymbolVisibility = 0; + break; + case "EXPORT_ALL": + case 1: + message.defaultSymbolVisibility = 1; + break; + case "EXPORT_TOP_LEVEL": + case 2: + message.defaultSymbolVisibility = 2; + break; + case "LOCAL_ALL": + case 3: + message.defaultSymbolVisibility = 3; + break; + case "STRICT": + case 4: + message.defaultSymbolVisibility = 4; + break; + } + return message; + }; /** - * MessageOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.MessageOptions - * @instance + * Creates a plain object from a FeatureSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.FeatureSet} message FeatureSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - MessageOptions.prototype.features = null; + FeatureSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.fieldPresence = options.enums === String ? "FIELD_PRESENCE_UNKNOWN" : 0; + object.enumType = options.enums === String ? "ENUM_TYPE_UNKNOWN" : 0; + object.repeatedFieldEncoding = options.enums === String ? "REPEATED_FIELD_ENCODING_UNKNOWN" : 0; + object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; + object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; + object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; + object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; + } + if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) + object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; + if (message.enumType != null && message.hasOwnProperty("enumType")) + object.enumType = options.enums === String ? $root.google.protobuf.FeatureSet.EnumType[message.enumType] === undefined ? message.enumType : $root.google.protobuf.FeatureSet.EnumType[message.enumType] : message.enumType; + if (message.repeatedFieldEncoding != null && message.hasOwnProperty("repeatedFieldEncoding")) + object.repeatedFieldEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] === undefined ? message.repeatedFieldEncoding : $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] : message.repeatedFieldEncoding; + if (message.utf8Validation != null && message.hasOwnProperty("utf8Validation")) + object.utf8Validation = options.enums === String ? $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] === undefined ? message.utf8Validation : $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] : message.utf8Validation; + if (message.messageEncoding != null && message.hasOwnProperty("messageEncoding")) + object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; + if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) + object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; + return object; + }; /** - * MessageOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.MessageOptions + * Converts this FeatureSet to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet * @instance + * @returns {Object.} JSON object */ - MessageOptions.prototype.uninterpretedOption = $util.emptyArray; + FeatureSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; /** - * MessageOptions .google.api.resource. - * @member {google.api.IResourceDescriptor|null|undefined} .google.api.resource - * @memberof google.protobuf.MessageOptions - * @instance + * Gets the default type url for FeatureSet + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url */ - MessageOptions.prototype[".google.api.resource"] = null; + FeatureSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet"; + }; /** - * Creates a new MessageOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.IMessageOptions=} [properties] Properties to set - * @returns {google.protobuf.MessageOptions} MessageOptions instance + * FieldPresence enum. + * @name google.protobuf.FeatureSet.FieldPresence + * @enum {number} + * @property {number} FIELD_PRESENCE_UNKNOWN=0 FIELD_PRESENCE_UNKNOWN value + * @property {number} EXPLICIT=1 EXPLICIT value + * @property {number} IMPLICIT=2 IMPLICIT value + * @property {number} LEGACY_REQUIRED=3 LEGACY_REQUIRED value */ - MessageOptions.create = function create(properties) { - return new MessageOptions(properties); - }; + FeatureSet.FieldPresence = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_PRESENCE_UNKNOWN"] = 0; + values[valuesById[1] = "EXPLICIT"] = 1; + values[valuesById[2] = "IMPLICIT"] = 2; + values[valuesById[3] = "LEGACY_REQUIRED"] = 3; + return values; + })(); /** - * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * EnumType enum. + * @name google.protobuf.FeatureSet.EnumType + * @enum {number} + * @property {number} ENUM_TYPE_UNKNOWN=0 ENUM_TYPE_UNKNOWN value + * @property {number} OPEN=1 OPEN value + * @property {number} CLOSED=2 CLOSED value */ - MessageOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); - if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) - writer.uint32(/* id 7, wireType 0 =*/56).bool(message.mapEntry); - if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) - writer.uint32(/* id 11, wireType 0 =*/88).bool(message.deprecatedLegacyJsonFieldConflicts); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) - $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); - return writer; - }; + FeatureSet.EnumType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENUM_TYPE_UNKNOWN"] = 0; + values[valuesById[1] = "OPEN"] = 1; + values[valuesById[2] = "CLOSED"] = 2; + return values; + })(); /** - * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * RepeatedFieldEncoding enum. + * @name google.protobuf.FeatureSet.RepeatedFieldEncoding + * @enum {number} + * @property {number} REPEATED_FIELD_ENCODING_UNKNOWN=0 REPEATED_FIELD_ENCODING_UNKNOWN value + * @property {number} PACKED=1 PACKED value + * @property {number} EXPANDED=2 EXPANDED value */ - MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + FeatureSet.RepeatedFieldEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REPEATED_FIELD_ENCODING_UNKNOWN"] = 0; + values[valuesById[1] = "PACKED"] = 1; + values[valuesById[2] = "EXPANDED"] = 2; + return values; + })(); /** - * Decodes a MessageOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.MessageOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MessageOptions} MessageOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Utf8Validation enum. + * @name google.protobuf.FeatureSet.Utf8Validation + * @enum {number} + * @property {number} UTF8_VALIDATION_UNKNOWN=0 UTF8_VALIDATION_UNKNOWN value + * @property {number} VERIFY=2 VERIFY value + * @property {number} NONE=3 NONE value */ - MessageOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.messageSetWireFormat = reader.bool(); - break; - } - case 2: { - message.noStandardDescriptorAccessor = reader.bool(); - break; - } - case 3: { - message.deprecated = reader.bool(); - break; - } - case 7: { - message.mapEntry = reader.bool(); - break; - } - case 11: { - message.deprecatedLegacyJsonFieldConflicts = reader.bool(); - break; - } - case 12: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 1053: { - message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + FeatureSet.Utf8Validation = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UTF8_VALIDATION_UNKNOWN"] = 0; + values[valuesById[2] = "VERIFY"] = 2; + values[valuesById[3] = "NONE"] = 3; + return values; + })(); /** - * Decodes a MessageOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.MessageOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MessageOptions} MessageOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * MessageEncoding enum. + * @name google.protobuf.FeatureSet.MessageEncoding + * @enum {number} + * @property {number} MESSAGE_ENCODING_UNKNOWN=0 MESSAGE_ENCODING_UNKNOWN value + * @property {number} LENGTH_PREFIXED=1 LENGTH_PREFIXED value + * @property {number} DELIMITED=2 DELIMITED value */ - MessageOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + FeatureSet.MessageEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MESSAGE_ENCODING_UNKNOWN"] = 0; + values[valuesById[1] = "LENGTH_PREFIXED"] = 1; + values[valuesById[2] = "DELIMITED"] = 2; + return values; + })(); /** - * Verifies a MessageOptions message. - * @function verify - * @memberof google.protobuf.MessageOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * JsonFormat enum. + * @name google.protobuf.FeatureSet.JsonFormat + * @enum {number} + * @property {number} JSON_FORMAT_UNKNOWN=0 JSON_FORMAT_UNKNOWN value + * @property {number} ALLOW=1 ALLOW value + * @property {number} LEGACY_BEST_EFFORT=2 LEGACY_BEST_EFFORT value */ - MessageOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) - if (typeof message.messageSetWireFormat !== "boolean") - return "messageSetWireFormat: boolean expected"; - if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) - if (typeof message.noStandardDescriptorAccessor !== "boolean") - return "noStandardDescriptorAccessor: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) - if (typeof message.mapEntry !== "boolean") - return "mapEntry: boolean expected"; - if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) - if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") - return "deprecatedLegacyJsonFieldConflicts: boolean expected"; - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { - var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); - if (error) - return ".google.api.resource." + error; - } - return null; - }; + FeatureSet.JsonFormat = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JSON_FORMAT_UNKNOWN"] = 0; + values[valuesById[1] = "ALLOW"] = 1; + values[valuesById[2] = "LEGACY_BEST_EFFORT"] = 2; + return values; + })(); /** - * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.MessageOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.MessageOptions} MessageOptions + * EnforceNamingStyle enum. + * @name google.protobuf.FeatureSet.EnforceNamingStyle + * @enum {number} + * @property {number} ENFORCE_NAMING_STYLE_UNKNOWN=0 ENFORCE_NAMING_STYLE_UNKNOWN value + * @property {number} STYLE2024=1 STYLE2024 value + * @property {number} STYLE_LEGACY=2 STYLE_LEGACY value */ - MessageOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MessageOptions) - return object; - var message = new $root.google.protobuf.MessageOptions(); - if (object.messageSetWireFormat != null) - message.messageSetWireFormat = Boolean(object.messageSetWireFormat); - if (object.noStandardDescriptorAccessor != null) - message.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.mapEntry != null) - message.mapEntry = Boolean(object.mapEntry); - if (object.deprecatedLegacyJsonFieldConflicts != null) - message.deprecatedLegacyJsonFieldConflicts = Boolean(object.deprecatedLegacyJsonFieldConflicts); - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.MessageOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + FeatureSet.EnforceNamingStyle = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENFORCE_NAMING_STYLE_UNKNOWN"] = 0; + values[valuesById[1] = "STYLE2024"] = 1; + values[valuesById[2] = "STYLE_LEGACY"] = 2; + return values; + })(); + + FeatureSet.VisibilityFeature = (function() { + + /** + * Properties of a VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @interface IVisibilityFeature + */ + + /** + * Constructs a new VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @classdesc Represents a VisibilityFeature. + * @implements IVisibilityFeature + * @constructor + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + */ + function VisibilityFeature(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]]; } - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature instance + */ + VisibilityFeature.create = function create(properties) { + return new VisibilityFeature(properties); + }; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } } - } - if (object[".google.api.resource"] != null) { - if (typeof object[".google.api.resource"] !== "object") - throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); - message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); - } - return message; - }; + return message; + }; - /** - * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.MessageOptions} message MessageOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MessageOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (options.defaults) { - object.messageSetWireFormat = false; - object.noStandardDescriptorAccessor = false; - object.deprecated = false; - object.mapEntry = false; - object.deprecatedLegacyJsonFieldConflicts = false; - object.features = null; - object[".google.api.resource"] = null; - } - if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) - object.messageSetWireFormat = message.messageSetWireFormat; - if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) - object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) - object.mapEntry = message.mapEntry; - if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) - object.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) - object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); - return object; - }; + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisibilityFeature message. + * @function verify + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisibilityFeature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + */ + VisibilityFeature.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) + return object; + return new $root.google.protobuf.FeatureSet.VisibilityFeature(); + }; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.VisibilityFeature} message VisibilityFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisibilityFeature.toObject = function toObject() { + return {}; + }; + + /** + * Converts this VisibilityFeature to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @instance + * @returns {Object.} JSON object + */ + VisibilityFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VisibilityFeature + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisibilityFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet.VisibilityFeature"; + }; - /** - * Converts this MessageOptions to JSON. - * @function toJSON - * @memberof google.protobuf.MessageOptions - * @instance - * @returns {Object.} JSON object - */ - MessageOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * DefaultSymbolVisibility enum. + * @name google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + * @enum {number} + * @property {number} DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN value + * @property {number} EXPORT_ALL=1 EXPORT_ALL value + * @property {number} EXPORT_TOP_LEVEL=2 EXPORT_TOP_LEVEL value + * @property {number} LOCAL_ALL=3 LOCAL_ALL value + * @property {number} STRICT=4 STRICT value + */ + VisibilityFeature.DefaultSymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0; + values[valuesById[1] = "EXPORT_ALL"] = 1; + values[valuesById[2] = "EXPORT_TOP_LEVEL"] = 2; + values[valuesById[3] = "LOCAL_ALL"] = 3; + values[valuesById[4] = "STRICT"] = 4; + return values; + })(); - /** - * Gets the default type url for MessageOptions - * @function getTypeUrl - * @memberof google.protobuf.MessageOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MessageOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.MessageOptions"; - }; + return VisibilityFeature; + })(); - return MessageOptions; + return FeatureSet; })(); - protobuf.FieldOptions = (function() { + protobuf.FeatureSetDefaults = (function() { /** - * Properties of a FieldOptions. + * Properties of a FeatureSetDefaults. * @memberof google.protobuf - * @interface IFieldOptions - * @property {google.protobuf.FieldOptions.CType|null} [ctype] FieldOptions ctype - * @property {boolean|null} [packed] FieldOptions packed - * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype - * @property {boolean|null} [lazy] FieldOptions lazy - * @property {boolean|null} [unverifiedLazy] FieldOptions unverifiedLazy - * @property {boolean|null} [deprecated] FieldOptions deprecated - * @property {boolean|null} [weak] FieldOptions weak - * @property {boolean|null} [debugRedact] FieldOptions debugRedact - * @property {google.protobuf.FieldOptions.OptionRetention|null} [retention] FieldOptions retention - * @property {Array.|null} [targets] FieldOptions targets - * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults - * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features - * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption - * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior - * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference + * @interface IFeatureSetDefaults + * @property {Array.|null} [defaults] FeatureSetDefaults defaults + * @property {google.protobuf.Edition|null} [minimumEdition] FeatureSetDefaults minimumEdition + * @property {google.protobuf.Edition|null} [maximumEdition] FeatureSetDefaults maximumEdition */ /** - * Constructs a new FieldOptions. + * Constructs a new FeatureSetDefaults. * @memberof google.protobuf - * @classdesc Represents a FieldOptions. - * @implements IFieldOptions + * @classdesc Represents a FeatureSetDefaults. + * @implements IFeatureSetDefaults * @constructor - * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + * @param {google.protobuf.IFeatureSetDefaults=} [properties] Properties to set */ - function FieldOptions(properties) { - this.targets = []; - this.editionDefaults = []; - this.uninterpretedOption = []; - this[".google.api.fieldBehavior"] = []; + function FeatureSetDefaults(properties) { + this.defaults = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -17972,295 +29909,108 @@ } /** - * FieldOptions ctype. - * @member {google.protobuf.FieldOptions.CType} ctype - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.ctype = 0; - - /** - * FieldOptions packed. - * @member {boolean} packed - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.packed = false; - - /** - * FieldOptions jstype. - * @member {google.protobuf.FieldOptions.JSType} jstype - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.jstype = 0; - - /** - * FieldOptions lazy. - * @member {boolean} lazy - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.lazy = false; - - /** - * FieldOptions unverifiedLazy. - * @member {boolean} unverifiedLazy - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.unverifiedLazy = false; - - /** - * FieldOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.deprecated = false; - - /** - * FieldOptions weak. - * @member {boolean} weak - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.weak = false; - - /** - * FieldOptions debugRedact. - * @member {boolean} debugRedact - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.debugRedact = false; - - /** - * FieldOptions retention. - * @member {google.protobuf.FieldOptions.OptionRetention} retention - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.retention = 0; - - /** - * FieldOptions targets. - * @member {Array.} targets - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.targets = $util.emptyArray; - - /** - * FieldOptions editionDefaults. - * @member {Array.} editionDefaults - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.editionDefaults = $util.emptyArray; - - /** - * FieldOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.features = null; - - /** - * FieldOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.FieldOptions + * FeatureSetDefaults defaults. + * @member {Array.} defaults + * @memberof google.protobuf.FeatureSetDefaults * @instance */ - FieldOptions.prototype.uninterpretedOption = $util.emptyArray; + FeatureSetDefaults.prototype.defaults = $util.emptyArray; /** - * FieldOptions .google.api.fieldBehavior. - * @member {Array.} .google.api.fieldBehavior - * @memberof google.protobuf.FieldOptions + * FeatureSetDefaults minimumEdition. + * @member {google.protobuf.Edition} minimumEdition + * @memberof google.protobuf.FeatureSetDefaults * @instance */ - FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; + FeatureSetDefaults.prototype.minimumEdition = 0; /** - * FieldOptions .google.api.resourceReference. - * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference - * @memberof google.protobuf.FieldOptions + * FeatureSetDefaults maximumEdition. + * @member {google.protobuf.Edition} maximumEdition + * @memberof google.protobuf.FeatureSetDefaults * @instance */ - FieldOptions.prototype[".google.api.resourceReference"] = null; + FeatureSetDefaults.prototype.maximumEdition = 0; /** - * Creates a new FieldOptions instance using the specified properties. + * Creates a new FeatureSetDefaults instance using the specified properties. * @function create - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.FeatureSetDefaults * @static - * @param {google.protobuf.IFieldOptions=} [properties] Properties to set - * @returns {google.protobuf.FieldOptions} FieldOptions instance + * @param {google.protobuf.IFeatureSetDefaults=} [properties] Properties to set + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults instance */ - FieldOptions.create = function create(properties) { - return new FieldOptions(properties); + FeatureSetDefaults.create = function create(properties) { + return new FeatureSetDefaults(properties); }; /** - * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * Encodes the specified FeatureSetDefaults message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. * @function encode - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.FeatureSetDefaults * @static - * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {google.protobuf.IFeatureSetDefaults} message FeatureSetDefaults message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldOptions.encode = function encode(message, writer) { + FeatureSetDefaults.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); - if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); - if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); - if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) - writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); - if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) - writer.uint32(/* id 15, wireType 0 =*/120).bool(message.unverifiedLazy); - if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) - writer.uint32(/* id 16, wireType 0 =*/128).bool(message.debugRedact); - if (message.retention != null && Object.hasOwnProperty.call(message, "retention")) - writer.uint32(/* id 17, wireType 0 =*/136).int32(message.retention); - if (message.targets != null && message.targets.length) - for (var i = 0; i < message.targets.length; ++i) - writer.uint32(/* id 19, wireType 0 =*/152).int32(message.targets[i]); - if (message.editionDefaults != null && message.editionDefaults.length) - for (var i = 0; i < message.editionDefaults.length; ++i) - $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) - for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) - writer.uint32(/* id 1052, wireType 0 =*/8416).int32(message[".google.api.fieldBehavior"][i]); - if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) - $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); + if (message.defaults != null && message.defaults.length) + for (var i = 0; i < message.defaults.length; ++i) + $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.encode(message.defaults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.minimumEdition != null && Object.hasOwnProperty.call(message, "minimumEdition")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.minimumEdition); + if (message.maximumEdition != null && Object.hasOwnProperty.call(message, "maximumEdition")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maximumEdition); return writer; }; /** - * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * Encodes the specified FeatureSetDefaults message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.FeatureSetDefaults * @static - * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {google.protobuf.IFeatureSetDefaults} message FeatureSetDefaults message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { + FeatureSetDefaults.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FieldOptions message from the specified reader or buffer. + * Decodes a FeatureSetDefaults message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.FeatureSetDefaults * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldOptions} FieldOptions + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FieldOptions.decode = function decode(reader, length, error) { + FeatureSetDefaults.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - message.ctype = reader.int32(); - break; - } - case 2: { - message.packed = reader.bool(); + if (!(message.defaults && message.defaults.length)) + message.defaults = []; + message.defaults.push($root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.decode(reader, reader.uint32())); break; } - case 6: { - message.jstype = reader.int32(); + case 4: { + message.minimumEdition = reader.int32(); break; } case 5: { - message.lazy = reader.bool(); - break; - } - case 15: { - message.unverifiedLazy = reader.bool(); - break; - } - case 3: { - message.deprecated = reader.bool(); - break; - } - case 10: { - message.weak = reader.bool(); - break; - } - case 16: { - message.debugRedact = reader.bool(); - break; - } - case 17: { - message.retention = reader.int32(); - break; - } - case 19: { - if (!(message.targets && message.targets.length)) - message.targets = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.targets.push(reader.int32()); - } else - message.targets.push(reader.int32()); - break; - } - case 20: { - if (!(message.editionDefaults && message.editionDefaults.length)) - message.editionDefaults = []; - message.editionDefaults.push($root.google.protobuf.FieldOptions.EditionDefault.decode(reader, reader.uint32())); - break; - } - case 21: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 1052: { - if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) - message[".google.api.fieldBehavior"] = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message[".google.api.fieldBehavior"].push(reader.int32()); - } else - message[".google.api.fieldBehavior"].push(reader.int32()); - break; - } - case 1055: { - message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + message.maximumEdition = reader.int32(); break; } default: @@ -18272,566 +30022,294 @@ }; /** - * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * Decodes a FeatureSetDefaults message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.FeatureSetDefaults * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldOptions} FieldOptions + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FieldOptions.decodeDelimited = function decodeDelimited(reader) { + FeatureSetDefaults.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FieldOptions message. + * Verifies a FeatureSetDefaults message. * @function verify - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.FeatureSetDefaults * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FieldOptions.verify = function verify(message) { + FeatureSetDefaults.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.ctype != null && message.hasOwnProperty("ctype")) - switch (message.ctype) { - default: - return "ctype: enum value expected"; - case 0: - case 1: - case 2: - break; + if (message.defaults != null && message.hasOwnProperty("defaults")) { + if (!Array.isArray(message.defaults)) + return "defaults: array expected"; + for (var i = 0; i < message.defaults.length; ++i) { + var error = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify(message.defaults[i]); + if (error) + return "defaults." + error; } - if (message.packed != null && message.hasOwnProperty("packed")) - if (typeof message.packed !== "boolean") - return "packed: boolean expected"; - if (message.jstype != null && message.hasOwnProperty("jstype")) - switch (message.jstype) { + } + if (message.minimumEdition != null && message.hasOwnProperty("minimumEdition")) + switch (message.minimumEdition) { default: - return "jstype: enum value expected"; + return "minimumEdition: enum value expected"; case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: case 1: case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: break; } - if (message.lazy != null && message.hasOwnProperty("lazy")) - if (typeof message.lazy !== "boolean") - return "lazy: boolean expected"; - if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) - if (typeof message.unverifiedLazy !== "boolean") - return "unverifiedLazy: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.weak != null && message.hasOwnProperty("weak")) - if (typeof message.weak !== "boolean") - return "weak: boolean expected"; - if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) - if (typeof message.debugRedact !== "boolean") - return "debugRedact: boolean expected"; - if (message.retention != null && message.hasOwnProperty("retention")) - switch (message.retention) { + if (message.maximumEdition != null && message.hasOwnProperty("maximumEdition")) + switch (message.maximumEdition) { default: - return "retention: enum value expected"; + return "maximumEdition: enum value expected"; case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: case 1: case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: break; } - if (message.targets != null && message.hasOwnProperty("targets")) { - if (!Array.isArray(message.targets)) - return "targets: array expected"; - for (var i = 0; i < message.targets.length; ++i) - switch (message.targets[i]) { - default: - return "targets: enum value[] expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - break; - } - } - if (message.editionDefaults != null && message.hasOwnProperty("editionDefaults")) { - if (!Array.isArray(message.editionDefaults)) - return "editionDefaults: array expected"; - for (var i = 0; i < message.editionDefaults.length; ++i) { - var error = $root.google.protobuf.FieldOptions.EditionDefault.verify(message.editionDefaults[i]); - if (error) - return "editionDefaults." + error; - } - } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message[".google.api.fieldBehavior"] != null && message.hasOwnProperty(".google.api.fieldBehavior")) { - if (!Array.isArray(message[".google.api.fieldBehavior"])) - return ".google.api.fieldBehavior: array expected"; - for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) - switch (message[".google.api.fieldBehavior"][i]) { - default: - return ".google.api.fieldBehavior: enum value[] expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - break; - } - } - if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { - var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); - if (error) - return ".google.api.resourceReference." + error; - } return null; }; /** - * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * Creates a FeatureSetDefaults message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.FeatureSetDefaults * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FieldOptions} FieldOptions + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults */ - FieldOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldOptions) + FeatureSetDefaults.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSetDefaults) return object; - var message = new $root.google.protobuf.FieldOptions(); - switch (object.ctype) { + var message = new $root.google.protobuf.FeatureSetDefaults(); + if (object.defaults) { + if (!Array.isArray(object.defaults)) + throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: array expected"); + message.defaults = []; + for (var i = 0; i < object.defaults.length; ++i) { + if (typeof object.defaults[i] !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: object expected"); + message.defaults[i] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fromObject(object.defaults[i]); + } + } + switch (object.minimumEdition) { default: - if (typeof object.ctype === "number") { - message.ctype = object.ctype; + if (typeof object.minimumEdition === "number") { + message.minimumEdition = object.minimumEdition; break; } break; - case "STRING": + case "EDITION_UNKNOWN": case 0: - message.ctype = 0; + message.minimumEdition = 0; break; - case "CORD": - case 1: - message.ctype = 1; + case "EDITION_LEGACY": + case 900: + message.minimumEdition = 900; break; - case "STRING_PIECE": - case 2: - message.ctype = 2; + case "EDITION_PROTO2": + case 998: + message.minimumEdition = 998; break; - } - if (object.packed != null) - message.packed = Boolean(object.packed); - switch (object.jstype) { - default: - if (typeof object.jstype === "number") { - message.jstype = object.jstype; - break; - } + case "EDITION_PROTO3": + case 999: + message.minimumEdition = 999; break; - case "JS_NORMAL": - case 0: - message.jstype = 0; + case "EDITION_2023": + case 1000: + message.minimumEdition = 1000; break; - case "JS_STRING": + case "EDITION_2024": + case 1001: + message.minimumEdition = 1001; + break; + case "EDITION_1_TEST_ONLY": case 1: - message.jstype = 1; + message.minimumEdition = 1; break; - case "JS_NUMBER": + case "EDITION_2_TEST_ONLY": case 2: - message.jstype = 2; + message.minimumEdition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.minimumEdition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.minimumEdition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.minimumEdition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.minimumEdition = 2147483647; break; } - if (object.lazy != null) - message.lazy = Boolean(object.lazy); - if (object.unverifiedLazy != null) - message.unverifiedLazy = Boolean(object.unverifiedLazy); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.weak != null) - message.weak = Boolean(object.weak); - if (object.debugRedact != null) - message.debugRedact = Boolean(object.debugRedact); - switch (object.retention) { + switch (object.maximumEdition) { default: - if (typeof object.retention === "number") { - message.retention = object.retention; + if (typeof object.maximumEdition === "number") { + message.maximumEdition = object.maximumEdition; break; } break; - case "RETENTION_UNKNOWN": + case "EDITION_UNKNOWN": case 0: - message.retention = 0; + message.maximumEdition = 0; break; - case "RETENTION_RUNTIME": + case "EDITION_LEGACY": + case 900: + message.maximumEdition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.maximumEdition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.maximumEdition = 999; + break; + case "EDITION_2023": + case 1000: + message.maximumEdition = 1000; + break; + case "EDITION_2024": + case 1001: + message.maximumEdition = 1001; + break; + case "EDITION_1_TEST_ONLY": case 1: - message.retention = 1; + message.maximumEdition = 1; break; - case "RETENTION_SOURCE": + case "EDITION_2_TEST_ONLY": case 2: - message.retention = 2; + message.maximumEdition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.maximumEdition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.maximumEdition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.maximumEdition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.maximumEdition = 2147483647; break; - } - if (object.targets) { - if (!Array.isArray(object.targets)) - throw TypeError(".google.protobuf.FieldOptions.targets: array expected"); - message.targets = []; - for (var i = 0; i < object.targets.length; ++i) - switch (object.targets[i]) { - default: - if (typeof object.targets[i] === "number") { - message.targets[i] = object.targets[i]; - break; - } - case "TARGET_TYPE_UNKNOWN": - case 0: - message.targets[i] = 0; - break; - case "TARGET_TYPE_FILE": - case 1: - message.targets[i] = 1; - break; - case "TARGET_TYPE_EXTENSION_RANGE": - case 2: - message.targets[i] = 2; - break; - case "TARGET_TYPE_MESSAGE": - case 3: - message.targets[i] = 3; - break; - case "TARGET_TYPE_FIELD": - case 4: - message.targets[i] = 4; - break; - case "TARGET_TYPE_ONEOF": - case 5: - message.targets[i] = 5; - break; - case "TARGET_TYPE_ENUM": - case 6: - message.targets[i] = 6; - break; - case "TARGET_TYPE_ENUM_ENTRY": - case 7: - message.targets[i] = 7; - break; - case "TARGET_TYPE_SERVICE": - case 8: - message.targets[i] = 8; - break; - case "TARGET_TYPE_METHOD": - case 9: - message.targets[i] = 9; - break; - } - } - if (object.editionDefaults) { - if (!Array.isArray(object.editionDefaults)) - throw TypeError(".google.protobuf.FieldOptions.editionDefaults: array expected"); - message.editionDefaults = []; - for (var i = 0; i < object.editionDefaults.length; ++i) { - if (typeof object.editionDefaults[i] !== "object") - throw TypeError(".google.protobuf.FieldOptions.editionDefaults: object expected"); - message.editionDefaults[i] = $root.google.protobuf.FieldOptions.EditionDefault.fromObject(object.editionDefaults[i]); - } - } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FieldOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object[".google.api.fieldBehavior"]) { - if (!Array.isArray(object[".google.api.fieldBehavior"])) - throw TypeError(".google.protobuf.FieldOptions..google.api.fieldBehavior: array expected"); - message[".google.api.fieldBehavior"] = []; - for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) - switch (object[".google.api.fieldBehavior"][i]) { - default: - if (typeof object[".google.api.fieldBehavior"][i] === "number") { - message[".google.api.fieldBehavior"][i] = object[".google.api.fieldBehavior"][i]; - break; - } - case "FIELD_BEHAVIOR_UNSPECIFIED": - case 0: - message[".google.api.fieldBehavior"][i] = 0; - break; - case "OPTIONAL": - case 1: - message[".google.api.fieldBehavior"][i] = 1; - break; - case "REQUIRED": - case 2: - message[".google.api.fieldBehavior"][i] = 2; - break; - case "OUTPUT_ONLY": - case 3: - message[".google.api.fieldBehavior"][i] = 3; - break; - case "INPUT_ONLY": - case 4: - message[".google.api.fieldBehavior"][i] = 4; - break; - case "IMMUTABLE": - case 5: - message[".google.api.fieldBehavior"][i] = 5; - break; - case "UNORDERED_LIST": - case 6: - message[".google.api.fieldBehavior"][i] = 6; - break; - case "NON_EMPTY_DEFAULT": - case 7: - message[".google.api.fieldBehavior"][i] = 7; - break; - case "IDENTIFIER": - case 8: - message[".google.api.fieldBehavior"][i] = 8; - break; - } - } - if (object[".google.api.resourceReference"] != null) { - if (typeof object[".google.api.resourceReference"] !== "object") - throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); - message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); } return message; }; /** - * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * Creates a plain object from a FeatureSetDefaults message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.FeatureSetDefaults * @static - * @param {google.protobuf.FieldOptions} message FieldOptions + * @param {google.protobuf.FeatureSetDefaults} message FeatureSetDefaults * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FieldOptions.toObject = function toObject(message, options) { + FeatureSetDefaults.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.targets = []; - object.editionDefaults = []; - object.uninterpretedOption = []; - object[".google.api.fieldBehavior"] = []; - } + if (options.arrays || options.defaults) + object.defaults = []; if (options.defaults) { - object.ctype = options.enums === String ? "STRING" : 0; - object.packed = false; - object.deprecated = false; - object.lazy = false; - object.jstype = options.enums === String ? "JS_NORMAL" : 0; - object.weak = false; - object.unverifiedLazy = false; - object.debugRedact = false; - object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; - object.features = null; - object[".google.api.resourceReference"] = null; - } - if (message.ctype != null && message.hasOwnProperty("ctype")) - object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; - if (message.packed != null && message.hasOwnProperty("packed")) - object.packed = message.packed; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.lazy != null && message.hasOwnProperty("lazy")) - object.lazy = message.lazy; - if (message.jstype != null && message.hasOwnProperty("jstype")) - object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] === undefined ? message.jstype : $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; - if (message.weak != null && message.hasOwnProperty("weak")) - object.weak = message.weak; - if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) - object.unverifiedLazy = message.unverifiedLazy; - if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) - object.debugRedact = message.debugRedact; - if (message.retention != null && message.hasOwnProperty("retention")) - object.retention = options.enums === String ? $root.google.protobuf.FieldOptions.OptionRetention[message.retention] === undefined ? message.retention : $root.google.protobuf.FieldOptions.OptionRetention[message.retention] : message.retention; - if (message.targets && message.targets.length) { - object.targets = []; - for (var j = 0; j < message.targets.length; ++j) - object.targets[j] = options.enums === String ? $root.google.protobuf.FieldOptions.OptionTargetType[message.targets[j]] === undefined ? message.targets[j] : $root.google.protobuf.FieldOptions.OptionTargetType[message.targets[j]] : message.targets[j]; - } - if (message.editionDefaults && message.editionDefaults.length) { - object.editionDefaults = []; - for (var j = 0; j < message.editionDefaults.length; ++j) - object.editionDefaults[j] = $root.google.protobuf.FieldOptions.EditionDefault.toObject(message.editionDefaults[j], options); - } - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + object.minimumEdition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.maximumEdition = options.enums === String ? "EDITION_UNKNOWN" : 0; } - if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { - object[".google.api.fieldBehavior"] = []; - for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) - object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] === undefined ? message[".google.api.fieldBehavior"][j] : $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; + if (message.defaults && message.defaults.length) { + object.defaults = []; + for (var j = 0; j < message.defaults.length; ++j) + object.defaults[j] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.toObject(message.defaults[j], options); } - if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) - object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); + if (message.minimumEdition != null && message.hasOwnProperty("minimumEdition")) + object.minimumEdition = options.enums === String ? $root.google.protobuf.Edition[message.minimumEdition] === undefined ? message.minimumEdition : $root.google.protobuf.Edition[message.minimumEdition] : message.minimumEdition; + if (message.maximumEdition != null && message.hasOwnProperty("maximumEdition")) + object.maximumEdition = options.enums === String ? $root.google.protobuf.Edition[message.maximumEdition] === undefined ? message.maximumEdition : $root.google.protobuf.Edition[message.maximumEdition] : message.maximumEdition; return object; }; /** - * Converts this FieldOptions to JSON. + * Converts this FeatureSetDefaults to JSON. * @function toJSON - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.FeatureSetDefaults * @instance * @returns {Object.} JSON object */ - FieldOptions.prototype.toJSON = function toJSON() { + FeatureSetDefaults.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for FieldOptions + * Gets the default type url for FeatureSetDefaults * @function getTypeUrl - * @memberof google.protobuf.FieldOptions + * @memberof google.protobuf.FeatureSetDefaults * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - FieldOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FeatureSetDefaults.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.FieldOptions"; + return typeUrlPrefix + "/google.protobuf.FeatureSetDefaults"; }; - /** - * CType enum. - * @name google.protobuf.FieldOptions.CType - * @enum {number} - * @property {number} STRING=0 STRING value - * @property {number} CORD=1 CORD value - * @property {number} STRING_PIECE=2 STRING_PIECE value - */ - FieldOptions.CType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STRING"] = 0; - values[valuesById[1] = "CORD"] = 1; - values[valuesById[2] = "STRING_PIECE"] = 2; - return values; - })(); - - /** - * JSType enum. - * @name google.protobuf.FieldOptions.JSType - * @enum {number} - * @property {number} JS_NORMAL=0 JS_NORMAL value - * @property {number} JS_STRING=1 JS_STRING value - * @property {number} JS_NUMBER=2 JS_NUMBER value - */ - FieldOptions.JSType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "JS_NORMAL"] = 0; - values[valuesById[1] = "JS_STRING"] = 1; - values[valuesById[2] = "JS_NUMBER"] = 2; - return values; - })(); - - /** - * OptionRetention enum. - * @name google.protobuf.FieldOptions.OptionRetention - * @enum {number} - * @property {number} RETENTION_UNKNOWN=0 RETENTION_UNKNOWN value - * @property {number} RETENTION_RUNTIME=1 RETENTION_RUNTIME value - * @property {number} RETENTION_SOURCE=2 RETENTION_SOURCE value - */ - FieldOptions.OptionRetention = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RETENTION_UNKNOWN"] = 0; - values[valuesById[1] = "RETENTION_RUNTIME"] = 1; - values[valuesById[2] = "RETENTION_SOURCE"] = 2; - return values; - })(); - - /** - * OptionTargetType enum. - * @name google.protobuf.FieldOptions.OptionTargetType - * @enum {number} - * @property {number} TARGET_TYPE_UNKNOWN=0 TARGET_TYPE_UNKNOWN value - * @property {number} TARGET_TYPE_FILE=1 TARGET_TYPE_FILE value - * @property {number} TARGET_TYPE_EXTENSION_RANGE=2 TARGET_TYPE_EXTENSION_RANGE value - * @property {number} TARGET_TYPE_MESSAGE=3 TARGET_TYPE_MESSAGE value - * @property {number} TARGET_TYPE_FIELD=4 TARGET_TYPE_FIELD value - * @property {number} TARGET_TYPE_ONEOF=5 TARGET_TYPE_ONEOF value - * @property {number} TARGET_TYPE_ENUM=6 TARGET_TYPE_ENUM value - * @property {number} TARGET_TYPE_ENUM_ENTRY=7 TARGET_TYPE_ENUM_ENTRY value - * @property {number} TARGET_TYPE_SERVICE=8 TARGET_TYPE_SERVICE value - * @property {number} TARGET_TYPE_METHOD=9 TARGET_TYPE_METHOD value - */ - FieldOptions.OptionTargetType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TARGET_TYPE_UNKNOWN"] = 0; - values[valuesById[1] = "TARGET_TYPE_FILE"] = 1; - values[valuesById[2] = "TARGET_TYPE_EXTENSION_RANGE"] = 2; - values[valuesById[3] = "TARGET_TYPE_MESSAGE"] = 3; - values[valuesById[4] = "TARGET_TYPE_FIELD"] = 4; - values[valuesById[5] = "TARGET_TYPE_ONEOF"] = 5; - values[valuesById[6] = "TARGET_TYPE_ENUM"] = 6; - values[valuesById[7] = "TARGET_TYPE_ENUM_ENTRY"] = 7; - values[valuesById[8] = "TARGET_TYPE_SERVICE"] = 8; - values[valuesById[9] = "TARGET_TYPE_METHOD"] = 9; - return values; - })(); - - FieldOptions.EditionDefault = (function() { + FeatureSetDefaults.FeatureSetEditionDefault = (function() { /** - * Properties of an EditionDefault. - * @memberof google.protobuf.FieldOptions - * @interface IEditionDefault - * @property {google.protobuf.Edition|null} [edition] EditionDefault edition - * @property {string|null} [value] EditionDefault value + * Properties of a FeatureSetEditionDefault. + * @memberof google.protobuf.FeatureSetDefaults + * @interface IFeatureSetEditionDefault + * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition + * @property {google.protobuf.IFeatureSet|null} [overridableFeatures] FeatureSetEditionDefault overridableFeatures + * @property {google.protobuf.IFeatureSet|null} [fixedFeatures] FeatureSetEditionDefault fixedFeatures */ /** - * Constructs a new EditionDefault. - * @memberof google.protobuf.FieldOptions - * @classdesc Represents an EditionDefault. - * @implements IEditionDefault + * Constructs a new FeatureSetEditionDefault. + * @memberof google.protobuf.FeatureSetDefaults + * @classdesc Represents a FeatureSetEditionDefault. + * @implements IFeatureSetEditionDefault * @constructor - * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault=} [properties] Properties to set */ - function EditionDefault(properties) { + function FeatureSetEditionDefault(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18839,80 +30317,90 @@ } /** - * EditionDefault edition. + * FeatureSetEditionDefault edition. * @member {google.protobuf.Edition} edition - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @instance */ - EditionDefault.prototype.edition = 0; + FeatureSetEditionDefault.prototype.edition = 0; /** - * EditionDefault value. - * @member {string} value - * @memberof google.protobuf.FieldOptions.EditionDefault + * FeatureSetEditionDefault overridableFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} overridableFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @instance */ - EditionDefault.prototype.value = ""; + FeatureSetEditionDefault.prototype.overridableFeatures = null; /** - * Creates a new EditionDefault instance using the specified properties. + * FeatureSetEditionDefault fixedFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} fixedFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.fixedFeatures = null; + + /** + * Creates a new FeatureSetEditionDefault instance using the specified properties. * @function create - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @static - * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault instance + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault=} [properties] Properties to set + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault instance */ - EditionDefault.create = function create(properties) { - return new EditionDefault(properties); + FeatureSetEditionDefault.create = function create(properties) { + return new FeatureSetEditionDefault(properties); }; /** - * Encodes the specified EditionDefault message. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * Encodes the specified FeatureSetEditionDefault message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. * @function encode - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @static - * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault} message FeatureSetEditionDefault message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EditionDefault.encode = function encode(message, writer) { + FeatureSetEditionDefault.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** - * Encodes the specified EditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * Encodes the specified FeatureSetEditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @static - * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault} message FeatureSetEditionDefault message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EditionDefault.encodeDelimited = function encodeDelimited(message, writer) { + FeatureSetEditionDefault.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EditionDefault message from the specified reader or buffer. + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EditionDefault.decode = function decode(reader, length, error) { + FeatureSetEditionDefault.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.EditionDefault(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) @@ -18922,8 +30410,12 @@ message.edition = reader.int32(); break; } - case 2: { - message.value = reader.string(); + case 4: { + message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 5: { + message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } default: @@ -18935,30 +30427,30 @@ }; /** - * Decodes an EditionDefault message from the specified reader or buffer, length delimited. + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EditionDefault.decodeDelimited = function decodeDelimited(reader) { + FeatureSetEditionDefault.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EditionDefault message. + * Verifies a FeatureSetEditionDefault message. * @function verify - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EditionDefault.verify = function verify(message) { + FeatureSetEditionDefault.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.edition != null && message.hasOwnProperty("edition")) @@ -18966,6 +30458,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -18978,24 +30471,31 @@ case 2147483647: break; } - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures); + if (error) + return "overridableFeatures." + error; + } + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures); + if (error) + return "fixedFeatures." + error; + } return null; }; /** - * Creates an EditionDefault message from a plain object. Also converts values to their respective internal types. + * Creates a FeatureSetEditionDefault message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault */ - EditionDefault.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldOptions.EditionDefault) + FeatureSetEditionDefault.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) return object; - var message = new $root.google.protobuf.FieldOptions.EditionDefault(); + var message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); switch (object.edition) { default: if (typeof object.edition === "number") { @@ -19007,6 +30507,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -19048,87 +30552,97 @@ message.edition = 2147483647; break; } - if (object.value != null) - message.value = String(object.value); + if (object.overridableFeatures != null) { + if (typeof object.overridableFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); + message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures); + } + if (object.fixedFeatures != null) { + if (typeof object.fixedFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); + message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures); + } return message; }; /** - * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * Creates a plain object from a FeatureSetEditionDefault message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @static - * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} message FeatureSetEditionDefault * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EditionDefault.toObject = function toObject(message, options) { + FeatureSetEditionDefault.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.value = ""; object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.overridableFeatures = null; + object.fixedFeatures = null; } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) + object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options); + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) + object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options); return object; }; /** - * Converts this EditionDefault to JSON. + * Converts this FeatureSetEditionDefault to JSON. * @function toJSON - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @instance * @returns {Object.} JSON object */ - EditionDefault.prototype.toJSON = function toJSON() { + FeatureSetEditionDefault.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for EditionDefault + * Gets the default type url for FeatureSetEditionDefault * @function getTypeUrl - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FeatureSetEditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + return typeUrlPrefix + "/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"; }; - return EditionDefault; + return FeatureSetEditionDefault; })(); - return FieldOptions; + return FeatureSetDefaults; })(); - protobuf.OneofOptions = (function() { + protobuf.SourceCodeInfo = (function() { /** - * Properties of an OneofOptions. + * Properties of a SourceCodeInfo. * @memberof google.protobuf - * @interface IOneofOptions - * @property {google.protobuf.IFeatureSet|null} [features] OneofOptions features - * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption + * @interface ISourceCodeInfo + * @property {Array.|null} [location] SourceCodeInfo location */ /** - * Constructs a new OneofOptions. + * Constructs a new SourceCodeInfo. * @memberof google.protobuf - * @classdesc Represents an OneofOptions. - * @implements IOneofOptions + * @classdesc Represents a SourceCodeInfo. + * @implements ISourceCodeInfo * @constructor - * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set */ - function OneofOptions(properties) { - this.uninterpretedOption = []; + function SourceCodeInfo(properties) { + this.location = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19136,94 +30650,80 @@ } /** - * OneofOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.OneofOptions - * @instance - */ - OneofOptions.prototype.features = null; - - /** - * OneofOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.OneofOptions + * SourceCodeInfo location. + * @member {Array.} location + * @memberof google.protobuf.SourceCodeInfo * @instance */ - OneofOptions.prototype.uninterpretedOption = $util.emptyArray; + SourceCodeInfo.prototype.location = $util.emptyArray; /** - * Creates a new OneofOptions instance using the specified properties. + * Creates a new SourceCodeInfo instance using the specified properties. * @function create - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.SourceCodeInfo * @static - * @param {google.protobuf.IOneofOptions=} [properties] Properties to set - * @returns {google.protobuf.OneofOptions} OneofOptions instance + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance */ - OneofOptions.create = function create(properties) { - return new OneofOptions(properties); + SourceCodeInfo.create = function create(properties) { + return new SourceCodeInfo(properties); }; /** - * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. * @function encode - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.SourceCodeInfo * @static - * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OneofOptions.encode = function encode(message, writer) { + SourceCodeInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message.location != null && message.location.length) + for (var i = 0; i < message.location.length; ++i) + $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.SourceCodeInfo * @static - * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OneofOptions message from the specified reader or buffer. + * Decodes a SourceCodeInfo message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.SourceCodeInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.OneofOptions} OneofOptions + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OneofOptions.decode = function decode(reader, length, error) { + SourceCodeInfo.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); break; } default: @@ -19235,482 +30735,504 @@ }; /** - * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.SourceCodeInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.OneofOptions} OneofOptions + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OneofOptions.decodeDelimited = function decodeDelimited(reader) { + SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OneofOptions message. + * Verifies a SourceCodeInfo message. * @function verify - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.SourceCodeInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OneofOptions.verify = function verify(message) { + SourceCodeInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (message.location != null && message.hasOwnProperty("location")) { + if (!Array.isArray(message.location)) + return "location: array expected"; + for (var i = 0; i < message.location.length; ++i) { + var error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i]); if (error) - return "uninterpretedOption." + error; + return "location." + error; } } return null; }; /** - * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.SourceCodeInfo * @static * @param {Object.} object Plain object - * @returns {google.protobuf.OneofOptions} OneofOptions + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo */ - OneofOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.OneofOptions) + SourceCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo) return object; - var message = new $root.google.protobuf.OneofOptions(); - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.OneofOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + var message = new $root.google.protobuf.SourceCodeInfo(); + if (object.location) { + if (!Array.isArray(object.location)) + throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); + message.location = []; + for (var i = 0; i < object.location.length; ++i) { + if (typeof object.location[i] !== "object") + throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); + message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i]); } } return message; }; /** - * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.SourceCodeInfo * @static - * @param {google.protobuf.OneofOptions} message OneofOptions + * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OneofOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (options.defaults) - object.features = null; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + * @returns {Object.} Plain object + */ + SourceCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.location = []; + if (message.location && message.location.length) { + object.location = []; + for (var j = 0; j < message.location.length; ++j) + object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options); } return object; }; /** - * Converts this OneofOptions to JSON. + * Converts this SourceCodeInfo to JSON. * @function toJSON - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.SourceCodeInfo * @instance * @returns {Object.} JSON object */ - OneofOptions.prototype.toJSON = function toJSON() { + SourceCodeInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for OneofOptions + * Gets the default type url for SourceCodeInfo * @function getTypeUrl - * @memberof google.protobuf.OneofOptions + * @memberof google.protobuf.SourceCodeInfo * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - OneofOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + SourceCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.OneofOptions"; + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo"; }; - return OneofOptions; - })(); - - protobuf.EnumOptions = (function() { + SourceCodeInfo.Location = (function() { - /** - * Properties of an EnumOptions. - * @memberof google.protobuf - * @interface IEnumOptions - * @property {boolean|null} [allowAlias] EnumOptions allowAlias - * @property {boolean|null} [deprecated] EnumOptions deprecated - * @property {boolean|null} [deprecatedLegacyJsonFieldConflicts] EnumOptions deprecatedLegacyJsonFieldConflicts - * @property {google.protobuf.IFeatureSet|null} [features] EnumOptions features - * @property {Array.|null} [uninterpretedOption] EnumOptions uninterpretedOption - */ + /** + * Properties of a Location. + * @memberof google.protobuf.SourceCodeInfo + * @interface ILocation + * @property {Array.|null} [path] Location path + * @property {Array.|null} [span] Location span + * @property {string|null} [leadingComments] Location leadingComments + * @property {string|null} [trailingComments] Location trailingComments + * @property {Array.|null} [leadingDetachedComments] Location leadingDetachedComments + */ - /** - * Constructs a new EnumOptions. - * @memberof google.protobuf - * @classdesc Represents an EnumOptions. - * @implements IEnumOptions - * @constructor - * @param {google.protobuf.IEnumOptions=} [properties] Properties to set - */ - function EnumOptions(properties) { - this.uninterpretedOption = []; - 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]]; - } + /** + * Constructs a new Location. + * @memberof google.protobuf.SourceCodeInfo + * @classdesc Represents a Location. + * @implements ILocation + * @constructor + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + */ + function Location(properties) { + this.path = []; + this.span = []; + this.leadingDetachedComments = []; + 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]]; + } - /** - * EnumOptions allowAlias. - * @member {boolean} allowAlias - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.allowAlias = false; + /** + * Location path. + * @member {Array.} path + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.path = $util.emptyArray; - /** - * EnumOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.deprecated = false; + /** + * Location span. + * @member {Array.} span + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.span = $util.emptyArray; - /** - * EnumOptions deprecatedLegacyJsonFieldConflicts. - * @member {boolean} deprecatedLegacyJsonFieldConflicts - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.deprecatedLegacyJsonFieldConflicts = false; + /** + * Location leadingComments. + * @member {string} leadingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingComments = ""; - /** - * EnumOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.features = null; + /** + * Location trailingComments. + * @member {string} trailingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.trailingComments = ""; - /** - * EnumOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.uninterpretedOption = $util.emptyArray; + /** + * Location leadingDetachedComments. + * @member {Array.} leadingDetachedComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingDetachedComments = $util.emptyArray; - /** - * Creates a new EnumOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.IEnumOptions=} [properties] Properties to set - * @returns {google.protobuf.EnumOptions} EnumOptions instance - */ - EnumOptions.create = function create(properties) { - return new EnumOptions(properties); - }; + /** + * Creates a new Location instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo.Location} Location instance + */ + Location.create = function create(properties) { + return new Location(properties); + }; - /** - * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.deprecatedLegacyJsonFieldConflicts); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - return writer; - }; + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.span != null && message.span.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.span.length; ++i) + writer.int32(message.span[i]); + writer.ldelim(); + } + if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); + if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailingComments); + if (message.leadingDetachedComments != null && message.leadingDetachedComments.length) + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.leadingDetachedComments[i]); + return writer; + }; - /** - * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes an EnumOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumOptions} EnumOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 2: { - message.allowAlias = reader.bool(); - break; - } - case 3: { - message.deprecated = reader.bool(); - break; - } - case 6: { - message.deprecatedLegacyJsonFieldConflicts = reader.bool(); - break; - } - case 7: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + /** + * Decodes a Location message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + switch (tag >>> 3) { + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + } + case 2: { + if (!(message.span && message.span.length)) + message.span = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.span.push(reader.int32()); + } else + message.span.push(reader.int32()); + break; + } + case 3: { + message.leadingComments = reader.string(); + break; + } + case 4: { + message.trailingComments = reader.string(); + break; + } + case 6: { + if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) + message.leadingDetachedComments = []; + message.leadingDetachedComments.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); break; } - default: - reader.skipType(tag & 7); - break; } - } - return message; - }; + return message; + }; - /** - * Decodes an EnumOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumOptions} EnumOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies an EnumOptions message. - * @function verify - * @memberof google.protobuf.EnumOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) - if (typeof message.allowAlias !== "boolean") - return "allowAlias: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) - if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") - return "deprecatedLegacyJsonFieldConflicts: boolean expected"; - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; + /** + * Verifies a Location message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Location.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.span != null && message.hasOwnProperty("span")) { + if (!Array.isArray(message.span)) + return "span: array expected"; + for (var i = 0; i < message.span.length; ++i) + if (!$util.isInteger(message.span[i])) + return "span: integer[] expected"; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + if (!$util.isString(message.leadingComments)) + return "leadingComments: string expected"; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + if (!$util.isString(message.trailingComments)) + return "trailingComments: string expected"; + if (message.leadingDetachedComments != null && message.hasOwnProperty("leadingDetachedComments")) { + if (!Array.isArray(message.leadingDetachedComments)) + return "leadingDetachedComments: array expected"; + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + if (!$util.isString(message.leadingDetachedComments[i])) + return "leadingDetachedComments: string[] expected"; + } + return null; + }; + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo.Location} Location + */ + Location.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) + return object; + var message = new $root.google.protobuf.SourceCodeInfo.Location(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.span) { + if (!Array.isArray(object.span)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); + message.span = []; + for (var i = 0; i < object.span.length; ++i) + message.span[i] = object.span[i] | 0; + } + if (object.leadingComments != null) + message.leadingComments = String(object.leadingComments); + if (object.trailingComments != null) + message.trailingComments = String(object.trailingComments); + if (object.leadingDetachedComments) { + if (!Array.isArray(object.leadingDetachedComments)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.leadingDetachedComments: array expected"); + message.leadingDetachedComments = []; + for (var i = 0; i < object.leadingDetachedComments.length; ++i) + message.leadingDetachedComments[i] = String(object.leadingDetachedComments[i]); + } + return message; + }; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.Location} message Location + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Location.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.path = []; + object.span = []; + object.leadingDetachedComments = []; } - } - return null; - }; - - /** - * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumOptions} EnumOptions - */ - EnumOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumOptions) - return object; - var message = new $root.google.protobuf.EnumOptions(); - if (object.allowAlias != null) - message.allowAlias = Boolean(object.allowAlias); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.deprecatedLegacyJsonFieldConflicts != null) - message.deprecatedLegacyJsonFieldConflicts = Boolean(object.deprecatedLegacyJsonFieldConflicts); - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.EnumOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + if (options.defaults) { + object.leadingComments = ""; + object.trailingComments = ""; } - } - return message; - }; + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.span && message.span.length) { + object.span = []; + for (var j = 0; j < message.span.length; ++j) + object.span[j] = message.span[j]; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + object.leadingComments = message.leadingComments; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + object.trailingComments = message.trailingComments; + if (message.leadingDetachedComments && message.leadingDetachedComments.length) { + object.leadingDetachedComments = []; + for (var j = 0; j < message.leadingDetachedComments.length; ++j) + object.leadingDetachedComments[j] = message.leadingDetachedComments[j]; + } + return object; + }; - /** - * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.EnumOptions} message EnumOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (options.defaults) { - object.allowAlias = false; - object.deprecated = false; - object.deprecatedLegacyJsonFieldConflicts = false; - object.features = null; - } - if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) - object.allowAlias = message.allowAlias; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) - object.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - return object; - }; + /** + * Converts this Location to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + * @returns {Object.} JSON object + */ + Location.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this EnumOptions to JSON. - * @function toJSON - * @memberof google.protobuf.EnumOptions - * @instance - * @returns {Object.} JSON object - */ - EnumOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Gets the default type url for Location + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Location.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo.Location"; + }; - /** - * Gets the default type url for EnumOptions - * @function getTypeUrl - * @memberof google.protobuf.EnumOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EnumOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.EnumOptions"; - }; + return Location; + })(); - return EnumOptions; + return SourceCodeInfo; })(); - protobuf.EnumValueOptions = (function() { + protobuf.GeneratedCodeInfo = (function() { /** - * Properties of an EnumValueOptions. + * Properties of a GeneratedCodeInfo. * @memberof google.protobuf - * @interface IEnumValueOptions - * @property {boolean|null} [deprecated] EnumValueOptions deprecated - * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features - * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact - * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption + * @interface IGeneratedCodeInfo + * @property {Array.|null} [annotation] GeneratedCodeInfo annotation */ /** - * Constructs a new EnumValueOptions. + * Constructs a new GeneratedCodeInfo. * @memberof google.protobuf - * @classdesc Represents an EnumValueOptions. - * @implements IEnumValueOptions + * @classdesc Represents a GeneratedCodeInfo. + * @implements IGeneratedCodeInfo * @constructor - * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set */ - function EnumValueOptions(properties) { - this.uninterpretedOption = []; + function GeneratedCodeInfo(properties) { + this.annotation = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -19718,122 +31240,80 @@ } /** - * EnumValueOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype.deprecated = false; - - /** - * EnumValueOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype.features = null; - - /** - * EnumValueOptions debugRedact. - * @member {boolean} debugRedact - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype.debugRedact = false; - - /** - * EnumValueOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.EnumValueOptions + * GeneratedCodeInfo annotation. + * @member {Array.} annotation + * @memberof google.protobuf.GeneratedCodeInfo * @instance */ - EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; + GeneratedCodeInfo.prototype.annotation = $util.emptyArray; /** - * Creates a new EnumValueOptions instance using the specified properties. + * Creates a new GeneratedCodeInfo instance using the specified properties. * @function create - * @memberof google.protobuf.EnumValueOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static - * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance */ - EnumValueOptions.create = function create(properties) { - return new EnumValueOptions(properties); + GeneratedCodeInfo.create = function create(properties) { + return new GeneratedCodeInfo(properties); }; /** - * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. * @function encode - * @memberof google.protobuf.EnumValueOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static - * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumValueOptions.encode = function encode(message, writer) { + GeneratedCodeInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message.annotation != null && message.annotation.length) + for (var i = 0; i < message.annotation.length; ++i) + $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.EnumValueOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static - * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { + GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EnumValueOptions message from the specified reader or buffer. + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.EnumValueOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnumValueOptions.decode = function decode(reader, length, error) { + GeneratedCodeInfo.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - message.deprecated = reader.bool(); - break; - } - case 2: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 3: { - message.debugRedact = reader.bool(); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + if (!(message.annotation && message.annotation.length)) + message.annotation = []; + message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); break; } default: @@ -19845,525 +31325,519 @@ }; /** - * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.EnumValueOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { + GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EnumValueOptions message. + * Verifies a GeneratedCodeInfo message. * @function verify - * @memberof google.protobuf.EnumValueOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EnumValueOptions.verify = function verify(message) { + GeneratedCodeInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) - if (typeof message.debugRedact !== "boolean") - return "debugRedact: boolean expected"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (message.annotation != null && message.hasOwnProperty("annotation")) { + if (!Array.isArray(message.annotation)) + return "annotation: array expected"; + for (var i = 0; i < message.annotation.length; ++i) { + var error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i]); if (error) - return "uninterpretedOption." + error; + return "annotation." + error; } } return null; }; /** - * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.EnumValueOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static * @param {Object.} object Plain object - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo */ - EnumValueOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumValueOptions) + GeneratedCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo) return object; - var message = new $root.google.protobuf.EnumValueOptions(); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.EnumValueOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.debugRedact != null) - message.debugRedact = Boolean(object.debugRedact); - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + var message = new $root.google.protobuf.GeneratedCodeInfo(); + if (object.annotation) { + if (!Array.isArray(object.annotation)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); + message.annotation = []; + for (var i = 0; i < object.annotation.length; ++i) { + if (typeof object.annotation[i] !== "object") + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); + message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i]); } } return message; }; /** - * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.EnumValueOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static - * @param {google.protobuf.EnumValueOptions} message EnumValueOptions + * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EnumValueOptions.toObject = function toObject(message, options) { + GeneratedCodeInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (options.defaults) { - object.deprecated = false; - object.features = null; - object.debugRedact = false; - } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) - object.debugRedact = message.debugRedact; - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + object.annotation = []; + if (message.annotation && message.annotation.length) { + object.annotation = []; + for (var j = 0; j < message.annotation.length; ++j) + object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options); } return object; }; /** - * Converts this EnumValueOptions to JSON. + * Converts this GeneratedCodeInfo to JSON. * @function toJSON - * @memberof google.protobuf.EnumValueOptions + * @memberof google.protobuf.GeneratedCodeInfo * @instance * @returns {Object.} JSON object */ - EnumValueOptions.prototype.toJSON = function toJSON() { + GeneratedCodeInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for EnumValueOptions + * Gets the default type url for GeneratedCodeInfo * @function getTypeUrl - * @memberof google.protobuf.EnumValueOptions + * @memberof google.protobuf.GeneratedCodeInfo * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - EnumValueOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + GeneratedCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.EnumValueOptions"; + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo"; }; - return EnumValueOptions; - })(); - - protobuf.ServiceOptions = (function() { - - /** - * Properties of a ServiceOptions. - * @memberof google.protobuf - * @interface IServiceOptions - * @property {google.protobuf.IFeatureSet|null} [features] ServiceOptions features - * @property {boolean|null} [deprecated] ServiceOptions deprecated - * @property {Array.|null} [uninterpretedOption] ServiceOptions uninterpretedOption - * @property {string|null} [".google.api.defaultHost"] ServiceOptions .google.api.defaultHost - * @property {string|null} [".google.api.oauthScopes"] ServiceOptions .google.api.oauthScopes - * @property {string|null} [".google.api.apiVersion"] ServiceOptions .google.api.apiVersion - */ - - /** - * Constructs a new ServiceOptions. - * @memberof google.protobuf - * @classdesc Represents a ServiceOptions. - * @implements IServiceOptions - * @constructor - * @param {google.protobuf.IServiceOptions=} [properties] Properties to set - */ - function ServiceOptions(properties) { - this.uninterpretedOption = []; - 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]]; - } + GeneratedCodeInfo.Annotation = (function() { - /** - * ServiceOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype.features = null; + /** + * Properties of an Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @interface IAnnotation + * @property {Array.|null} [path] Annotation path + * @property {string|null} [sourceFile] Annotation sourceFile + * @property {number|null} [begin] Annotation begin + * @property {number|null} [end] Annotation end + * @property {google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null} [semantic] Annotation semantic + */ - /** - * ServiceOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype.deprecated = false; + /** + * Constructs a new Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @classdesc Represents an Annotation. + * @implements IAnnotation + * @constructor + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + */ + function Annotation(properties) { + this.path = []; + 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]]; + } - /** - * ServiceOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; + /** + * Annotation path. + * @member {Array.} path + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.path = $util.emptyArray; - /** - * ServiceOptions .google.api.defaultHost. - * @member {string} .google.api.defaultHost - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype[".google.api.defaultHost"] = ""; + /** + * Annotation sourceFile. + * @member {string} sourceFile + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.sourceFile = ""; - /** - * ServiceOptions .google.api.oauthScopes. - * @member {string} .google.api.oauthScopes - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype[".google.api.oauthScopes"] = ""; + /** + * Annotation begin. + * @member {number} begin + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.begin = 0; - /** - * ServiceOptions .google.api.apiVersion. - * @member {string} .google.api.apiVersion - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype[".google.api.apiVersion"] = ""; + /** + * Annotation end. + * @member {number} end + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.end = 0; - /** - * Creates a new ServiceOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.IServiceOptions=} [properties] Properties to set - * @returns {google.protobuf.ServiceOptions} ServiceOptions instance - */ - ServiceOptions.create = function create(properties) { - return new ServiceOptions(properties); - }; + /** + * Annotation semantic. + * @member {google.protobuf.GeneratedCodeInfo.Annotation.Semantic} semantic + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.semantic = 0; - /** - * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ServiceOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) - writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); - if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) - writer.uint32(/* id 1050, wireType 2 =*/8402).string(message[".google.api.oauthScopes"]); - if (message[".google.api.apiVersion"] != null && Object.hasOwnProperty.call(message, ".google.api.apiVersion")) - writer.uint32(/* id 525000001, wireType 2 =*/4200000010).string(message[".google.api.apiVersion"]); - return writer; - }; + /** + * Creates a new Annotation instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation instance + */ + Annotation.create = function create(properties) { + return new Annotation(properties); + }; - /** - * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); + if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); + if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.semantic); + return writer; + }; - /** - * Decodes a ServiceOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.ServiceOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ServiceOptions} ServiceOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ServiceOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 34: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 33: { - message.deprecated = reader.bool(); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) break; - } - case 1049: { - message[".google.api.defaultHost"] = reader.string(); + switch (tag >>> 3) { + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + } + case 2: { + message.sourceFile = reader.string(); + break; + } + case 3: { + message.begin = reader.int32(); + break; + } + case 4: { + message.end = reader.int32(); + break; + } + case 5: { + message.semantic = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); break; } - case 1050: { - message[".google.api.oauthScopes"] = reader.string(); + } + return message; + }; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Annotation message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Annotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + if (!$util.isString(message.sourceFile)) + return "sourceFile: string expected"; + if (message.begin != null && message.hasOwnProperty("begin")) + if (!$util.isInteger(message.begin)) + return "begin: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.semantic != null && message.hasOwnProperty("semantic")) + switch (message.semantic) { + default: + return "semantic: enum value expected"; + case 0: + case 1: + case 2: break; } - case 525000001: { - message[".google.api.apiVersion"] = reader.string(); + return null; + }; + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + */ + Annotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.sourceFile != null) + message.sourceFile = String(object.sourceFile); + if (object.begin != null) + message.begin = object.begin | 0; + if (object.end != null) + message.end = object.end | 0; + switch (object.semantic) { + default: + if (typeof object.semantic === "number") { + message.semantic = object.semantic; break; } - default: - reader.skipType(tag & 7); + break; + case "NONE": + case 0: + message.semantic = 0; + break; + case "SET": + case 1: + message.semantic = 1; + break; + case "ALIAS": + case 2: + message.semantic = 2; break; } - } - return message; - }; - - /** - * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.ServiceOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ServiceOptions} ServiceOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ServiceOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + return message; + }; - /** - * Verifies a ServiceOptions message. - * @function verify - * @memberof google.protobuf.ServiceOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ServiceOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.Annotation} message Annotation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Annotation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.path = []; + if (options.defaults) { + object.sourceFile = ""; + object.begin = 0; + object.end = 0; + object.semantic = options.enums === String ? "NONE" : 0; } - } - if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) - if (!$util.isString(message[".google.api.defaultHost"])) - return ".google.api.defaultHost: string expected"; - if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) - if (!$util.isString(message[".google.api.oauthScopes"])) - return ".google.api.oauthScopes: string expected"; - if (message[".google.api.apiVersion"] != null && message.hasOwnProperty(".google.api.apiVersion")) - if (!$util.isString(message[".google.api.apiVersion"])) - return ".google.api.apiVersion: string expected"; - return null; - }; - - /** - * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.ServiceOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.ServiceOptions} ServiceOptions - */ - ServiceOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ServiceOptions) + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + object.sourceFile = message.sourceFile; + if (message.begin != null && message.hasOwnProperty("begin")) + object.begin = message.begin; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + if (message.semantic != null && message.hasOwnProperty("semantic")) + object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] === undefined ? message.semantic : $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; return object; - var message = new $root.google.protobuf.ServiceOptions(); - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.ServiceOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + }; + + /** + * Converts this Annotation to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + * @returns {Object.} JSON object + */ + Annotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Annotation + * @function getTypeUrl + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Annotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } - } - if (object[".google.api.defaultHost"] != null) - message[".google.api.defaultHost"] = String(object[".google.api.defaultHost"]); - if (object[".google.api.oauthScopes"] != null) - message[".google.api.oauthScopes"] = String(object[".google.api.oauthScopes"]); - if (object[".google.api.apiVersion"] != null) - message[".google.api.apiVersion"] = String(object[".google.api.apiVersion"]); - return message; - }; + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo.Annotation"; + }; - /** - * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.ServiceOptions} message ServiceOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ServiceOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (options.defaults) { - object.deprecated = false; - object.features = null; - object[".google.api.defaultHost"] = ""; - object[".google.api.oauthScopes"] = ""; - object[".google.api.apiVersion"] = ""; - } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) - object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; - if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) - object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; - if (message[".google.api.apiVersion"] != null && message.hasOwnProperty(".google.api.apiVersion")) - object[".google.api.apiVersion"] = message[".google.api.apiVersion"]; - return object; - }; + /** + * Semantic enum. + * @name google.protobuf.GeneratedCodeInfo.Annotation.Semantic + * @enum {number} + * @property {number} NONE=0 NONE value + * @property {number} SET=1 SET value + * @property {number} ALIAS=2 ALIAS value + */ + Annotation.Semantic = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NONE"] = 0; + values[valuesById[1] = "SET"] = 1; + values[valuesById[2] = "ALIAS"] = 2; + return values; + })(); - /** - * Converts this ServiceOptions to JSON. - * @function toJSON - * @memberof google.protobuf.ServiceOptions - * @instance - * @returns {Object.} JSON object - */ - ServiceOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + return Annotation; + })(); - /** - * Gets the default type url for ServiceOptions - * @function getTypeUrl - * @memberof google.protobuf.ServiceOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ServiceOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.ServiceOptions"; - }; + return GeneratedCodeInfo; + })(); - return ServiceOptions; + /** + * SymbolVisibility enum. + * @name google.protobuf.SymbolVisibility + * @enum {number} + * @property {number} VISIBILITY_UNSET=0 VISIBILITY_UNSET value + * @property {number} VISIBILITY_LOCAL=1 VISIBILITY_LOCAL value + * @property {number} VISIBILITY_EXPORT=2 VISIBILITY_EXPORT value + */ + protobuf.SymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VISIBILITY_UNSET"] = 0; + values[valuesById[1] = "VISIBILITY_LOCAL"] = 1; + values[valuesById[2] = "VISIBILITY_EXPORT"] = 2; + return values; })(); - protobuf.MethodOptions = (function() { + protobuf.Duration = (function() { /** - * Properties of a MethodOptions. + * Properties of a Duration. * @memberof google.protobuf - * @interface IMethodOptions - * @property {boolean|null} [deprecated] MethodOptions deprecated - * @property {google.protobuf.MethodOptions.IdempotencyLevel|null} [idempotencyLevel] MethodOptions idempotencyLevel - * @property {google.protobuf.IFeatureSet|null} [features] MethodOptions features - * @property {Array.|null} [uninterpretedOption] MethodOptions uninterpretedOption - * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http - * @property {Array.|null} [".google.api.methodSignature"] MethodOptions .google.api.methodSignature + * @interface IDuration + * @property {number|Long|null} [seconds] Duration seconds + * @property {number|null} [nanos] Duration nanos */ /** - * Constructs a new MethodOptions. + * Constructs a new Duration. * @memberof google.protobuf - * @classdesc Represents a MethodOptions. - * @implements IMethodOptions + * @classdesc Represents a Duration. + * @implements IDuration * @constructor - * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + * @param {google.protobuf.IDuration=} [properties] Properties to set */ - function MethodOptions(properties) { - this.uninterpretedOption = []; - this[".google.api.methodSignature"] = []; + function Duration(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20371,153 +31845,91 @@ } /** - * MethodOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.deprecated = false; - - /** - * MethodOptions idempotencyLevel. - * @member {google.protobuf.MethodOptions.IdempotencyLevel} idempotencyLevel - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.idempotencyLevel = 0; - - /** - * MethodOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.features = null; - - /** - * MethodOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * MethodOptions .google.api.http. - * @member {google.api.IHttpRule|null|undefined} .google.api.http - * @memberof google.protobuf.MethodOptions + * Duration seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Duration * @instance */ - MethodOptions.prototype[".google.api.http"] = null; + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * MethodOptions .google.api.methodSignature. - * @member {Array.} .google.api.methodSignature - * @memberof google.protobuf.MethodOptions + * Duration nanos. + * @member {number} nanos + * @memberof google.protobuf.Duration * @instance */ - MethodOptions.prototype[".google.api.methodSignature"] = $util.emptyArray; + Duration.prototype.nanos = 0; /** - * Creates a new MethodOptions instance using the specified properties. + * Creates a new Duration instance using the specified properties. * @function create - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.IMethodOptions=} [properties] Properties to set - * @returns {google.protobuf.MethodOptions} MethodOptions instance + * @param {google.protobuf.IDuration=} [properties] Properties to set + * @returns {google.protobuf.Duration} Duration instance */ - MethodOptions.create = function create(properties) { - return new MethodOptions(properties); + Duration.create = function create(properties) { + return new Duration(properties); }; /** - * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. * @function encode - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {google.protobuf.IDuration} message Duration message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MethodOptions.encode = function encode(message, writer) { + Duration.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); - if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) - writer.uint32(/* id 34, wireType 0 =*/272).int32(message.idempotencyLevel); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.methodSignature"] != null && message[".google.api.methodSignature"].length) - for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) - writer.uint32(/* id 1051, wireType 2 =*/8410).string(message[".google.api.methodSignature"][i]); - if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) - $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); return writer; }; /** - * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {google.protobuf.IDuration} message Duration message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { + Duration.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a MethodOptions message from the specified reader or buffer. + * Decodes a Duration message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.Duration * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MethodOptions} MethodOptions + * @returns {google.protobuf.Duration} Duration * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MethodOptions.decode = function decode(reader, length, error) { + Duration.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { - case 33: { - message.deprecated = reader.bool(); - break; - } - case 34: { - message.idempotencyLevel = reader.int32(); - break; - } - case 35: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 72295728: { - message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); + case 1: { + message.seconds = reader.int64(); break; } - case 1051: { - if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) - message[".google.api.methodSignature"] = []; - message[".google.api.methodSignature"].push(reader.string()); + case 2: { + message.nanos = reader.int32(); break; } default: @@ -20529,251 +31941,146 @@ }; /** - * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * Decodes a Duration message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.Duration * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MethodOptions} MethodOptions + * @returns {google.protobuf.Duration} Duration * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - MethodOptions.decodeDelimited = function decodeDelimited(reader) { + Duration.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a MethodOptions message. - * @function verify - * @memberof google.protobuf.MethodOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MethodOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) - switch (message.idempotencyLevel) { - default: - return "idempotencyLevel: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) { - var error = $root.google.api.HttpRule.verify(message[".google.api.http"]); - if (error) - return ".google.api.http." + error; - } - if (message[".google.api.methodSignature"] != null && message.hasOwnProperty(".google.api.methodSignature")) { - if (!Array.isArray(message[".google.api.methodSignature"])) - return ".google.api.methodSignature: array expected"; - for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) - if (!$util.isString(message[".google.api.methodSignature"][i])) - return ".google.api.methodSignature: string[] expected"; - } + * Verifies a Duration message. + * @function verify + * @memberof google.protobuf.Duration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Duration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; return null; }; /** - * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * Creates a Duration message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.Duration * @static * @param {Object.} object Plain object - * @returns {google.protobuf.MethodOptions} MethodOptions + * @returns {google.protobuf.Duration} Duration */ - MethodOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MethodOptions) + Duration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Duration) return object; - var message = new $root.google.protobuf.MethodOptions(); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - switch (object.idempotencyLevel) { - default: - if (typeof object.idempotencyLevel === "number") { - message.idempotencyLevel = object.idempotencyLevel; - break; - } - break; - case "IDEMPOTENCY_UNKNOWN": - case 0: - message.idempotencyLevel = 0; - break; - case "NO_SIDE_EFFECTS": - case 1: - message.idempotencyLevel = 1; - break; - case "IDEMPOTENT": - case 2: - message.idempotencyLevel = 2; - break; - } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.MethodOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object[".google.api.http"] != null) { - if (typeof object[".google.api.http"] !== "object") - throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); - message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"]); - } - if (object[".google.api.methodSignature"]) { - if (!Array.isArray(object[".google.api.methodSignature"])) - throw TypeError(".google.protobuf.MethodOptions..google.api.methodSignature: array expected"); - message[".google.api.methodSignature"] = []; - for (var i = 0; i < object[".google.api.methodSignature"].length; ++i) - message[".google.api.methodSignature"][i] = String(object[".google.api.methodSignature"][i]); - } + var message = new $root.google.protobuf.Duration(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; return message; }; /** - * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * Creates a plain object from a Duration message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.Duration * @static - * @param {google.protobuf.MethodOptions} message MethodOptions + * @param {google.protobuf.Duration} message Duration * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - MethodOptions.toObject = function toObject(message, options) { + Duration.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.uninterpretedOption = []; - object[".google.api.methodSignature"] = []; - } if (options.defaults) { - object.deprecated = false; - object.idempotencyLevel = options.enums === String ? "IDEMPOTENCY_UNKNOWN" : 0; - object.features = null; - object[".google.api.http"] = null; - } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) - object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] === undefined ? message.idempotencyLevel : $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - if (message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length) { - object[".google.api.methodSignature"] = []; - for (var j = 0; j < message[".google.api.methodSignature"].length; ++j) - object[".google.api.methodSignature"][j] = message[".google.api.methodSignature"][j]; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; } - if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) - object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; return object; }; /** - * Converts this MethodOptions to JSON. + * Converts this Duration to JSON. * @function toJSON - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.Duration * @instance * @returns {Object.} JSON object */ - MethodOptions.prototype.toJSON = function toJSON() { + Duration.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for MethodOptions + * Gets the default type url for Duration * @function getTypeUrl - * @memberof google.protobuf.MethodOptions + * @memberof google.protobuf.Duration * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - MethodOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Duration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.MethodOptions"; + return typeUrlPrefix + "/google.protobuf.Duration"; }; - /** - * IdempotencyLevel enum. - * @name google.protobuf.MethodOptions.IdempotencyLevel - * @enum {number} - * @property {number} IDEMPOTENCY_UNKNOWN=0 IDEMPOTENCY_UNKNOWN value - * @property {number} NO_SIDE_EFFECTS=1 NO_SIDE_EFFECTS value - * @property {number} IDEMPOTENT=2 IDEMPOTENT value - */ - MethodOptions.IdempotencyLevel = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "IDEMPOTENCY_UNKNOWN"] = 0; - values[valuesById[1] = "NO_SIDE_EFFECTS"] = 1; - values[valuesById[2] = "IDEMPOTENT"] = 2; - return values; - })(); - - return MethodOptions; + return Duration; })(); - protobuf.UninterpretedOption = (function() { + protobuf.Timestamp = (function() { /** - * Properties of an UninterpretedOption. + * Properties of a Timestamp. * @memberof google.protobuf - * @interface IUninterpretedOption - * @property {Array.|null} [name] UninterpretedOption name - * @property {string|null} [identifierValue] UninterpretedOption identifierValue - * @property {number|Long|null} [positiveIntValue] UninterpretedOption positiveIntValue - * @property {number|Long|null} [negativeIntValue] UninterpretedOption negativeIntValue - * @property {number|null} [doubleValue] UninterpretedOption doubleValue - * @property {Uint8Array|null} [stringValue] UninterpretedOption stringValue - * @property {string|null} [aggregateValue] UninterpretedOption aggregateValue + * @interface ITimestamp + * @property {number|Long|null} [seconds] Timestamp seconds + * @property {number|null} [nanos] Timestamp nanos */ /** - * Constructs a new UninterpretedOption. + * Constructs a new Timestamp. * @memberof google.protobuf - * @classdesc Represents an UninterpretedOption. - * @implements IUninterpretedOption + * @classdesc Represents a Timestamp. + * @implements ITimestamp * @constructor - * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + * @param {google.protobuf.ITimestamp=} [properties] Properties to set */ - function UninterpretedOption(properties) { - this.name = []; + function Timestamp(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -20781,629 +32088,242 @@ } /** - * UninterpretedOption name. - * @member {Array.} name - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.name = $util.emptyArray; - - /** - * UninterpretedOption identifierValue. - * @member {string} identifierValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.identifierValue = ""; - - /** - * UninterpretedOption positiveIntValue. - * @member {number|Long} positiveIntValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.positiveIntValue = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * UninterpretedOption negativeIntValue. - * @member {number|Long} negativeIntValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.negativeIntValue = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * UninterpretedOption doubleValue. - * @member {number} doubleValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.doubleValue = 0; - - /** - * UninterpretedOption stringValue. - * @member {Uint8Array} stringValue - * @memberof google.protobuf.UninterpretedOption + * Timestamp seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Timestamp * @instance */ - UninterpretedOption.prototype.stringValue = $util.newBuffer([]); + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; /** - * UninterpretedOption aggregateValue. - * @member {string} aggregateValue - * @memberof google.protobuf.UninterpretedOption + * Timestamp nanos. + * @member {number} nanos + * @memberof google.protobuf.Timestamp * @instance */ - UninterpretedOption.prototype.aggregateValue = ""; + Timestamp.prototype.nanos = 0; /** - * Creates a new UninterpretedOption instance using the specified properties. + * Creates a new Timestamp instance using the specified properties. * @function create - * @memberof google.protobuf.UninterpretedOption + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @returns {google.protobuf.Timestamp} Timestamp instance */ - UninterpretedOption.create = function create(properties) { - return new UninterpretedOption(properties); + Timestamp.create = function create(properties) { + return new Timestamp(properties); }; /** - * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. * @function encode - * @memberof google.protobuf.UninterpretedOption + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UninterpretedOption.encode = function encode(message, writer) { + Timestamp.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.name.length) - for (var i = 0; i < message.name.length; ++i) - $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); - if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); - if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) - writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); - if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) - writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); - if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) - writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); - if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); return writer; }; /** - * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.UninterpretedOption + * @memberof google.protobuf.Timestamp * @static - * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { + Timestamp.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an UninterpretedOption message from the specified reader or buffer. + * Decodes a Timestamp message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.UninterpretedOption + * @memberof google.protobuf.Timestamp * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @returns {google.protobuf.Timestamp} Timestamp * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UninterpretedOption.decode = function decode(reader, length, error) { + Timestamp.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { - case 2: { - if (!(message.name && message.name.length)) - message.name = []; - message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); - break; - } - case 3: { - message.identifierValue = reader.string(); - break; - } - case 4: { - message.positiveIntValue = reader.uint64(); - break; - } - case 5: { - message.negativeIntValue = reader.int64(); - break; - } - case 6: { - message.doubleValue = reader.double(); - break; - } - case 7: { - message.stringValue = reader.bytes(); + case 1: { + message.seconds = reader.int64(); break; } - case 8: { - message.aggregateValue = reader.string(); + case 2: { + message.nanos = reader.int32(); break; } default: reader.skipType(tag & 7); break; - } - } - return message; - }; - - /** - * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UninterpretedOption message. - * @function verify - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UninterpretedOption.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) { - if (!Array.isArray(message.name)) - return "name: array expected"; - for (var i = 0; i < message.name.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); - if (error) - return "name." + error; - } - } - if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) - if (!$util.isString(message.identifierValue)) - return "identifierValue: string expected"; - if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) - if (!$util.isInteger(message.positiveIntValue) && !(message.positiveIntValue && $util.isInteger(message.positiveIntValue.low) && $util.isInteger(message.positiveIntValue.high))) - return "positiveIntValue: integer|Long expected"; - if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) - if (!$util.isInteger(message.negativeIntValue) && !(message.negativeIntValue && $util.isInteger(message.negativeIntValue.low) && $util.isInteger(message.negativeIntValue.high))) - return "negativeIntValue: integer|Long expected"; - if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) - if (typeof message.doubleValue !== "number") - return "doubleValue: number expected"; - if (message.stringValue != null && message.hasOwnProperty("stringValue")) - if (!(message.stringValue && typeof message.stringValue.length === "number" || $util.isString(message.stringValue))) - return "stringValue: buffer expected"; - if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) - if (!$util.isString(message.aggregateValue)) - return "aggregateValue: string expected"; - return null; - }; - - /** - * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption - */ - UninterpretedOption.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UninterpretedOption) - return object; - var message = new $root.google.protobuf.UninterpretedOption(); - if (object.name) { - if (!Array.isArray(object.name)) - throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); - message.name = []; - for (var i = 0; i < object.name.length; ++i) { - if (typeof object.name[i] !== "object") - throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); - message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); - } - } - if (object.identifierValue != null) - message.identifierValue = String(object.identifierValue); - if (object.positiveIntValue != null) - if ($util.Long) - (message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue)).unsigned = true; - else if (typeof object.positiveIntValue === "string") - message.positiveIntValue = parseInt(object.positiveIntValue, 10); - else if (typeof object.positiveIntValue === "number") - message.positiveIntValue = object.positiveIntValue; - else if (typeof object.positiveIntValue === "object") - message.positiveIntValue = new $util.LongBits(object.positiveIntValue.low >>> 0, object.positiveIntValue.high >>> 0).toNumber(true); - if (object.negativeIntValue != null) - if ($util.Long) - (message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue)).unsigned = false; - else if (typeof object.negativeIntValue === "string") - message.negativeIntValue = parseInt(object.negativeIntValue, 10); - else if (typeof object.negativeIntValue === "number") - message.negativeIntValue = object.negativeIntValue; - else if (typeof object.negativeIntValue === "object") - message.negativeIntValue = new $util.LongBits(object.negativeIntValue.low >>> 0, object.negativeIntValue.high >>> 0).toNumber(); - if (object.doubleValue != null) - message.doubleValue = Number(object.doubleValue); - if (object.stringValue != null) - if (typeof object.stringValue === "string") - $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); - else if (object.stringValue.length >= 0) - message.stringValue = object.stringValue; - if (object.aggregateValue != null) - message.aggregateValue = String(object.aggregateValue); - return message; - }; - - /** - * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {google.protobuf.UninterpretedOption} message UninterpretedOption - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UninterpretedOption.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.name = []; - if (options.defaults) { - object.identifierValue = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.positiveIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.positiveIntValue = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.negativeIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.negativeIntValue = options.longs === String ? "0" : 0; - object.doubleValue = 0; - if (options.bytes === String) - object.stringValue = ""; - else { - object.stringValue = []; - if (options.bytes !== Array) - object.stringValue = $util.newBuffer(object.stringValue); - } - object.aggregateValue = ""; - } - if (message.name && message.name.length) { - object.name = []; - for (var j = 0; j < message.name.length; ++j) - object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options); - } - if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) - object.identifierValue = message.identifierValue; - if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) - if (typeof message.positiveIntValue === "number") - object.positiveIntValue = options.longs === String ? String(message.positiveIntValue) : message.positiveIntValue; - else - object.positiveIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.positiveIntValue) : options.longs === Number ? new $util.LongBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0).toNumber(true) : message.positiveIntValue; - if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) - if (typeof message.negativeIntValue === "number") - object.negativeIntValue = options.longs === String ? String(message.negativeIntValue) : message.negativeIntValue; - else - object.negativeIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.negativeIntValue) : options.longs === Number ? new $util.LongBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0).toNumber() : message.negativeIntValue; - if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) - object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; - if (message.stringValue != null && message.hasOwnProperty("stringValue")) - object.stringValue = options.bytes === String ? $util.base64.encode(message.stringValue, 0, message.stringValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.stringValue) : message.stringValue; - if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) - object.aggregateValue = message.aggregateValue; - return object; + } + } + return message; }; /** - * Converts this UninterpretedOption to JSON. - * @function toJSON - * @memberof google.protobuf.UninterpretedOption - * @instance - * @returns {Object.} JSON object + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - UninterpretedOption.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + Timestamp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); }; /** - * Gets the default type url for UninterpretedOption - * @function getTypeUrl - * @memberof google.protobuf.UninterpretedOption + * Verifies a Timestamp message. + * @function verify + * @memberof google.protobuf.Timestamp * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - UninterpretedOption.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.UninterpretedOption"; + Timestamp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; }; - UninterpretedOption.NamePart = (function() { - - /** - * Properties of a NamePart. - * @memberof google.protobuf.UninterpretedOption - * @interface INamePart - * @property {string} namePart NamePart namePart - * @property {boolean} isExtension NamePart isExtension - */ - - /** - * Constructs a new NamePart. - * @memberof google.protobuf.UninterpretedOption - * @classdesc Represents a NamePart. - * @implements INamePart - * @constructor - * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set - */ - function NamePart(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]]; - } - - /** - * NamePart namePart. - * @member {string} namePart - * @memberof google.protobuf.UninterpretedOption.NamePart - * @instance - */ - NamePart.prototype.namePart = ""; - - /** - * NamePart isExtension. - * @member {boolean} isExtension - * @memberof google.protobuf.UninterpretedOption.NamePart - * @instance - */ - NamePart.prototype.isExtension = false; - - /** - * Creates a new NamePart instance using the specified properties. - * @function create - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart instance - */ - NamePart.create = function create(properties) { - return new NamePart(properties); - }; - - /** - * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. - * @function encode - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NamePart.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 2 =*/10).string(message.namePart); - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isExtension); - return writer; - }; - - /** - * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NamePart.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a NamePart message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NamePart.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.namePart = reader.string(); - break; - } - case 2: { - message.isExtension = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("namePart")) - throw $util.ProtocolError("missing required 'namePart'", { instance: message }); - if (!message.hasOwnProperty("isExtension")) - throw $util.ProtocolError("missing required 'isExtension'", { instance: message }); - return message; - }; - - /** - * Decodes a NamePart message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NamePart.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a NamePart message. - * @function verify - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - NamePart.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isString(message.namePart)) - return "namePart: string expected"; - if (typeof message.isExtension !== "boolean") - return "isExtension: boolean expected"; - return null; - }; - - /** - * Creates a NamePart message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart - */ - NamePart.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) - return object; - var message = new $root.google.protobuf.UninterpretedOption.NamePart(); - if (object.namePart != null) - message.namePart = String(object.namePart); - if (object.isExtension != null) - message.isExtension = Boolean(object.isExtension); - return message; - }; - - /** - * Creates a plain object from a NamePart message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.NamePart} message NamePart - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NamePart.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.namePart = ""; - object.isExtension = false; - } - if (message.namePart != null && message.hasOwnProperty("namePart")) - object.namePart = message.namePart; - if (message.isExtension != null && message.hasOwnProperty("isExtension")) - object.isExtension = message.isExtension; + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Timestamp} Timestamp + */ + Timestamp.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Timestamp) return object; - }; + var message = new $root.google.protobuf.Timestamp(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; - /** - * Converts this NamePart to JSON. - * @function toJSON - * @memberof google.protobuf.UninterpretedOption.NamePart - * @instance - * @returns {Object.} JSON object - */ - NamePart.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.Timestamp} message Timestamp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Timestamp.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; - /** - * Gets the default type url for NamePart - * @function getTypeUrl - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - NamePart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.UninterpretedOption.NamePart"; - }; + /** + * Converts this Timestamp to JSON. + * @function toJSON + * @memberof google.protobuf.Timestamp + * @instance + * @returns {Object.} JSON object + */ + Timestamp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return NamePart; - })(); + /** + * Gets the default type url for Timestamp + * @function getTypeUrl + * @memberof google.protobuf.Timestamp + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Timestamp"; + }; - return UninterpretedOption; + return Timestamp; })(); - protobuf.FeatureSet = (function() { + protobuf.Any = (function() { /** - * Properties of a FeatureSet. + * Properties of an Any. * @memberof google.protobuf - * @interface IFeatureSet - * @property {google.protobuf.FeatureSet.FieldPresence|null} [fieldPresence] FeatureSet fieldPresence - * @property {google.protobuf.FeatureSet.EnumType|null} [enumType] FeatureSet enumType - * @property {google.protobuf.FeatureSet.RepeatedFieldEncoding|null} [repeatedFieldEncoding] FeatureSet repeatedFieldEncoding - * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation - * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding - * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + * @interface IAny + * @property {string|null} [type_url] Any type_url + * @property {Uint8Array|null} [value] Any value */ /** - * Constructs a new FeatureSet. + * Constructs a new Any. * @memberof google.protobuf - * @classdesc Represents a FeatureSet. - * @implements IFeatureSet + * @classdesc Represents an Any. + * @implements IAny * @constructor - * @param {google.protobuf.IFeatureSet=} [properties] Properties to set + * @param {google.protobuf.IAny=} [properties] Properties to set */ - function FeatureSet(properties) { + function Any(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21411,149 +32331,301 @@ } /** - * FeatureSet fieldPresence. - * @member {google.protobuf.FeatureSet.FieldPresence} fieldPresence - * @memberof google.protobuf.FeatureSet + * Any type_url. + * @member {string} type_url + * @memberof google.protobuf.Any * @instance */ - FeatureSet.prototype.fieldPresence = 0; + Any.prototype.type_url = ""; /** - * FeatureSet enumType. - * @member {google.protobuf.FeatureSet.EnumType} enumType - * @memberof google.protobuf.FeatureSet + * Any value. + * @member {Uint8Array} value + * @memberof google.protobuf.Any * @instance */ - FeatureSet.prototype.enumType = 0; + Any.prototype.value = $util.newBuffer([]); /** - * FeatureSet repeatedFieldEncoding. - * @member {google.protobuf.FeatureSet.RepeatedFieldEncoding} repeatedFieldEncoding - * @memberof google.protobuf.FeatureSet - * @instance + * Creates a new Any instance using the specified properties. + * @function create + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny=} [properties] Properties to set + * @returns {google.protobuf.Any} Any instance */ - FeatureSet.prototype.repeatedFieldEncoding = 0; + Any.create = function create(properties) { + return new Any(properties); + }; /** - * FeatureSet utf8Validation. - * @member {google.protobuf.FeatureSet.Utf8Validation} utf8Validation - * @memberof google.protobuf.FeatureSet - * @instance + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - FeatureSet.prototype.utf8Validation = 0; + Any.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + return writer; + }; /** - * FeatureSet messageEncoding. - * @member {google.protobuf.FeatureSet.MessageEncoding} messageEncoding - * @memberof google.protobuf.FeatureSet - * @instance + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - FeatureSet.prototype.messageEncoding = 0; + Any.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * FeatureSet jsonFormat. - * @member {google.protobuf.FeatureSet.JsonFormat} jsonFormat - * @memberof google.protobuf.FeatureSet + * Decodes an Any message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type_url = reader.string(); + break; + } + case 2: { + message.value = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Any message. + * @function verify + * @memberof google.protobuf.Any + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Any.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type_url != null && message.hasOwnProperty("type_url")) + if (!$util.isString(message.type_url)) + return "type_url: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Any + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Any} Any + */ + Any.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Any) + return object; + var message = new $root.google.protobuf.Any(); + if (object.type_url != null) + message.type_url = String(object.type_url); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length >= 0) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.Any} message Any + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Any.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type_url = ""; + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + } + if (message.type_url != null && message.hasOwnProperty("type_url")) + object.type_url = message.type_url; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this Any to JSON. + * @function toJSON + * @memberof google.protobuf.Any * @instance + * @returns {Object.} JSON object + */ + Any.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Any + * @function getTypeUrl + * @memberof google.protobuf.Any + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Any"; + }; + + return Any; + })(); + + protobuf.Empty = (function() { + + /** + * Properties of an Empty. + * @memberof google.protobuf + * @interface IEmpty + */ + + /** + * Constructs a new Empty. + * @memberof google.protobuf + * @classdesc Represents an Empty. + * @implements IEmpty + * @constructor + * @param {google.protobuf.IEmpty=} [properties] Properties to set */ - FeatureSet.prototype.jsonFormat = 0; + function Empty(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]]; + } /** - * Creates a new FeatureSet instance using the specified properties. + * Creates a new Empty instance using the specified properties. * @function create - * @memberof google.protobuf.FeatureSet + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.IFeatureSet=} [properties] Properties to set - * @returns {google.protobuf.FeatureSet} FeatureSet instance + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance */ - FeatureSet.create = function create(properties) { - return new FeatureSet(properties); + Empty.create = function create(properties) { + return new Empty(properties); }; /** - * Encodes the specified FeatureSet message. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. * @function encode - * @memberof google.protobuf.FeatureSet + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.IFeatureSet} message FeatureSet message or plain object to encode + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FeatureSet.encode = function encode(message, writer) { + Empty.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.fieldPresence != null && Object.hasOwnProperty.call(message, "fieldPresence")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.fieldPresence); - if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.enumType); - if (message.repeatedFieldEncoding != null && Object.hasOwnProperty.call(message, "repeatedFieldEncoding")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.repeatedFieldEncoding); - if (message.utf8Validation != null && Object.hasOwnProperty.call(message, "utf8Validation")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.utf8Validation); - if (message.messageEncoding != null && Object.hasOwnProperty.call(message, "messageEncoding")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); - if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); return writer; }; /** - * Encodes the specified FeatureSet message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FeatureSet + * @memberof google.protobuf.Empty * @static - * @param {google.protobuf.IFeatureSet} message FeatureSet message or plain object to encode + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FeatureSet.encodeDelimited = function encodeDelimited(message, writer) { + Empty.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FeatureSet message from the specified reader or buffer. + * Decodes an Empty message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FeatureSet + * @memberof google.protobuf.Empty * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FeatureSet} FeatureSet + * @returns {google.protobuf.Empty} Empty * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FeatureSet.decode = function decode(reader, length, error) { + Empty.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { - case 1: { - message.fieldPresence = reader.int32(); - break; - } - case 2: { - message.enumType = reader.int32(); - break; - } - case 3: { - message.repeatedFieldEncoding = reader.int32(); - break; - } - case 4: { - message.utf8Validation = reader.int32(); - break; - } - case 5: { - message.messageEncoding = reader.int32(); - break; - } - case 6: { - message.jsonFormat = reader.int32(); - break; - } default: reader.skipType(tag & 7); break; @@ -21563,413 +32635,546 @@ }; /** - * Decodes a FeatureSet message from the specified reader or buffer, length delimited. + * Decodes an Empty message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FeatureSet + * @memberof google.protobuf.Empty * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FeatureSet} FeatureSet + * @returns {google.protobuf.Empty} Empty * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FeatureSet.decodeDelimited = function decodeDelimited(reader) { + Empty.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FeatureSet message. + * Verifies an Empty message. * @function verify - * @memberof google.protobuf.FeatureSet + * @memberof google.protobuf.Empty * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FeatureSet.verify = function verify(message) { + Empty.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) - switch (message.fieldPresence) { - default: - return "fieldPresence: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.enumType != null && message.hasOwnProperty("enumType")) - switch (message.enumType) { - default: - return "enumType: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.repeatedFieldEncoding != null && message.hasOwnProperty("repeatedFieldEncoding")) - switch (message.repeatedFieldEncoding) { - default: - return "repeatedFieldEncoding: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.utf8Validation != null && message.hasOwnProperty("utf8Validation")) - switch (message.utf8Validation) { - default: - return "utf8Validation: enum value expected"; - case 0: - case 2: - case 3: - break; - } - if (message.messageEncoding != null && message.hasOwnProperty("messageEncoding")) - switch (message.messageEncoding) { - default: - return "messageEncoding: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) - switch (message.jsonFormat) { - default: - return "jsonFormat: enum value expected"; - case 0: - case 1: - case 2: - break; - } return null; }; /** - * Creates a FeatureSet message from a plain object. Also converts values to their respective internal types. + * Creates an Empty message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FeatureSet + * @memberof google.protobuf.Empty * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FeatureSet} FeatureSet + * @returns {google.protobuf.Empty} Empty */ - FeatureSet.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FeatureSet) + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) return object; - var message = new $root.google.protobuf.FeatureSet(); - switch (object.fieldPresence) { - default: - if (typeof object.fieldPresence === "number") { - message.fieldPresence = object.fieldPresence; - break; - } - break; - case "FIELD_PRESENCE_UNKNOWN": - case 0: - message.fieldPresence = 0; - break; - case "EXPLICIT": - case 1: - message.fieldPresence = 1; - break; - case "IMPLICIT": - case 2: - message.fieldPresence = 2; - break; - case "LEGACY_REQUIRED": - case 3: - message.fieldPresence = 3; - break; - } - switch (object.enumType) { - default: - if (typeof object.enumType === "number") { - message.enumType = object.enumType; - break; - } - break; - case "ENUM_TYPE_UNKNOWN": - case 0: - message.enumType = 0; - break; - case "OPEN": - case 1: - message.enumType = 1; - break; - case "CLOSED": - case 2: - message.enumType = 2; - break; + return new $root.google.protobuf.Empty(); + }; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.Empty} message Empty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Empty.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Empty to JSON. + * @function toJSON + * @memberof google.protobuf.Empty + * @instance + * @returns {Object.} JSON object + */ + Empty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Empty + * @function getTypeUrl + * @memberof google.protobuf.Empty + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } - switch (object.repeatedFieldEncoding) { - default: - if (typeof object.repeatedFieldEncoding === "number") { - message.repeatedFieldEncoding = object.repeatedFieldEncoding; + return typeUrlPrefix + "/google.protobuf.Empty"; + }; + + return Empty; + })(); + + protobuf.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + 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]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) break; - } - break; - case "REPEATED_FIELD_ENCODING_UNKNOWN": - case 0: - message.repeatedFieldEncoding = 0; - break; - case "PACKED": - case 1: - message.repeatedFieldEncoding = 1; - break; - case "EXPANDED": - case 2: - message.repeatedFieldEncoding = 2; - break; - } - switch (object.utf8Validation) { - default: - if (typeof object.utf8Validation === "number") { - message.utf8Validation = object.utf8Validation; + switch (tag >>> 3) { + case 1: { + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); break; } - break; - case "UTF8_VALIDATION_UNKNOWN": - case 0: - message.utf8Validation = 0; - break; - case "VERIFY": - case 2: - message.utf8Validation = 2; - break; - case "NONE": - case 3: - message.utf8Validation = 3; - break; } - switch (object.messageEncoding) { - default: - if (typeof object.messageEncoding === "number") { - message.messageEncoding = object.messageEncoding; - break; - } - break; - case "MESSAGE_ENCODING_UNKNOWN": - case 0: - message.messageEncoding = 0; - break; - case "LENGTH_PREFIXED": - case 1: - message.messageEncoding = 1; - break; - case "DELIMITED": - case 2: - message.messageEncoding = 2; - break; + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; } - switch (object.jsonFormat) { - default: - if (typeof object.jsonFormat === "number") { - message.jsonFormat = object.jsonFormat; - break; - } - break; - case "JSON_FORMAT_UNKNOWN": - case 0: - message.jsonFormat = 0; - break; - case "ALLOW": - case 1: - message.jsonFormat = 1; - break; - case "LEGACY_BEST_EFFORT": - case 2: - message.jsonFormat = 2; - break; + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); } return message; }; /** - * Creates a plain object from a FeatureSet message. Also converts values to other types if specified. + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FeatureSet + * @memberof google.protobuf.FieldMask * @static - * @param {google.protobuf.FeatureSet} message FeatureSet + * @param {google.protobuf.FieldMask} message FieldMask * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FeatureSet.toObject = function toObject(message, options) { + FieldMask.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.fieldPresence = options.enums === String ? "FIELD_PRESENCE_UNKNOWN" : 0; - object.enumType = options.enums === String ? "ENUM_TYPE_UNKNOWN" : 0; - object.repeatedFieldEncoding = options.enums === String ? "REPEATED_FIELD_ENCODING_UNKNOWN" : 0; - object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; - object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; - object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; } - if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) - object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; - if (message.enumType != null && message.hasOwnProperty("enumType")) - object.enumType = options.enums === String ? $root.google.protobuf.FeatureSet.EnumType[message.enumType] === undefined ? message.enumType : $root.google.protobuf.FeatureSet.EnumType[message.enumType] : message.enumType; - if (message.repeatedFieldEncoding != null && message.hasOwnProperty("repeatedFieldEncoding")) - object.repeatedFieldEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] === undefined ? message.repeatedFieldEncoding : $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] : message.repeatedFieldEncoding; - if (message.utf8Validation != null && message.hasOwnProperty("utf8Validation")) - object.utf8Validation = options.enums === String ? $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] === undefined ? message.utf8Validation : $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] : message.utf8Validation; - if (message.messageEncoding != null && message.hasOwnProperty("messageEncoding")) - object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; - if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) - object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; return object; }; /** - * Converts this FeatureSet to JSON. + * Converts this FieldMask to JSON. * @function toJSON - * @memberof google.protobuf.FeatureSet + * @memberof google.protobuf.FieldMask * @instance * @returns {Object.} JSON object */ - FeatureSet.prototype.toJSON = function toJSON() { + FieldMask.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for FeatureSet + * Gets the default type url for FieldMask * @function getTypeUrl - * @memberof google.protobuf.FeatureSet + * @memberof google.protobuf.FieldMask * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - FeatureSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.FeatureSet"; + return typeUrlPrefix + "/google.protobuf.FieldMask"; }; + return FieldMask; + })(); + + return protobuf; + })(); + + google.longrunning = (function() { + + /** + * Namespace longrunning. + * @memberof google + * @namespace + */ + var longrunning = {}; + + longrunning.Operations = (function() { + /** - * FieldPresence enum. - * @name google.protobuf.FeatureSet.FieldPresence - * @enum {number} - * @property {number} FIELD_PRESENCE_UNKNOWN=0 FIELD_PRESENCE_UNKNOWN value - * @property {number} EXPLICIT=1 EXPLICIT value - * @property {number} IMPLICIT=2 IMPLICIT value - * @property {number} LEGACY_REQUIRED=3 LEGACY_REQUIRED value + * Constructs a new Operations service. + * @memberof google.longrunning + * @classdesc Represents an Operations + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - FeatureSet.FieldPresence = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "FIELD_PRESENCE_UNKNOWN"] = 0; - values[valuesById[1] = "EXPLICIT"] = 1; - values[valuesById[2] = "IMPLICIT"] = 2; - values[valuesById[3] = "LEGACY_REQUIRED"] = 3; - return values; - })(); + function Operations(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Operations.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Operations; /** - * EnumType enum. - * @name google.protobuf.FeatureSet.EnumType - * @enum {number} - * @property {number} ENUM_TYPE_UNKNOWN=0 ENUM_TYPE_UNKNOWN value - * @property {number} OPEN=1 OPEN value - * @property {number} CLOSED=2 CLOSED value + * Creates new Operations service using the specified rpc implementation. + * @function create + * @memberof google.longrunning.Operations + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Operations} RPC service. Useful where requests and/or responses are streamed. */ - FeatureSet.EnumType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "ENUM_TYPE_UNKNOWN"] = 0; - values[valuesById[1] = "OPEN"] = 1; - values[valuesById[2] = "CLOSED"] = 2; - return values; - })(); + Operations.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; /** - * RepeatedFieldEncoding enum. - * @name google.protobuf.FeatureSet.RepeatedFieldEncoding - * @enum {number} - * @property {number} REPEATED_FIELD_ENCODING_UNKNOWN=0 REPEATED_FIELD_ENCODING_UNKNOWN value - * @property {number} PACKED=1 PACKED value - * @property {number} EXPANDED=2 EXPANDED value + * Callback as used by {@link google.longrunning.Operations|listOperations}. + * @memberof google.longrunning.Operations + * @typedef ListOperationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.ListOperationsResponse} [response] ListOperationsResponse */ - FeatureSet.RepeatedFieldEncoding = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "REPEATED_FIELD_ENCODING_UNKNOWN"] = 0; - values[valuesById[1] = "PACKED"] = 1; - values[valuesById[2] = "EXPANDED"] = 2; - return values; - })(); /** - * Utf8Validation enum. - * @name google.protobuf.FeatureSet.Utf8Validation - * @enum {number} - * @property {number} UTF8_VALIDATION_UNKNOWN=0 UTF8_VALIDATION_UNKNOWN value - * @property {number} VERIFY=2 VERIFY value - * @property {number} NONE=3 NONE value + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @param {google.longrunning.Operations.ListOperationsCallback} callback Node-style callback called with the error, if any, and ListOperationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.listOperations = function listOperations(request, callback) { + return this.rpcCall(listOperations, $root.google.longrunning.ListOperationsRequest, $root.google.longrunning.ListOperationsResponse, request, callback); + }, "name", { value: "ListOperations" }); + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|getOperation}. + * @memberof google.longrunning.Operations + * @typedef GetOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @param {google.longrunning.Operations.GetOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.getOperation = function getOperation(request, callback) { + return this.rpcCall(getOperation, $root.google.longrunning.GetOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "GetOperation" }); + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. + * @memberof google.longrunning.Operations + * @typedef DeleteOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @param {google.longrunning.Operations.DeleteOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.deleteOperation = function deleteOperation(request, callback) { + return this.rpcCall(deleteOperation, $root.google.longrunning.DeleteOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteOperation" }); + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. + * @memberof google.longrunning.Operations + * @typedef CancelOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @param {google.longrunning.Operations.CancelOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.cancelOperation = function cancelOperation(request, callback) { + return this.rpcCall(cancelOperation, $root.google.longrunning.CancelOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "CancelOperation" }); + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|waitOperation}. + * @memberof google.longrunning.Operations + * @typedef WaitOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation */ - FeatureSet.Utf8Validation = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UTF8_VALIDATION_UNKNOWN"] = 0; - values[valuesById[2] = "VERIFY"] = 2; - values[valuesById[3] = "NONE"] = 3; - return values; - })(); /** - * MessageEncoding enum. - * @name google.protobuf.FeatureSet.MessageEncoding - * @enum {number} - * @property {number} MESSAGE_ENCODING_UNKNOWN=0 MESSAGE_ENCODING_UNKNOWN value - * @property {number} LENGTH_PREFIXED=1 LENGTH_PREFIXED value - * @property {number} DELIMITED=2 DELIMITED value + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @param {google.longrunning.Operations.WaitOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 */ - FeatureSet.MessageEncoding = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MESSAGE_ENCODING_UNKNOWN"] = 0; - values[valuesById[1] = "LENGTH_PREFIXED"] = 1; - values[valuesById[2] = "DELIMITED"] = 2; - return values; - })(); + Object.defineProperty(Operations.prototype.waitOperation = function waitOperation(request, callback) { + return this.rpcCall(waitOperation, $root.google.longrunning.WaitOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "WaitOperation" }); /** - * JsonFormat enum. - * @name google.protobuf.FeatureSet.JsonFormat - * @enum {number} - * @property {number} JSON_FORMAT_UNKNOWN=0 JSON_FORMAT_UNKNOWN value - * @property {number} ALLOW=1 ALLOW value - * @property {number} LEGACY_BEST_EFFORT=2 LEGACY_BEST_EFFORT value + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - FeatureSet.JsonFormat = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "JSON_FORMAT_UNKNOWN"] = 0; - values[valuesById[1] = "ALLOW"] = 1; - values[valuesById[2] = "LEGACY_BEST_EFFORT"] = 2; - return values; - })(); - return FeatureSet; + return Operations; })(); - protobuf.FeatureSetDefaults = (function() { + longrunning.Operation = (function() { /** - * Properties of a FeatureSetDefaults. - * @memberof google.protobuf - * @interface IFeatureSetDefaults - * @property {Array.|null} [defaults] FeatureSetDefaults defaults - * @property {google.protobuf.Edition|null} [minimumEdition] FeatureSetDefaults minimumEdition - * @property {google.protobuf.Edition|null} [maximumEdition] FeatureSetDefaults maximumEdition + * Properties of an Operation. + * @memberof google.longrunning + * @interface IOperation + * @property {string|null} [name] Operation name + * @property {google.protobuf.IAny|null} [metadata] Operation metadata + * @property {boolean|null} [done] Operation done + * @property {google.rpc.IStatus|null} [error] Operation error + * @property {google.protobuf.IAny|null} [response] Operation response */ /** - * Constructs a new FeatureSetDefaults. - * @memberof google.protobuf - * @classdesc Represents a FeatureSetDefaults. - * @implements IFeatureSetDefaults + * Constructs a new Operation. + * @memberof google.longrunning + * @classdesc Represents an Operation. + * @implements IOperation * @constructor - * @param {google.protobuf.IFeatureSetDefaults=} [properties] Properties to set + * @param {google.longrunning.IOperation=} [properties] Properties to set */ - function FeatureSetDefaults(properties) { - this.defaults = []; + function Operation(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -21977,108 +33182,147 @@ } /** - * FeatureSetDefaults defaults. - * @member {Array.} defaults - * @memberof google.protobuf.FeatureSetDefaults + * Operation name. + * @member {string} name + * @memberof google.longrunning.Operation * @instance */ - FeatureSetDefaults.prototype.defaults = $util.emptyArray; + Operation.prototype.name = ""; /** - * FeatureSetDefaults minimumEdition. - * @member {google.protobuf.Edition} minimumEdition - * @memberof google.protobuf.FeatureSetDefaults + * Operation metadata. + * @member {google.protobuf.IAny|null|undefined} metadata + * @memberof google.longrunning.Operation * @instance */ - FeatureSetDefaults.prototype.minimumEdition = 0; + Operation.prototype.metadata = null; /** - * FeatureSetDefaults maximumEdition. - * @member {google.protobuf.Edition} maximumEdition - * @memberof google.protobuf.FeatureSetDefaults + * Operation done. + * @member {boolean} done + * @memberof google.longrunning.Operation * @instance */ - FeatureSetDefaults.prototype.maximumEdition = 0; + Operation.prototype.done = false; /** - * Creates a new FeatureSetDefaults instance using the specified properties. + * Operation error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.error = null; + + /** + * Operation response. + * @member {google.protobuf.IAny|null|undefined} response + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.response = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Operation result. + * @member {"error"|"response"|undefined} result + * @memberof google.longrunning.Operation + * @instance + */ + Object.defineProperty(Operation.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["error", "response"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Operation instance using the specified properties. * @function create - * @memberof google.protobuf.FeatureSetDefaults + * @memberof google.longrunning.Operation * @static - * @param {google.protobuf.IFeatureSetDefaults=} [properties] Properties to set - * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults instance + * @param {google.longrunning.IOperation=} [properties] Properties to set + * @returns {google.longrunning.Operation} Operation instance */ - FeatureSetDefaults.create = function create(properties) { - return new FeatureSetDefaults(properties); + Operation.create = function create(properties) { + return new Operation(properties); }; /** - * Encodes the specified FeatureSetDefaults message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. * @function encode - * @memberof google.protobuf.FeatureSetDefaults + * @memberof google.longrunning.Operation * @static - * @param {google.protobuf.IFeatureSetDefaults} message FeatureSetDefaults message or plain object to encode + * @param {google.longrunning.IOperation} message Operation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FeatureSetDefaults.encode = function encode(message, writer) { + Operation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.defaults != null && message.defaults.length) - for (var i = 0; i < message.defaults.length; ++i) - $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.encode(message.defaults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.minimumEdition != null && Object.hasOwnProperty.call(message, "minimumEdition")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.minimumEdition); - if (message.maximumEdition != null && Object.hasOwnProperty.call(message, "maximumEdition")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maximumEdition); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.protobuf.Any.encode(message.metadata, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.done != null && Object.hasOwnProperty.call(message, "done")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.done); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.response != null && Object.hasOwnProperty.call(message, "response")) + $root.google.protobuf.Any.encode(message.response, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** - * Encodes the specified FeatureSetDefaults message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FeatureSetDefaults + * @memberof google.longrunning.Operation * @static - * @param {google.protobuf.IFeatureSetDefaults} message FeatureSetDefaults message or plain object to encode + * @param {google.longrunning.IOperation} message Operation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FeatureSetDefaults.encodeDelimited = function encodeDelimited(message, writer) { + Operation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FeatureSetDefaults message from the specified reader or buffer. + * Decodes an Operation message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FeatureSetDefaults + * @memberof google.longrunning.Operation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults + * @returns {google.longrunning.Operation} Operation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FeatureSetDefaults.decode = function decode(reader, length, error) { + Operation.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.Operation(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - if (!(message.defaults && message.defaults.length)) - message.defaults = []; - message.defaults.push($root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.decode(reader, reader.uint32())); + message.name = reader.string(); + break; + } + case 2: { + message.metadata = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } + case 3: { + message.done = reader.bool(); break; } case 4: { - message.minimumEdition = reader.int32(); + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); break; } case 5: { - message.maximumEdition = reader.int32(); + message.response = $root.google.protobuf.Any.decode(reader, reader.uint32()); break; } default: @@ -22090,584 +33334,391 @@ }; /** - * Decodes a FeatureSetDefaults message from the specified reader or buffer, length delimited. + * Decodes an Operation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FeatureSetDefaults + * @memberof google.longrunning.Operation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults + * @returns {google.longrunning.Operation} Operation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FeatureSetDefaults.decodeDelimited = function decodeDelimited(reader) { + Operation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FeatureSetDefaults message. - * @function verify - * @memberof google.protobuf.FeatureSetDefaults - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FeatureSetDefaults.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.defaults != null && message.hasOwnProperty("defaults")) { - if (!Array.isArray(message.defaults)) - return "defaults: array expected"; - for (var i = 0; i < message.defaults.length; ++i) { - var error = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify(message.defaults[i]); - if (error) - return "defaults." + error; - } - } - if (message.minimumEdition != null && message.hasOwnProperty("minimumEdition")) - switch (message.minimumEdition) { - default: - return "minimumEdition: enum value expected"; - case 0: - case 998: - case 999: - case 1000: - case 1001: - case 1: - case 2: - case 99997: - case 99998: - case 99999: - case 2147483647: - break; - } - if (message.maximumEdition != null && message.hasOwnProperty("maximumEdition")) - switch (message.maximumEdition) { - default: - return "maximumEdition: enum value expected"; - case 0: - case 998: - case 999: - case 1000: - case 1001: - case 1: - case 2: - case 99997: - case 99998: - case 99999: - case 2147483647: - break; - } - return null; - }; - - /** - * Creates a FeatureSetDefaults message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FeatureSetDefaults - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults - */ - FeatureSetDefaults.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FeatureSetDefaults) - return object; - var message = new $root.google.protobuf.FeatureSetDefaults(); - if (object.defaults) { - if (!Array.isArray(object.defaults)) - throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: array expected"); - message.defaults = []; - for (var i = 0; i < object.defaults.length; ++i) { - if (typeof object.defaults[i] !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: object expected"); - message.defaults[i] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fromObject(object.defaults[i]); - } - } - switch (object.minimumEdition) { - default: - if (typeof object.minimumEdition === "number") { - message.minimumEdition = object.minimumEdition; - break; - } - break; - case "EDITION_UNKNOWN": - case 0: - message.minimumEdition = 0; - break; - case "EDITION_PROTO2": - case 998: - message.minimumEdition = 998; - break; - case "EDITION_PROTO3": - case 999: - message.minimumEdition = 999; - break; - case "EDITION_2023": - case 1000: - message.minimumEdition = 1000; - break; - case "EDITION_2024": - case 1001: - message.minimumEdition = 1001; - break; - case "EDITION_1_TEST_ONLY": - case 1: - message.minimumEdition = 1; - break; - case "EDITION_2_TEST_ONLY": - case 2: - message.minimumEdition = 2; - break; - case "EDITION_99997_TEST_ONLY": - case 99997: - message.minimumEdition = 99997; - break; - case "EDITION_99998_TEST_ONLY": - case 99998: - message.minimumEdition = 99998; - break; - case "EDITION_99999_TEST_ONLY": - case 99999: - message.minimumEdition = 99999; - break; - case "EDITION_MAX": - case 2147483647: - message.minimumEdition = 2147483647; - break; + }; + + /** + * Verifies an Operation message. + * @function verify + * @memberof google.longrunning.Operation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Operation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.protobuf.Any.verify(message.metadata); + if (error) + return "metadata." + error; } - switch (object.maximumEdition) { - default: - if (typeof object.maximumEdition === "number") { - message.maximumEdition = object.maximumEdition; - break; + if (message.done != null && message.hasOwnProperty("done")) + if (typeof message.done !== "boolean") + return "done: boolean expected"; + if (message.error != null && message.hasOwnProperty("error")) { + properties.result = 1; + { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; } - break; - case "EDITION_UNKNOWN": - case 0: - message.maximumEdition = 0; - break; - case "EDITION_PROTO2": - case 998: - message.maximumEdition = 998; - break; - case "EDITION_PROTO3": - case 999: - message.maximumEdition = 999; - break; - case "EDITION_2023": - case 1000: - message.maximumEdition = 1000; - break; - case "EDITION_2024": - case 1001: - message.maximumEdition = 1001; - break; - case "EDITION_1_TEST_ONLY": - case 1: - message.maximumEdition = 1; - break; - case "EDITION_2_TEST_ONLY": - case 2: - message.maximumEdition = 2; - break; - case "EDITION_99997_TEST_ONLY": - case 99997: - message.maximumEdition = 99997; - break; - case "EDITION_99998_TEST_ONLY": - case 99998: - message.maximumEdition = 99998; - break; - case "EDITION_99999_TEST_ONLY": - case 99999: - message.maximumEdition = 99999; - break; - case "EDITION_MAX": - case 2147483647: - message.maximumEdition = 2147483647; - break; + } + if (message.response != null && message.hasOwnProperty("response")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.google.protobuf.Any.verify(message.response); + if (error) + return "response." + error; + } + } + return null; + }; + + /** + * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.Operation + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.Operation} Operation + */ + Operation.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.Operation) + return object; + var message = new $root.google.longrunning.Operation(); + if (object.name != null) + message.name = String(object.name); + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.longrunning.Operation.metadata: object expected"); + message.metadata = $root.google.protobuf.Any.fromObject(object.metadata); + } + if (object.done != null) + message.done = Boolean(object.done); + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.longrunning.Operation.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + if (object.response != null) { + if (typeof object.response !== "object") + throw TypeError(".google.longrunning.Operation.response: object expected"); + message.response = $root.google.protobuf.Any.fromObject(object.response); } return message; }; /** - * Creates a plain object from a FeatureSetDefaults message. Also converts values to other types if specified. + * Creates a plain object from an Operation message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FeatureSetDefaults + * @memberof google.longrunning.Operation * @static - * @param {google.protobuf.FeatureSetDefaults} message FeatureSetDefaults + * @param {google.longrunning.Operation} message Operation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FeatureSetDefaults.toObject = function toObject(message, options) { + Operation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.defaults = []; if (options.defaults) { - object.minimumEdition = options.enums === String ? "EDITION_UNKNOWN" : 0; - object.maximumEdition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.name = ""; + object.metadata = null; + object.done = false; } - if (message.defaults && message.defaults.length) { - object.defaults = []; - for (var j = 0; j < message.defaults.length; ++j) - object.defaults[j] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.toObject(message.defaults[j], options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.protobuf.Any.toObject(message.metadata, options); + if (message.done != null && message.hasOwnProperty("done")) + object.done = message.done; + if (message.error != null && message.hasOwnProperty("error")) { + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (options.oneofs) + object.result = "error"; + } + if (message.response != null && message.hasOwnProperty("response")) { + object.response = $root.google.protobuf.Any.toObject(message.response, options); + if (options.oneofs) + object.result = "response"; } - if (message.minimumEdition != null && message.hasOwnProperty("minimumEdition")) - object.minimumEdition = options.enums === String ? $root.google.protobuf.Edition[message.minimumEdition] === undefined ? message.minimumEdition : $root.google.protobuf.Edition[message.minimumEdition] : message.minimumEdition; - if (message.maximumEdition != null && message.hasOwnProperty("maximumEdition")) - object.maximumEdition = options.enums === String ? $root.google.protobuf.Edition[message.maximumEdition] === undefined ? message.maximumEdition : $root.google.protobuf.Edition[message.maximumEdition] : message.maximumEdition; return object; }; /** - * Converts this FeatureSetDefaults to JSON. + * Converts this Operation to JSON. * @function toJSON - * @memberof google.protobuf.FeatureSetDefaults + * @memberof google.longrunning.Operation * @instance * @returns {Object.} JSON object */ - FeatureSetDefaults.prototype.toJSON = function toJSON() { + Operation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for FeatureSetDefaults + * Gets the default type url for Operation * @function getTypeUrl - * @memberof google.protobuf.FeatureSetDefaults + * @memberof google.longrunning.Operation * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - FeatureSetDefaults.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Operation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.FeatureSetDefaults"; + return typeUrlPrefix + "/google.longrunning.Operation"; }; - FeatureSetDefaults.FeatureSetEditionDefault = (function() { - - /** - * Properties of a FeatureSetEditionDefault. - * @memberof google.protobuf.FeatureSetDefaults - * @interface IFeatureSetEditionDefault - * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition - * @property {google.protobuf.IFeatureSet|null} [features] FeatureSetEditionDefault features - */ - - /** - * Constructs a new FeatureSetEditionDefault. - * @memberof google.protobuf.FeatureSetDefaults - * @classdesc Represents a FeatureSetEditionDefault. - * @implements IFeatureSetEditionDefault - * @constructor - * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault=} [properties] Properties to set - */ - function FeatureSetEditionDefault(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]]; - } - - /** - * FeatureSetEditionDefault edition. - * @member {google.protobuf.Edition} edition - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @instance - */ - FeatureSetEditionDefault.prototype.edition = 0; - - /** - * FeatureSetEditionDefault features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @instance - */ - FeatureSetEditionDefault.prototype.features = null; + return Operation; + })(); - /** - * Creates a new FeatureSetEditionDefault instance using the specified properties. - * @function create - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault=} [properties] Properties to set - * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault instance - */ - FeatureSetEditionDefault.create = function create(properties) { - return new FeatureSetEditionDefault(properties); - }; + longrunning.GetOperationRequest = (function() { - /** - * Encodes the specified FeatureSetEditionDefault message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault} message FeatureSetEditionDefault message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FeatureSetEditionDefault.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); - return writer; - }; + /** + * Properties of a GetOperationRequest. + * @memberof google.longrunning + * @interface IGetOperationRequest + * @property {string|null} [name] GetOperationRequest name + */ - /** - * Encodes the specified FeatureSetEditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault} message FeatureSetEditionDefault message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FeatureSetEditionDefault.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Constructs a new GetOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a GetOperationRequest. + * @implements IGetOperationRequest + * @constructor + * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + */ + function GetOperationRequest(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]]; + } - /** - * Decodes a FeatureSetEditionDefault message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FeatureSetEditionDefault.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 3: { - message.edition = reader.int32(); - break; - } - case 2: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * GetOperationRequest name. + * @member {string} name + * @memberof google.longrunning.GetOperationRequest + * @instance + */ + GetOperationRequest.prototype.name = ""; - /** - * Decodes a FeatureSetEditionDefault message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FeatureSetEditionDefault.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Creates a new GetOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest instance + */ + GetOperationRequest.create = function create(properties) { + return new GetOperationRequest(properties); + }; - /** - * Verifies a FeatureSetEditionDefault message. - * @function verify - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FeatureSetEditionDefault.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.edition != null && message.hasOwnProperty("edition")) - switch (message.edition) { - default: - return "edition: enum value expected"; - case 0: - case 998: - case 999: - case 1000: - case 1001: - case 1: - case 2: - case 99997: - case 99998: - case 99999: - case 2147483647: - break; - } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - return null; - }; + /** + * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetOperationRequest.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; + }; - /** - * Creates a FeatureSetEditionDefault message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault - */ - FeatureSetEditionDefault.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) - return object; - var message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); - switch (object.edition) { - default: - if (typeof object.edition === "number") { - message.edition = object.edition; + /** + * Encodes the specified GetOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetOperationRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.GetOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); break; } - break; - case "EDITION_UNKNOWN": - case 0: - message.edition = 0; - break; - case "EDITION_PROTO2": - case 998: - message.edition = 998; - break; - case "EDITION_PROTO3": - case 999: - message.edition = 999; - break; - case "EDITION_2023": - case 1000: - message.edition = 1000; - break; - case "EDITION_2024": - case 1001: - message.edition = 1001; - break; - case "EDITION_1_TEST_ONLY": - case 1: - message.edition = 1; - break; - case "EDITION_2_TEST_ONLY": - case 2: - message.edition = 2; - break; - case "EDITION_99997_TEST_ONLY": - case 99997: - message.edition = 99997; - break; - case "EDITION_99998_TEST_ONLY": - case 99998: - message.edition = 99998; - break; - case "EDITION_99999_TEST_ONLY": - case 99999: - message.edition = 99999; - break; - case "EDITION_MAX": - case 2147483647: - message.edition = 2147483647; + default: + reader.skipType(tag & 7); break; } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - return message; - }; + } + return message; + }; - /** - * Creates a plain object from a FeatureSetEditionDefault message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} message FeatureSetEditionDefault - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FeatureSetEditionDefault.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.features = null; - object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; - } - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + /** + * Decodes a GetOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetOperationRequest message. + * @function verify + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetOperationRequest.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 GetOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + */ + GetOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.GetOperationRequest) return object; - }; + var message = new $root.google.longrunning.GetOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; - /** - * Converts this FeatureSetEditionDefault to JSON. - * @function toJSON - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @instance - * @returns {Object.} JSON object - */ - FeatureSetEditionDefault.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GetOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.GetOperationRequest} message GetOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetOperationRequest.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; + }; - /** - * Gets the default type url for FeatureSetEditionDefault - * @function getTypeUrl - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FeatureSetEditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"; - }; + /** + * Converts this GetOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.GetOperationRequest + * @instance + * @returns {Object.} JSON object + */ + GetOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return FeatureSetEditionDefault; - })(); + /** + * Gets the default type url for GetOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.GetOperationRequest"; + }; - return FeatureSetDefaults; + return GetOperationRequest; })(); - protobuf.SourceCodeInfo = (function() { + longrunning.ListOperationsRequest = (function() { /** - * Properties of a SourceCodeInfo. - * @memberof google.protobuf - * @interface ISourceCodeInfo - * @property {Array.|null} [location] SourceCodeInfo location + * Properties of a ListOperationsRequest. + * @memberof google.longrunning + * @interface IListOperationsRequest + * @property {string|null} [name] ListOperationsRequest name + * @property {string|null} [filter] ListOperationsRequest filter + * @property {number|null} [pageSize] ListOperationsRequest pageSize + * @property {string|null} [pageToken] ListOperationsRequest pageToken */ /** - * Constructs a new SourceCodeInfo. - * @memberof google.protobuf - * @classdesc Represents a SourceCodeInfo. - * @implements ISourceCodeInfo + * Constructs a new ListOperationsRequest. + * @memberof google.longrunning + * @classdesc Represents a ListOperationsRequest. + * @implements IListOperationsRequest * @constructor - * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + * @param {google.longrunning.IListOperationsRequest=} [properties] Properties to set */ - function SourceCodeInfo(properties) { - this.location = []; + function ListOperationsRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -22675,80 +33726,119 @@ } /** - * SourceCodeInfo location. - * @member {Array.} location - * @memberof google.protobuf.SourceCodeInfo + * ListOperationsRequest name. + * @member {string} name + * @memberof google.longrunning.ListOperationsRequest * @instance */ - SourceCodeInfo.prototype.location = $util.emptyArray; + ListOperationsRequest.prototype.name = ""; /** - * Creates a new SourceCodeInfo instance using the specified properties. + * ListOperationsRequest filter. + * @member {string} filter + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.filter = ""; + + /** + * ListOperationsRequest pageSize. + * @member {number} pageSize + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.pageSize = 0; + + /** + * ListOperationsRequest pageToken. + * @member {string} pageToken + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListOperationsRequest instance using the specified properties. * @function create - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.longrunning.ListOperationsRequest * @static - * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance + * @param {google.longrunning.IListOperationsRequest=} [properties] Properties to set + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest instance */ - SourceCodeInfo.create = function create(properties) { - return new SourceCodeInfo(properties); + ListOperationsRequest.create = function create(properties) { + return new ListOperationsRequest(properties); }; /** - * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * Encodes the specified ListOperationsRequest message. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. * @function encode - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.longrunning.ListOperationsRequest * @static - * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {google.longrunning.IListOperationsRequest} message ListOperationsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SourceCodeInfo.encode = function encode(message, writer) { + ListOperationsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.location != null && message.location.length) - for (var i = 0; i < message.location.length; ++i) - $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); return writer; }; /** - * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * Encodes the specified ListOperationsRequest message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.longrunning.ListOperationsRequest * @static - * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {google.longrunning.IListOperationsRequest} message ListOperationsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + ListOperationsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SourceCodeInfo message from the specified reader or buffer. + * Decodes a ListOperationsRequest message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.longrunning.ListOperationsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SourceCodeInfo.decode = function decode(reader, length, error) { + ListOperationsRequest.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.ListOperationsRequest(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { + case 4: { + message.name = reader.string(); + break; + } case 1: { - if (!(message.location && message.location.length)) - message.location = []; - message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); + message.filter = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); break; } default: @@ -22760,504 +33850,602 @@ }; /** - * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * Decodes a ListOperationsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.longrunning.ListOperationsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { + ListOperationsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SourceCodeInfo message. + * Verifies a ListOperationsRequest message. * @function verify - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.longrunning.ListOperationsRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SourceCodeInfo.verify = function verify(message) { + ListOperationsRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.location != null && message.hasOwnProperty("location")) { - if (!Array.isArray(message.location)) - return "location: array expected"; - for (var i = 0; i < message.location.length; ++i) { - var error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i]); - if (error) - return "location." + error; - } - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; return null; }; /** - * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * Creates a ListOperationsRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.longrunning.ListOperationsRequest * @static * @param {Object.} object Plain object - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest */ - SourceCodeInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.SourceCodeInfo) + ListOperationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.ListOperationsRequest) return object; - var message = new $root.google.protobuf.SourceCodeInfo(); - if (object.location) { - if (!Array.isArray(object.location)) - throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); - message.location = []; - for (var i = 0; i < object.location.length; ++i) { - if (typeof object.location[i] !== "object") - throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); - message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i]); - } - } + var message = new $root.google.longrunning.ListOperationsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.filter != null) + message.filter = String(object.filter); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); return message; }; /** - * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * Creates a plain object from a ListOperationsRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.longrunning.ListOperationsRequest * @static - * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo + * @param {google.longrunning.ListOperationsRequest} message ListOperationsRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SourceCodeInfo.toObject = function toObject(message, options) { + ListOperationsRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.location = []; - if (message.location && message.location.length) { - object.location = []; - for (var j = 0; j < message.location.length; ++j) - object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options); + if (options.defaults) { + object.filter = ""; + object.pageSize = 0; + object.pageToken = ""; + object.name = ""; } + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this SourceCodeInfo to JSON. + * Converts this ListOperationsRequest to JSON. * @function toJSON - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.longrunning.ListOperationsRequest * @instance * @returns {Object.} JSON object */ - SourceCodeInfo.prototype.toJSON = function toJSON() { + ListOperationsRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for SourceCodeInfo + * Gets the default type url for ListOperationsRequest * @function getTypeUrl - * @memberof google.protobuf.SourceCodeInfo + * @memberof google.longrunning.ListOperationsRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - SourceCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + ListOperationsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.SourceCodeInfo"; + return typeUrlPrefix + "/google.longrunning.ListOperationsRequest"; }; - SourceCodeInfo.Location = (function() { - - /** - * Properties of a Location. - * @memberof google.protobuf.SourceCodeInfo - * @interface ILocation - * @property {Array.|null} [path] Location path - * @property {Array.|null} [span] Location span - * @property {string|null} [leadingComments] Location leadingComments - * @property {string|null} [trailingComments] Location trailingComments - * @property {Array.|null} [leadingDetachedComments] Location leadingDetachedComments - */ - - /** - * Constructs a new Location. - * @memberof google.protobuf.SourceCodeInfo - * @classdesc Represents a Location. - * @implements ILocation - * @constructor - * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set - */ - function Location(properties) { - this.path = []; - this.span = []; - this.leadingDetachedComments = []; - 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]]; - } + return ListOperationsRequest; + })(); - /** - * Location path. - * @member {Array.} path - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.path = $util.emptyArray; + longrunning.ListOperationsResponse = (function() { - /** - * Location span. - * @member {Array.} span - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.span = $util.emptyArray; + /** + * Properties of a ListOperationsResponse. + * @memberof google.longrunning + * @interface IListOperationsResponse + * @property {Array.|null} [operations] ListOperationsResponse operations + * @property {string|null} [nextPageToken] ListOperationsResponse nextPageToken + */ - /** - * Location leadingComments. - * @member {string} leadingComments - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.leadingComments = ""; + /** + * Constructs a new ListOperationsResponse. + * @memberof google.longrunning + * @classdesc Represents a ListOperationsResponse. + * @implements IListOperationsResponse + * @constructor + * @param {google.longrunning.IListOperationsResponse=} [properties] Properties to set + */ + function ListOperationsResponse(properties) { + this.operations = []; + 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]]; + } - /** - * Location trailingComments. - * @member {string} trailingComments - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.trailingComments = ""; + /** + * ListOperationsResponse operations. + * @member {Array.} operations + * @memberof google.longrunning.ListOperationsResponse + * @instance + */ + ListOperationsResponse.prototype.operations = $util.emptyArray; - /** - * Location leadingDetachedComments. - * @member {Array.} leadingDetachedComments - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.leadingDetachedComments = $util.emptyArray; + /** + * ListOperationsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.longrunning.ListOperationsResponse + * @instance + */ + ListOperationsResponse.prototype.nextPageToken = ""; - /** - * Creates a new Location instance using the specified properties. - * @function create - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set - * @returns {google.protobuf.SourceCodeInfo.Location} Location instance - */ - Location.create = function create(properties) { - return new Location(properties); - }; + /** + * Creates a new ListOperationsResponse instance using the specified properties. + * @function create + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse=} [properties] Properties to set + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse instance + */ + ListOperationsResponse.create = function create(properties) { + return new ListOperationsResponse(properties); + }; - /** - * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. - * @function encode - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Location.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && message.path.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (var i = 0; i < message.path.length; ++i) - writer.int32(message.path[i]); - writer.ldelim(); - } - if (message.span != null && message.span.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.span.length; ++i) - writer.int32(message.span[i]); - writer.ldelim(); - } - if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); - if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailingComments); - if (message.leadingDetachedComments != null && message.leadingDetachedComments.length) - for (var i = 0; i < message.leadingDetachedComments.length; ++i) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.leadingDetachedComments[i]); - return writer; - }; + /** + * Encodes the specified ListOperationsResponse message. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @function encode + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse} message ListOperationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operations != null && message.operations.length) + for (var i = 0; i < message.operations.length; ++i) + $root.google.longrunning.Operation.encode(message.operations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; - /** - * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Location.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified ListOperationsResponse message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse} message ListOperationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a Location message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.SourceCodeInfo.Location} Location - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Location.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.ListOperationsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.operations && message.operations.length)) + message.operations = []; + message.operations.push($root.google.longrunning.Operation.decode(reader, reader.uint32())); break; - switch (tag >>> 3) { - case 1: { - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.path.push(reader.int32()); - } else - message.path.push(reader.int32()); - break; - } - case 2: { - if (!(message.span && message.span.length)) - message.span = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.span.push(reader.int32()); - } else - message.span.push(reader.int32()); - break; - } - case 3: { - message.leadingComments = reader.string(); - break; - } - case 4: { - message.trailingComments = reader.string(); - break; - } - case 6: { - if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) - message.leadingDetachedComments = []; - message.leadingDetachedComments.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); + } + case 2: { + message.nextPageToken = reader.string(); break; } + default: + reader.skipType(tag & 7); + break; } - return message; - }; + } + return message; + }; - /** - * Decodes a Location message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.SourceCodeInfo.Location} Location - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Location.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a Location message. - * @function verify - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Location.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) { - if (!Array.isArray(message.path)) - return "path: array expected"; - for (var i = 0; i < message.path.length; ++i) - if (!$util.isInteger(message.path[i])) - return "path: integer[] expected"; - } - if (message.span != null && message.hasOwnProperty("span")) { - if (!Array.isArray(message.span)) - return "span: array expected"; - for (var i = 0; i < message.span.length; ++i) - if (!$util.isInteger(message.span[i])) - return "span: integer[] expected"; + /** + * Verifies a ListOperationsResponse message. + * @function verify + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListOperationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.operations != null && message.hasOwnProperty("operations")) { + if (!Array.isArray(message.operations)) + return "operations: array expected"; + for (var i = 0; i < message.operations.length; ++i) { + var error = $root.google.longrunning.Operation.verify(message.operations[i]); + if (error) + return "operations." + error; } - if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) - if (!$util.isString(message.leadingComments)) - return "leadingComments: string expected"; - if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) - if (!$util.isString(message.trailingComments)) - return "trailingComments: string expected"; - if (message.leadingDetachedComments != null && message.hasOwnProperty("leadingDetachedComments")) { - if (!Array.isArray(message.leadingDetachedComments)) - return "leadingDetachedComments: array expected"; - for (var i = 0; i < message.leadingDetachedComments.length; ++i) - if (!$util.isString(message.leadingDetachedComments[i])) - return "leadingDetachedComments: string[] expected"; + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListOperationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + */ + ListOperationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.ListOperationsResponse) + return object; + var message = new $root.google.longrunning.ListOperationsResponse(); + if (object.operations) { + if (!Array.isArray(object.operations)) + throw TypeError(".google.longrunning.ListOperationsResponse.operations: array expected"); + message.operations = []; + for (var i = 0; i < object.operations.length; ++i) { + if (typeof object.operations[i] !== "object") + throw TypeError(".google.longrunning.ListOperationsResponse.operations: object expected"); + message.operations[i] = $root.google.longrunning.Operation.fromObject(object.operations[i]); } - return null; - }; + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListOperationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.ListOperationsResponse} message ListOperationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListOperationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.operations = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.operations && message.operations.length) { + object.operations = []; + for (var j = 0; j < message.operations.length; ++j) + object.operations[j] = $root.google.longrunning.Operation.toObject(message.operations[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListOperationsResponse to JSON. + * @function toJSON + * @memberof google.longrunning.ListOperationsResponse + * @instance + * @returns {Object.} JSON object + */ + ListOperationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListOperationsResponse + * @function getTypeUrl + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListOperationsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.ListOperationsResponse"; + }; + + return ListOperationsResponse; + })(); + + longrunning.CancelOperationRequest = (function() { + + /** + * Properties of a CancelOperationRequest. + * @memberof google.longrunning + * @interface ICancelOperationRequest + * @property {string|null} [name] CancelOperationRequest name + */ + + /** + * Constructs a new CancelOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a CancelOperationRequest. + * @implements ICancelOperationRequest + * @constructor + * @param {google.longrunning.ICancelOperationRequest=} [properties] Properties to set + */ + function CancelOperationRequest(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]]; + } + + /** + * CancelOperationRequest name. + * @member {string} name + * @memberof google.longrunning.CancelOperationRequest + * @instance + */ + CancelOperationRequest.prototype.name = ""; + + /** + * Creates a new CancelOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest instance + */ + CancelOperationRequest.create = function create(properties) { + return new CancelOperationRequest(properties); + }; + + /** + * Encodes the specified CancelOperationRequest message. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest} message CancelOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelOperationRequest.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; + }; - /** - * Creates a Location message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.SourceCodeInfo.Location} Location - */ - Location.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) - return object; - var message = new $root.google.protobuf.SourceCodeInfo.Location(); - if (object.path) { - if (!Array.isArray(object.path)) - throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); - message.path = []; - for (var i = 0; i < object.path.length; ++i) - message.path[i] = object.path[i] | 0; - } - if (object.span) { - if (!Array.isArray(object.span)) - throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); - message.span = []; - for (var i = 0; i < object.span.length; ++i) - message.span[i] = object.span[i] | 0; - } - if (object.leadingComments != null) - message.leadingComments = String(object.leadingComments); - if (object.trailingComments != null) - message.trailingComments = String(object.trailingComments); - if (object.leadingDetachedComments) { - if (!Array.isArray(object.leadingDetachedComments)) - throw TypeError(".google.protobuf.SourceCodeInfo.Location.leadingDetachedComments: array expected"); - message.leadingDetachedComments = []; - for (var i = 0; i < object.leadingDetachedComments.length; ++i) - message.leadingDetachedComments[i] = String(object.leadingDetachedComments[i]); - } - return message; - }; + /** + * Encodes the specified CancelOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest} message CancelOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a plain object from a Location message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.Location} message Location - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Location.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.path = []; - object.span = []; - object.leadingDetachedComments = []; - } - if (options.defaults) { - object.leadingComments = ""; - object.trailingComments = ""; - } - if (message.path && message.path.length) { - object.path = []; - for (var j = 0; j < message.path.length; ++j) - object.path[j] = message.path[j]; - } - if (message.span && message.span.length) { - object.span = []; - for (var j = 0; j < message.span.length; ++j) - object.span[j] = message.span[j]; - } - if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) - object.leadingComments = message.leadingComments; - if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) - object.trailingComments = message.trailingComments; - if (message.leadingDetachedComments && message.leadingDetachedComments.length) { - object.leadingDetachedComments = []; - for (var j = 0; j < message.leadingDetachedComments.length; ++j) - object.leadingDetachedComments[j] = message.leadingDetachedComments[j]; + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelOperationRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.CancelOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; } + } + return message; + }; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CancelOperationRequest message. + * @function verify + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CancelOperationRequest.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 CancelOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + */ + CancelOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.CancelOperationRequest) return object; - }; + var message = new $root.google.longrunning.CancelOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; - /** - * Converts this Location to JSON. - * @function toJSON - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - * @returns {Object.} JSON object - */ - Location.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a CancelOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.CancelOperationRequest} message CancelOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CancelOperationRequest.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; + }; - /** - * Gets the default type url for Location - * @function getTypeUrl - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Location.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.SourceCodeInfo.Location"; - }; + /** + * Converts this CancelOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.CancelOperationRequest + * @instance + * @returns {Object.} JSON object + */ + CancelOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return Location; - })(); + /** + * Gets the default type url for CancelOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CancelOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.CancelOperationRequest"; + }; - return SourceCodeInfo; + return CancelOperationRequest; })(); - protobuf.GeneratedCodeInfo = (function() { + longrunning.DeleteOperationRequest = (function() { /** - * Properties of a GeneratedCodeInfo. - * @memberof google.protobuf - * @interface IGeneratedCodeInfo - * @property {Array.|null} [annotation] GeneratedCodeInfo annotation + * Properties of a DeleteOperationRequest. + * @memberof google.longrunning + * @interface IDeleteOperationRequest + * @property {string|null} [name] DeleteOperationRequest name */ /** - * Constructs a new GeneratedCodeInfo. - * @memberof google.protobuf - * @classdesc Represents a GeneratedCodeInfo. - * @implements IGeneratedCodeInfo + * Constructs a new DeleteOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a DeleteOperationRequest. + * @implements IDeleteOperationRequest * @constructor - * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + * @param {google.longrunning.IDeleteOperationRequest=} [properties] Properties to set */ - function GeneratedCodeInfo(properties) { - this.annotation = []; + function DeleteOperationRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23265,80 +34453,77 @@ } /** - * GeneratedCodeInfo annotation. - * @member {Array.} annotation - * @memberof google.protobuf.GeneratedCodeInfo + * DeleteOperationRequest name. + * @member {string} name + * @memberof google.longrunning.DeleteOperationRequest * @instance */ - GeneratedCodeInfo.prototype.annotation = $util.emptyArray; + DeleteOperationRequest.prototype.name = ""; /** - * Creates a new GeneratedCodeInfo instance using the specified properties. + * Creates a new DeleteOperationRequest instance using the specified properties. * @function create - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.longrunning.DeleteOperationRequest * @static - * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance + * @param {google.longrunning.IDeleteOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest instance */ - GeneratedCodeInfo.create = function create(properties) { - return new GeneratedCodeInfo(properties); + DeleteOperationRequest.create = function create(properties) { + return new DeleteOperationRequest(properties); }; /** - * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * Encodes the specified DeleteOperationRequest message. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. * @function encode - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.longrunning.DeleteOperationRequest * @static - * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {google.longrunning.IDeleteOperationRequest} message DeleteOperationRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GeneratedCodeInfo.encode = function encode(message, writer) { + DeleteOperationRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.annotation != null && message.annotation.length) - for (var i = 0; i < message.annotation.length; ++i) - $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); return writer; }; /** - * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * Encodes the specified DeleteOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.longrunning.DeleteOperationRequest * @static - * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {google.longrunning.IDeleteOperationRequest} message DeleteOperationRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + DeleteOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * Decodes a DeleteOperationRequest message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.longrunning.DeleteOperationRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GeneratedCodeInfo.decode = function decode(reader, length, error) { + DeleteOperationRequest.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.DeleteOperationRequest(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - if (!(message.annotation && message.annotation.length)) - message.annotation = []; - message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); + message.name = reader.string(); break; } default: @@ -23350,503 +34535,357 @@ }; /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * Decodes a DeleteOperationRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.longrunning.DeleteOperationRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { + DeleteOperationRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GeneratedCodeInfo message. + * Verifies a DeleteOperationRequest message. * @function verify - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.longrunning.DeleteOperationRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GeneratedCodeInfo.verify = function verify(message) { + DeleteOperationRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.annotation != null && message.hasOwnProperty("annotation")) { - if (!Array.isArray(message.annotation)) - return "annotation: array expected"; - for (var i = 0; i < message.annotation.length; ++i) { - var error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i]); - if (error) - return "annotation." + error; - } - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; return null; }; /** - * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * Creates a DeleteOperationRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.longrunning.DeleteOperationRequest * @static * @param {Object.} object Plain object - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest */ - GeneratedCodeInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.GeneratedCodeInfo) + DeleteOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.DeleteOperationRequest) return object; - var message = new $root.google.protobuf.GeneratedCodeInfo(); - if (object.annotation) { - if (!Array.isArray(object.annotation)) - throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); - message.annotation = []; - for (var i = 0; i < object.annotation.length; ++i) { - if (typeof object.annotation[i] !== "object") - throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); - message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i]); - } - } + var message = new $root.google.longrunning.DeleteOperationRequest(); + if (object.name != null) + message.name = String(object.name); return message; }; /** - * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * Creates a plain object from a DeleteOperationRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.longrunning.DeleteOperationRequest * @static - * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo + * @param {google.longrunning.DeleteOperationRequest} message DeleteOperationRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GeneratedCodeInfo.toObject = function toObject(message, options) { + DeleteOperationRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.annotation = []; - if (message.annotation && message.annotation.length) { - object.annotation = []; - for (var j = 0; j < message.annotation.length; ++j) - object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options); - } + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; return object; }; /** - * Converts this GeneratedCodeInfo to JSON. + * Converts this DeleteOperationRequest to JSON. * @function toJSON - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.longrunning.DeleteOperationRequest * @instance * @returns {Object.} JSON object */ - GeneratedCodeInfo.prototype.toJSON = function toJSON() { + DeleteOperationRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for GeneratedCodeInfo + * Gets the default type url for DeleteOperationRequest * @function getTypeUrl - * @memberof google.protobuf.GeneratedCodeInfo + * @memberof google.longrunning.DeleteOperationRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - GeneratedCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + DeleteOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo"; + return typeUrlPrefix + "/google.longrunning.DeleteOperationRequest"; }; - GeneratedCodeInfo.Annotation = (function() { - - /** - * Properties of an Annotation. - * @memberof google.protobuf.GeneratedCodeInfo - * @interface IAnnotation - * @property {Array.|null} [path] Annotation path - * @property {string|null} [sourceFile] Annotation sourceFile - * @property {number|null} [begin] Annotation begin - * @property {number|null} [end] Annotation end - * @property {google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null} [semantic] Annotation semantic - */ - - /** - * Constructs a new Annotation. - * @memberof google.protobuf.GeneratedCodeInfo - * @classdesc Represents an Annotation. - * @implements IAnnotation - * @constructor - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set - */ - function Annotation(properties) { - this.path = []; - 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]]; - } - - /** - * Annotation path. - * @member {Array.} path - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.path = $util.emptyArray; - - /** - * Annotation sourceFile. - * @member {string} sourceFile - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.sourceFile = ""; - - /** - * Annotation begin. - * @member {number} begin - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.begin = 0; + return DeleteOperationRequest; + })(); - /** - * Annotation end. - * @member {number} end - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.end = 0; + longrunning.WaitOperationRequest = (function() { - /** - * Annotation semantic. - * @member {google.protobuf.GeneratedCodeInfo.Annotation.Semantic} semantic - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.semantic = 0; + /** + * Properties of a WaitOperationRequest. + * @memberof google.longrunning + * @interface IWaitOperationRequest + * @property {string|null} [name] WaitOperationRequest name + * @property {google.protobuf.IDuration|null} [timeout] WaitOperationRequest timeout + */ - /** - * Creates a new Annotation instance using the specified properties. - * @function create - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation instance - */ - Annotation.create = function create(properties) { - return new Annotation(properties); - }; + /** + * Constructs a new WaitOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a WaitOperationRequest. + * @implements IWaitOperationRequest + * @constructor + * @param {google.longrunning.IWaitOperationRequest=} [properties] Properties to set + */ + function WaitOperationRequest(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]]; + } - /** - * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. - * @function encode - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Annotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && message.path.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (var i = 0; i < message.path.length; ++i) - writer.int32(message.path[i]); - writer.ldelim(); - } - if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); - if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); - if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.semantic); - return writer; - }; + /** + * WaitOperationRequest name. + * @member {string} name + * @memberof google.longrunning.WaitOperationRequest + * @instance + */ + WaitOperationRequest.prototype.name = ""; - /** - * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Annotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * WaitOperationRequest timeout. + * @member {google.protobuf.IDuration|null|undefined} timeout + * @memberof google.longrunning.WaitOperationRequest + * @instance + */ + WaitOperationRequest.prototype.timeout = null; - /** - * Decodes an Annotation message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Annotation.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.path.push(reader.int32()); - } else - message.path.push(reader.int32()); - break; - } - case 2: { - message.sourceFile = reader.string(); - break; - } - case 3: { - message.begin = reader.int32(); - break; - } - case 4: { - message.end = reader.int32(); - break; - } - case 5: { - message.semantic = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a new WaitOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest instance + */ + WaitOperationRequest.create = function create(properties) { + return new WaitOperationRequest(properties); + }; - /** - * Decodes an Annotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Annotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified WaitOperationRequest message. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest} message WaitOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitOperationRequest.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); + if (message.timeout != null && Object.hasOwnProperty.call(message, "timeout")) + $root.google.protobuf.Duration.encode(message.timeout, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; - /** - * Verifies an Annotation message. - * @function verify - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Annotation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) { - if (!Array.isArray(message.path)) - return "path: array expected"; - for (var i = 0; i < message.path.length; ++i) - if (!$util.isInteger(message.path[i])) - return "path: integer[] expected"; - } - if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) - if (!$util.isString(message.sourceFile)) - return "sourceFile: string expected"; - if (message.begin != null && message.hasOwnProperty("begin")) - if (!$util.isInteger(message.begin)) - return "begin: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; - if (message.semantic != null && message.hasOwnProperty("semantic")) - switch (message.semantic) { - default: - return "semantic: enum value expected"; - case 0: - case 1: - case 2: + /** + * Encodes the specified WaitOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest} message WaitOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitOperationRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.WaitOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); break; } - return null; - }; - - /** - * Creates an Annotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation - */ - Annotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) - return object; - var message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); - if (object.path) { - if (!Array.isArray(object.path)) - throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation.path: array expected"); - message.path = []; - for (var i = 0; i < object.path.length; ++i) - message.path[i] = object.path[i] | 0; - } - if (object.sourceFile != null) - message.sourceFile = String(object.sourceFile); - if (object.begin != null) - message.begin = object.begin | 0; - if (object.end != null) - message.end = object.end | 0; - switch (object.semantic) { - default: - if (typeof object.semantic === "number") { - message.semantic = object.semantic; + case 2: { + message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); break; } - break; - case "NONE": - case 0: - message.semantic = 0; - break; - case "SET": - case 1: - message.semantic = 1; - break; - case "ALIAS": - case 2: - message.semantic = 2; + default: + reader.skipType(tag & 7); break; } - return message; - }; + } + return message; + }; - /** - * Creates a plain object from an Annotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.Annotation} message Annotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Annotation.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.path = []; - if (options.defaults) { - object.sourceFile = ""; - object.begin = 0; - object.end = 0; - object.semantic = options.enums === String ? "NONE" : 0; - } - if (message.path && message.path.length) { - object.path = []; - for (var j = 0; j < message.path.length; ++j) - object.path[j] = message.path[j]; - } - if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) - object.sourceFile = message.sourceFile; - if (message.begin != null && message.hasOwnProperty("begin")) - object.begin = message.begin; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; - if (message.semantic != null && message.hasOwnProperty("semantic")) - object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] === undefined ? message.semantic : $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; - return object; - }; + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Converts this Annotation to JSON. - * @function toJSON - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - * @returns {Object.} JSON object - */ - Annotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Verifies a WaitOperationRequest message. + * @function verify + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WaitOperationRequest.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"; + if (message.timeout != null && message.hasOwnProperty("timeout")) { + var error = $root.google.protobuf.Duration.verify(message.timeout); + if (error) + return "timeout." + error; + } + return null; + }; - /** - * Gets the default type url for Annotation - * @function getTypeUrl - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Annotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo.Annotation"; - }; + /** + * Creates a WaitOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + */ + WaitOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.WaitOperationRequest) + return object; + var message = new $root.google.longrunning.WaitOperationRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.timeout != null) { + if (typeof object.timeout !== "object") + throw TypeError(".google.longrunning.WaitOperationRequest.timeout: object expected"); + message.timeout = $root.google.protobuf.Duration.fromObject(object.timeout); + } + return message; + }; - /** - * Semantic enum. - * @name google.protobuf.GeneratedCodeInfo.Annotation.Semantic - * @enum {number} - * @property {number} NONE=0 NONE value - * @property {number} SET=1 SET value - * @property {number} ALIAS=2 ALIAS value - */ - Annotation.Semantic = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "NONE"] = 0; - values[valuesById[1] = "SET"] = 1; - values[valuesById[2] = "ALIAS"] = 2; - return values; - })(); + /** + * Creates a plain object from a WaitOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.WaitOperationRequest} message WaitOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WaitOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.timeout = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.timeout != null && message.hasOwnProperty("timeout")) + object.timeout = $root.google.protobuf.Duration.toObject(message.timeout, options); + return object; + }; - return Annotation; - })(); + /** + * Converts this WaitOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.WaitOperationRequest + * @instance + * @returns {Object.} JSON object + */ + WaitOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return GeneratedCodeInfo; + /** + * Gets the default type url for WaitOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WaitOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.WaitOperationRequest"; + }; + + return WaitOperationRequest; })(); - protobuf.Duration = (function() { + longrunning.OperationInfo = (function() { /** - * Properties of a Duration. - * @memberof google.protobuf - * @interface IDuration - * @property {number|Long|null} [seconds] Duration seconds - * @property {number|null} [nanos] Duration nanos + * Properties of an OperationInfo. + * @memberof google.longrunning + * @interface IOperationInfo + * @property {string|null} [responseType] OperationInfo responseType + * @property {string|null} [metadataType] OperationInfo metadataType */ /** - * Constructs a new Duration. - * @memberof google.protobuf - * @classdesc Represents a Duration. - * @implements IDuration + * Constructs a new OperationInfo. + * @memberof google.longrunning + * @classdesc Represents an OperationInfo. + * @implements IOperationInfo * @constructor - * @param {google.protobuf.IDuration=} [properties] Properties to set + * @param {google.longrunning.IOperationInfo=} [properties] Properties to set */ - function Duration(properties) { + function OperationInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -23854,91 +34893,91 @@ } /** - * Duration seconds. - * @member {number|Long} seconds - * @memberof google.protobuf.Duration + * OperationInfo responseType. + * @member {string} responseType + * @memberof google.longrunning.OperationInfo * @instance */ - Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + OperationInfo.prototype.responseType = ""; /** - * Duration nanos. - * @member {number} nanos - * @memberof google.protobuf.Duration + * OperationInfo metadataType. + * @member {string} metadataType + * @memberof google.longrunning.OperationInfo * @instance */ - Duration.prototype.nanos = 0; + OperationInfo.prototype.metadataType = ""; /** - * Creates a new Duration instance using the specified properties. + * Creates a new OperationInfo instance using the specified properties. * @function create - * @memberof google.protobuf.Duration + * @memberof google.longrunning.OperationInfo * @static - * @param {google.protobuf.IDuration=} [properties] Properties to set - * @returns {google.protobuf.Duration} Duration instance + * @param {google.longrunning.IOperationInfo=} [properties] Properties to set + * @returns {google.longrunning.OperationInfo} OperationInfo instance */ - Duration.create = function create(properties) { - return new Duration(properties); + OperationInfo.create = function create(properties) { + return new OperationInfo(properties); }; /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * Encodes the specified OperationInfo message. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. * @function encode - * @memberof google.protobuf.Duration + * @memberof google.longrunning.OperationInfo * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Duration.encode = function encode(message, writer) { + OperationInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + if (message.responseType != null && Object.hasOwnProperty.call(message, "responseType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseType); + if (message.metadataType != null && Object.hasOwnProperty.call(message, "metadataType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.metadataType); return writer; }; /** - * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * Encodes the specified OperationInfo message, length delimited. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Duration + * @memberof google.longrunning.OperationInfo * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Duration.encodeDelimited = function encodeDelimited(message, writer) { + OperationInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Duration message from the specified reader or buffer. + * Decodes an OperationInfo message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Duration + * @memberof google.longrunning.OperationInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Duration} Duration + * @returns {google.longrunning.OperationInfo} OperationInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Duration.decode = function decode(reader, length, error) { + OperationInfo.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.OperationInfo(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - message.seconds = reader.int64(); + message.responseType = reader.string(); break; } case 2: { - message.nanos = reader.int32(); + message.metadataType = reader.string(); break; } default: @@ -23950,146 +34989,146 @@ }; /** - * Decodes a Duration message from the specified reader or buffer, length delimited. + * Decodes an OperationInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Duration + * @memberof google.longrunning.OperationInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Duration} Duration + * @returns {google.longrunning.OperationInfo} OperationInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Duration.decodeDelimited = function decodeDelimited(reader) { + OperationInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Duration message. + * Verifies an OperationInfo message. * @function verify - * @memberof google.protobuf.Duration + * @memberof google.longrunning.OperationInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Duration.verify = function verify(message) { + OperationInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) - return "seconds: integer|Long expected"; - if (message.nanos != null && message.hasOwnProperty("nanos")) - if (!$util.isInteger(message.nanos)) - return "nanos: integer expected"; + if (message.responseType != null && message.hasOwnProperty("responseType")) + if (!$util.isString(message.responseType)) + return "responseType: string expected"; + if (message.metadataType != null && message.hasOwnProperty("metadataType")) + if (!$util.isString(message.metadataType)) + return "metadataType: string expected"; return null; }; /** - * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * Creates an OperationInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Duration + * @memberof google.longrunning.OperationInfo * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Duration} Duration + * @returns {google.longrunning.OperationInfo} OperationInfo */ - Duration.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Duration) + OperationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.OperationInfo) return object; - var message = new $root.google.protobuf.Duration(); - if (object.seconds != null) - if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; - else if (typeof object.seconds === "string") - message.seconds = parseInt(object.seconds, 10); - else if (typeof object.seconds === "number") - message.seconds = object.seconds; - else if (typeof object.seconds === "object") - message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); - if (object.nanos != null) - message.nanos = object.nanos | 0; + var message = new $root.google.longrunning.OperationInfo(); + if (object.responseType != null) + message.responseType = String(object.responseType); + if (object.metadataType != null) + message.metadataType = String(object.metadataType); return message; }; /** - * Creates a plain object from a Duration message. Also converts values to other types if specified. + * Creates a plain object from an OperationInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Duration + * @memberof google.longrunning.OperationInfo * @static - * @param {google.protobuf.Duration} message Duration + * @param {google.longrunning.OperationInfo} message OperationInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Duration.toObject = function toObject(message, options) { + OperationInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.seconds = options.longs === String ? "0" : 0; - object.nanos = 0; + object.responseType = ""; + object.metadataType = ""; } - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (typeof message.seconds === "number") - object.seconds = options.longs === String ? String(message.seconds) : message.seconds; - else - object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; - if (message.nanos != null && message.hasOwnProperty("nanos")) - object.nanos = message.nanos; + if (message.responseType != null && message.hasOwnProperty("responseType")) + object.responseType = message.responseType; + if (message.metadataType != null && message.hasOwnProperty("metadataType")) + object.metadataType = message.metadataType; return object; }; /** - * Converts this Duration to JSON. + * Converts this OperationInfo to JSON. * @function toJSON - * @memberof google.protobuf.Duration + * @memberof google.longrunning.OperationInfo * @instance * @returns {Object.} JSON object */ - Duration.prototype.toJSON = function toJSON() { + OperationInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Duration + * Gets the default type url for OperationInfo * @function getTypeUrl - * @memberof google.protobuf.Duration + * @memberof google.longrunning.OperationInfo * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Duration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + OperationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.Duration"; + return typeUrlPrefix + "/google.longrunning.OperationInfo"; }; - return Duration; + return OperationInfo; })(); - protobuf.Timestamp = (function() { + return longrunning; + })(); + + google.rpc = (function() { + + /** + * Namespace rpc. + * @memberof google + * @namespace + */ + var rpc = {}; + + rpc.Status = (function() { /** - * Properties of a Timestamp. - * @memberof google.protobuf - * @interface ITimestamp - * @property {number|Long|null} [seconds] Timestamp seconds - * @property {number|null} [nanos] Timestamp nanos + * Properties of a Status. + * @memberof google.rpc + * @interface IStatus + * @property {number|null} [code] Status code + * @property {string|null} [message] Status message + * @property {Array.|null} [details] Status details */ /** - * Constructs a new Timestamp. - * @memberof google.protobuf - * @classdesc Represents a Timestamp. - * @implements ITimestamp + * Constructs a new Status. + * @memberof google.rpc + * @classdesc Represents a Status. + * @implements IStatus * @constructor - * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @param {google.rpc.IStatus=} [properties] Properties to set */ - function Timestamp(properties) { + function Status(properties) { + this.details = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -24097,91 +35136,108 @@ } /** - * Timestamp seconds. - * @member {number|Long} seconds - * @memberof google.protobuf.Timestamp + * Status code. + * @member {number} code + * @memberof google.rpc.Status * @instance */ - Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Status.prototype.code = 0; /** - * Timestamp nanos. - * @member {number} nanos - * @memberof google.protobuf.Timestamp + * Status message. + * @member {string} message + * @memberof google.rpc.Status * @instance */ - Timestamp.prototype.nanos = 0; + Status.prototype.message = ""; /** - * Creates a new Timestamp instance using the specified properties. + * Status details. + * @member {Array.} details + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.details = $util.emptyArray; + + /** + * Creates a new Status instance using the specified properties. * @function create - * @memberof google.protobuf.Timestamp + * @memberof google.rpc.Status * @static - * @param {google.protobuf.ITimestamp=} [properties] Properties to set - * @returns {google.protobuf.Timestamp} Timestamp instance + * @param {google.rpc.IStatus=} [properties] Properties to set + * @returns {google.rpc.Status} Status instance */ - Timestamp.create = function create(properties) { - return new Timestamp(properties); + Status.create = function create(properties) { + return new Status(properties); }; /** - * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. * @function encode - * @memberof google.protobuf.Timestamp + * @memberof google.rpc.Status * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {google.rpc.IStatus} message Status message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Timestamp.encode = function encode(message, writer) { + Status.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.details != null && message.details.length) + for (var i = 0; i < message.details.length; ++i) + $root.google.protobuf.Any.encode(message.details[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.Timestamp + * @memberof google.rpc.Status * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {google.rpc.IStatus} message Status message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Timestamp.encodeDelimited = function encodeDelimited(message, writer) { + Status.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Timestamp message from the specified reader or buffer. + * Decodes a Status message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.Timestamp + * @memberof google.rpc.Status * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Timestamp} Timestamp + * @returns {google.rpc.Status} Status * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Timestamp.decode = function decode(reader, length, error) { + Status.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.Status(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - message.seconds = reader.int64(); + message.code = reader.int32(); break; } case 2: { - message.nanos = reader.int32(); + message.message = reader.string(); + break; + } + case 3: { + if (!(message.details && message.details.length)) + message.details = []; + message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); break; } default: @@ -24193,128 +35249,140 @@ }; /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * Decodes a Status message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.Timestamp + * @memberof google.rpc.Status * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Timestamp} Timestamp + * @returns {google.rpc.Status} Status * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Timestamp.decodeDelimited = function decodeDelimited(reader) { + Status.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Timestamp message. + * Verifies a Status message. * @function verify - * @memberof google.protobuf.Timestamp + * @memberof google.rpc.Status * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Timestamp.verify = function verify(message) { + Status.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) - return "seconds: integer|Long expected"; - if (message.nanos != null && message.hasOwnProperty("nanos")) - if (!$util.isInteger(message.nanos)) - return "nanos: integer expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.details != null && message.hasOwnProperty("details")) { + if (!Array.isArray(message.details)) + return "details: array expected"; + for (var i = 0; i < message.details.length; ++i) { + var error = $root.google.protobuf.Any.verify(message.details[i]); + if (error) + return "details." + error; + } + } return null; }; /** - * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * Creates a Status message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.Timestamp + * @memberof google.rpc.Status * @static * @param {Object.} object Plain object - * @returns {google.protobuf.Timestamp} Timestamp + * @returns {google.rpc.Status} Status */ - Timestamp.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Timestamp) + Status.fromObject = function fromObject(object) { + if (object instanceof $root.google.rpc.Status) return object; - var message = new $root.google.protobuf.Timestamp(); - if (object.seconds != null) - if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; - else if (typeof object.seconds === "string") - message.seconds = parseInt(object.seconds, 10); - else if (typeof object.seconds === "number") - message.seconds = object.seconds; - else if (typeof object.seconds === "object") - message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); - if (object.nanos != null) - message.nanos = object.nanos | 0; + var message = new $root.google.rpc.Status(); + if (object.code != null) + message.code = object.code | 0; + if (object.message != null) + message.message = String(object.message); + if (object.details) { + if (!Array.isArray(object.details)) + throw TypeError(".google.rpc.Status.details: array expected"); + message.details = []; + for (var i = 0; i < object.details.length; ++i) { + if (typeof object.details[i] !== "object") + throw TypeError(".google.rpc.Status.details: object expected"); + message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i]); + } + } return message; }; /** - * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * Creates a plain object from a Status message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.Timestamp + * @memberof google.rpc.Status * @static - * @param {google.protobuf.Timestamp} message Timestamp + * @param {google.rpc.Status} message Status * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Timestamp.toObject = function toObject(message, options) { + Status.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.details = []; if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.seconds = options.longs === String ? "0" : 0; - object.nanos = 0; + object.code = 0; + object.message = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.details && message.details.length) { + object.details = []; + for (var j = 0; j < message.details.length; ++j) + object.details[j] = $root.google.protobuf.Any.toObject(message.details[j], options); } - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (typeof message.seconds === "number") - object.seconds = options.longs === String ? String(message.seconds) : message.seconds; - else - object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; - if (message.nanos != null && message.hasOwnProperty("nanos")) - object.nanos = message.nanos; return object; }; /** - * Converts this Timestamp to JSON. + * Converts this Status to JSON. * @function toJSON - * @memberof google.protobuf.Timestamp + * @memberof google.rpc.Status * @instance * @returns {Object.} JSON object */ - Timestamp.prototype.toJSON = function toJSON() { + Status.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Timestamp + * Gets the default type url for Status * @function getTypeUrl - * @memberof google.protobuf.Timestamp + * @memberof google.rpc.Status * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Status.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.Timestamp"; + return typeUrlPrefix + "/google.rpc.Status"; }; - return Timestamp; + return Status; })(); - return protobuf; + return rpc; })(); return google; diff --git a/packages/google-cloud-workflows/protos/protos.json b/packages/google-cloud-workflows/protos/protos.json index 3dab82c6d40e..a71962571cfe 100644 --- a/packages/google-cloud-workflows/protos/protos.json +++ b/packages/google-cloud-workflows/protos/protos.json @@ -707,6 +707,869 @@ } } } + }, + "v1": { + "options": { + "go_package": "cloud.google.com/go/workflows/apiv1/workflowspb;workflowspb", + "java_multiple_files": true, + "java_outer_classname": "WorkflowsProto", + "java_package": "com.google.cloud.workflows.v1", + "(google.api.resource_definition).type": "cloudkms.googleapis.com/CryptoKeyVersion", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}" + }, + "nested": { + "Workflows": { + "options": { + "(google.api.default_host)": "workflows.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListWorkflows": { + "requestType": "ListWorkflowsRequest", + "responseType": "ListWorkflowsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/workflows", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/workflows" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetWorkflow": { + "requestType": "GetWorkflowRequest", + "responseType": "Workflow", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/workflows/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/workflows/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateWorkflow": { + "requestType": "CreateWorkflowRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/workflows", + "(google.api.http).body": "workflow", + "(google.api.method_signature)": "parent,workflow,workflow_id", + "(google.longrunning.operation_info).response_type": "Workflow", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*}/workflows", + "body": "workflow" + } + }, + { + "(google.api.method_signature)": "parent,workflow,workflow_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Workflow", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "DeleteWorkflow": { + "requestType": "DeleteWorkflowRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/workflows/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/locations/*/workflows/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "UpdateWorkflow": { + "requestType": "UpdateWorkflowRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v1/{workflow.name=projects/*/locations/*/workflows/*}", + "(google.api.http).body": "workflow", + "(google.api.method_signature)": "workflow,update_mask", + "(google.longrunning.operation_info).response_type": "Workflow", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{workflow.name=projects/*/locations/*/workflows/*}", + "body": "workflow" + } + }, + { + "(google.api.method_signature)": "workflow,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Workflow", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "ListWorkflowRevisions": { + "requestType": "ListWorkflowRevisionsRequest", + "responseType": "ListWorkflowRevisionsResponse", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/workflows/*}:listRevisions" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/workflows/*}:listRevisions" + } + } + ] + } + } + }, + "Workflow": { + "options": { + "(google.api.resource).type": "workflows.googleapis.com/Workflow", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/workflows/{workflow}" + }, + "oneofs": { + "sourceCode": { + "oneof": [ + "sourceContents" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "description": { + "type": "string", + "id": 2 + }, + "state": { + "type": "State", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "revisionId": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "revisionCreateTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8 + }, + "serviceAccount": { + "type": "string", + "id": 9 + }, + "sourceContents": { + "type": "string", + "id": 10 + }, + "cryptoKeyName": { + "type": "string", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKey" + } + }, + "stateError": { + "type": "StateError", + "id": 12, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "callLogLevel": { + "type": "CallLogLevel", + "id": 13, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "userEnvVars": { + "keyType": "string", + "type": "string", + "id": 14, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "executionHistoryLevel": { + "type": "ExecutionHistoryLevel", + "id": 15, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "allKmsKeys": { + "rule": "repeated", + "type": "string", + "id": 16, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKey" + } + }, + "allKmsKeysVersions": { + "rule": "repeated", + "type": "string", + "id": 17, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKeyVersion" + } + }, + "cryptoKeyVersion": { + "type": "string", + "id": 18, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "(google.api.resource_reference).type": "cloudkms.googleapis.com/CryptoKeyVersion" + } + }, + "tags": { + "keyType": "string", + "type": "string", + "id": 19, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ACTIVE": 1, + "UNAVAILABLE": 2 + } + }, + "StateError": { + "fields": { + "details": { + "type": "string", + "id": 1 + }, + "type": { + "type": "Type", + "id": 2 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "KMS_ERROR": 1 + } + } + } + }, + "CallLogLevel": { + "values": { + "CALL_LOG_LEVEL_UNSPECIFIED": 0, + "LOG_ALL_CALLS": 1, + "LOG_ERRORS_ONLY": 2, + "LOG_NONE": 3 + } + } + } + }, + "ListWorkflowsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + }, + "orderBy": { + "type": "string", + "id": 5 + } + } + }, + "ListWorkflowsResponse": { + "fields": { + "workflows": { + "rule": "repeated", + "type": "Workflow", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "GetWorkflowRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "workflows.googleapis.com/Workflow" + } + }, + "revisionId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "CreateWorkflowRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "workflow": { + "type": "Workflow", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "workflowId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteWorkflowRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "workflows.googleapis.com/Workflow" + } + } + } + }, + "UpdateWorkflowRequest": { + "fields": { + "workflow": { + "type": "Workflow", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "OperationMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "target": { + "type": "string", + "id": 3 + }, + "verb": { + "type": "string", + "id": 4 + }, + "apiVersion": { + "type": "string", + "id": 5 + } + } + }, + "ListWorkflowRevisionsRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "workflows.googleapis.com/Workflow" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListWorkflowRevisionsResponse": { + "fields": { + "workflows": { + "rule": "repeated", + "type": "Workflow", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "ExecutionHistoryLevel": { + "values": { + "EXECUTION_HISTORY_LEVEL_UNSPECIFIED": 0, + "EXECUTION_HISTORY_BASIC": 1, + "EXECUTION_HISTORY_DETAILED": 2 + } + } + } + }, + "v1beta": { + "options": { + "go_package": "cloud.google.com/go/workflows/apiv1beta/workflowspb;workflowspb", + "java_multiple_files": true, + "java_outer_classname": "WorkflowsProto", + "java_package": "com.google.cloud.workflows.v1beta" + }, + "nested": { + "Workflows": { + "options": { + "(google.api.default_host)": "workflows.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "ListWorkflows": { + "requestType": "ListWorkflowsRequest", + "responseType": "ListWorkflowsResponse", + "options": { + "(google.api.http).get": "/v1beta/{parent=projects/*/locations/*}/workflows", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta/{parent=projects/*/locations/*}/workflows" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetWorkflow": { + "requestType": "GetWorkflowRequest", + "responseType": "Workflow", + "options": { + "(google.api.http).get": "/v1beta/{name=projects/*/locations/*/workflows/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta/{name=projects/*/locations/*/workflows/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateWorkflow": { + "requestType": "CreateWorkflowRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta/{parent=projects/*/locations/*}/workflows", + "(google.api.http).body": "workflow", + "(google.api.method_signature)": "parent,workflow,workflow_id", + "(google.longrunning.operation_info).response_type": "Workflow", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta/{parent=projects/*/locations/*}/workflows", + "body": "workflow" + } + }, + { + "(google.api.method_signature)": "parent,workflow,workflow_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Workflow", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "DeleteWorkflow": { + "requestType": "DeleteWorkflowRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v1beta/{name=projects/*/locations/*/workflows/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1beta/{name=projects/*/locations/*/workflows/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "OperationMetadata" + } + } + ] + }, + "UpdateWorkflow": { + "requestType": "UpdateWorkflowRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v1beta/{workflow.name=projects/*/locations/*/workflows/*}", + "(google.api.http).body": "workflow", + "(google.api.method_signature)": "workflow,update_mask", + "(google.longrunning.operation_info).response_type": "Workflow", + "(google.longrunning.operation_info).metadata_type": "OperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1beta/{workflow.name=projects/*/locations/*/workflows/*}", + "body": "workflow" + } + }, + { + "(google.api.method_signature)": "workflow,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Workflow", + "metadata_type": "OperationMetadata" + } + } + ] + } + } + }, + "Workflow": { + "options": { + "(google.api.resource).type": "workflows.googleapis.com/Workflow", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/workflows/{workflow}" + }, + "oneofs": { + "sourceCode": { + "oneof": [ + "sourceContents" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "description": { + "type": "string", + "id": 2 + }, + "state": { + "type": "State", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "revisionId": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "revisionCreateTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "labels": { + "keyType": "string", + "type": "string", + "id": 8 + }, + "serviceAccount": { + "type": "string", + "id": 9 + }, + "sourceContents": { + "type": "string", + "id": 10 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ACTIVE": 1 + } + } + } + }, + "ListWorkflowsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + }, + "orderBy": { + "type": "string", + "id": 5 + } + } + }, + "ListWorkflowsResponse": { + "fields": { + "workflows": { + "rule": "repeated", + "type": "Workflow", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3 + } + } + }, + "GetWorkflowRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "workflows.googleapis.com/Workflow" + } + } + } + }, + "CreateWorkflowRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "workflow": { + "type": "Workflow", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "workflowId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteWorkflowRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "workflows.googleapis.com/Workflow" + } + } + } + }, + "UpdateWorkflowRequest": { + "fields": { + "workflow": { + "type": "Workflow", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "OperationMetadata": { + "fields": { + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "target": { + "type": "string", + "id": 3 + }, + "verb": { + "type": "string", + "id": 4 + }, + "apiVersion": { + "type": "string", + "id": 5 + } + } + } + } } } } @@ -718,8 +1581,7 @@ "java_multiple_files": true, "java_outer_classname": "ResourceProto", "java_package": "com.google.api", - "objc_class_prefix": "GAPI", - "cc_enable_arenas": true + "objc_class_prefix": "GAPI" }, "nested": { "http": { @@ -843,6 +1705,10 @@ "rule": "repeated", "type": "ClientLibraryDestination", "id": 2 + }, + "selectiveGapicGeneration": { + "type": "SelectiveGapicGeneration", + "id": 3 } } }, @@ -983,6 +1849,28 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "experimentalFeatures": { + "type": "ExperimentalFeatures", + "id": 2 + } + }, + "nested": { + "ExperimentalFeatures": { + "fields": { + "restAsyncIoEnabled": { + "type": "bool", + "id": 1 + }, + "protobufPythonicTypesEnabled": { + "type": "bool", + "id": 2 + }, + "unversionedPackageDisabled": { + "type": "bool", + "id": 3 + } + } } } }, @@ -1040,6 +1928,11 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 } } }, @@ -1101,6 +1994,19 @@ "PACKAGE_MANAGER": 20 } }, + "SelectiveGapicGeneration": { + "fields": { + "methods": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "generateOmittedAsInternal": { + "type": "bool", + "id": 2 + } + } + }, "LaunchStage": { "values": { "LAUNCH_STAGE_UNSPECIFIED": 0, @@ -1233,12 +2139,19 @@ "type": "FileDescriptorProto", "id": 1 } - } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ] }, "Edition": { "edition": "proto2", "values": { "EDITION_UNKNOWN": 0, + "EDITION_LEGACY": 900, "EDITION_PROTO2": 998, "EDITION_PROTO3": 999, "EDITION_2023": 1000, @@ -1277,6 +2190,11 @@ "type": "int32", "id": 11 }, + "optionDependency": { + "rule": "repeated", + "type": "string", + "id": 15 + }, "messageType": { "rule": "repeated", "type": "DescriptorProto", @@ -1365,6 +2283,10 @@ "rule": "repeated", "type": "string", "id": 10 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 11 } }, "nested": { @@ -1590,6 +2512,10 @@ "rule": "repeated", "type": "string", "id": 5 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 6 } }, "nested": { @@ -1640,7 +2566,14 @@ "type": "ServiceOptions", "id": 3 } - } + }, + "reserved": [ + [ + 4, + 4 + ], + "stream" + ] }, "MethodDescriptorProto": { "edition": "proto2", @@ -1804,6 +2737,7 @@ 42, 42 ], + "php_generic_services", [ 38, 38 @@ -1939,7 +2873,8 @@ "type": "bool", "id": 10, "options": { - "default": false + "default": false, + "deprecated": true } }, "debugRedact": { @@ -1967,6 +2902,10 @@ "type": "FeatureSet", "id": 21 }, + "featureSupport": { + "type": "FeatureSupport", + "id": 22 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -2036,6 +2975,26 @@ "id": 2 } } + }, + "FeatureSupport": { + "fields": { + "editionIntroduced": { + "type": "Edition", + "id": 1 + }, + "editionDeprecated": { + "type": "Edition", + "id": 2 + }, + "deprecationWarning": { + "type": "string", + "id": 3 + }, + "editionRemoved": { + "type": "Edition", + "id": 4 + } + } } } }, @@ -2124,6 +3083,10 @@ "default": false } }, + "featureSupport": { + "type": "FieldOptions.FeatureSupport", + "id": 4 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -2266,6 +3229,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_2023", "edition_defaults.value": "EXPLICIT" } @@ -2276,6 +3240,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "OPEN" } @@ -2286,6 +3251,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "PACKED" } @@ -2296,6 +3262,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "VERIFY" } @@ -2306,7 +3273,8 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "EDITION_PROTO2", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_LEGACY", "edition_defaults.value": "LENGTH_PREFIXED" } }, @@ -2316,27 +3284,38 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "ALLOW" } + }, + "enforceNamingStyle": { + "type": "EnforceNamingStyle", + "id": 7, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_METHOD", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "STYLE2024" + } + }, + "defaultSymbolVisibility": { + "type": "VisibilityFeature.DefaultSymbolVisibility", + "id": 8, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "EXPORT_TOP_LEVEL" + } } }, "extensions": [ [ 1000, - 1000 - ], - [ - 1001, - 1001 - ], - [ - 1002, - 1002 - ], - [ - 9990, - 9990 + 9994 ], [ 9995, @@ -2381,7 +3360,13 @@ "UTF8_VALIDATION_UNKNOWN": 0, "VERIFY": 2, "NONE": 3 - } + }, + "reserved": [ + [ + 1, + 1 + ] + ] }, "MessageEncoding": { "values": { @@ -2396,6 +3381,33 @@ "ALLOW": 1, "LEGACY_BEST_EFFORT": 2 } + }, + "EnforceNamingStyle": { + "values": { + "ENFORCE_NAMING_STYLE_UNKNOWN": 0, + "STYLE2024": 1, + "STYLE_LEGACY": 2 + } + }, + "VisibilityFeature": { + "fields": {}, + "reserved": [ + [ + 1, + 536870911 + ] + ], + "nested": { + "DefaultSymbolVisibility": { + "values": { + "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, + "EXPORT_ALL": 1, + "EXPORT_TOP_LEVEL": 2, + "LOCAL_ALL": 3, + "STRICT": 4 + } + } + } } } }, @@ -2423,11 +3435,26 @@ "type": "Edition", "id": 3 }, - "features": { + "overridableFeatures": { "type": "FeatureSet", - "id": 2 + "id": 4 + }, + "fixedFeatures": { + "type": "FeatureSet", + "id": 5 } - } + }, + "reserved": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + "features" + ] } } }, @@ -2440,6 +3467,12 @@ "id": 1 } }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ], "nested": { "Location": { "fields": { @@ -2525,6 +3558,14 @@ } } }, + "SymbolVisibility": { + "edition": "proto2", + "values": { + "VISIBILITY_UNSET": 0, + "VISIBILITY_LOCAL": 1, + "VISIBILITY_EXPORT": 2 + } + }, "Duration": { "fields": { "seconds": { @@ -2548,6 +3589,276 @@ "id": 2 } } + }, + "Any": { + "fields": { + "type_url": { + "type": "string", + "id": 1 + }, + "value": { + "type": "bytes", + "id": 2 + } + } + }, + "Empty": { + "fields": {} + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + } + } + }, + "longrunning": { + "options": { + "cc_enable_arenas": true, + "csharp_namespace": "Google.LongRunning", + "go_package": "cloud.google.com/go/longrunning/autogen/longrunningpb;longrunningpb", + "java_multiple_files": true, + "java_outer_classname": "OperationsProto", + "java_package": "com.google.longrunning", + "objc_class_prefix": "GLRUN", + "php_namespace": "Google\\LongRunning" + }, + "nested": { + "operationInfo": { + "type": "google.longrunning.OperationInfo", + "id": 1049, + "extend": "google.protobuf.MethodOptions" + }, + "Operations": { + "options": { + "(google.api.default_host)": "longrunning.googleapis.com" + }, + "methods": { + "ListOperations": { + "requestType": "ListOperationsRequest", + "responseType": "ListOperationsResponse", + "options": { + "(google.api.http).get": "/v1/{name=operations}", + "(google.api.method_signature)": "name,filter" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=operations}" + } + }, + { + "(google.api.method_signature)": "name,filter" + } + ] + }, + "GetOperation": { + "requestType": "GetOperationRequest", + "responseType": "Operation", + "options": { + "(google.api.http).get": "/v1/{name=operations/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=operations/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "DeleteOperation": { + "requestType": "DeleteOperationRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v1/{name=operations/**}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=operations/**}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CancelOperation": { + "requestType": "CancelOperationRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/v1/{name=operations/**}:cancel", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=operations/**}:cancel", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "WaitOperation": { + "requestType": "WaitOperationRequest", + "responseType": "Operation" + } + } + }, + "Operation": { + "oneofs": { + "result": { + "oneof": [ + "error", + "response" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "metadata": { + "type": "google.protobuf.Any", + "id": 2 + }, + "done": { + "type": "bool", + "id": 3 + }, + "error": { + "type": "google.rpc.Status", + "id": 4 + }, + "response": { + "type": "google.protobuf.Any", + "id": 5 + } + } + }, + "GetOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "ListOperationsRequest": { + "fields": { + "name": { + "type": "string", + "id": 4 + }, + "filter": { + "type": "string", + "id": 1 + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListOperationsResponse": { + "fields": { + "operations": { + "rule": "repeated", + "type": "Operation", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CancelOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "DeleteOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "WaitOperationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "timeout": { + "type": "google.protobuf.Duration", + "id": 2 + } + } + }, + "OperationInfo": { + "fields": { + "responseType": { + "type": "string", + "id": 1 + }, + "metadataType": { + "type": "string", + "id": 2 + } + } + } + } + }, + "rpc": { + "options": { + "cc_enable_arenas": true, + "go_package": "google.golang.org/genproto/googleapis/rpc/status;status", + "java_multiple_files": true, + "java_outer_classname": "StatusProto", + "java_package": "com.google.rpc", + "objc_class_prefix": "RPC" + }, + "nested": { + "Status": { + "fields": { + "code": { + "type": "int32", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + }, + "details": { + "rule": "repeated", + "type": "google.protobuf.Any", + "id": 3 + } + } } } } diff --git a/packages/google-cloud-workflows/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json b/packages/google-cloud-workflows/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json index dc3098506e35..f17cc1ffd26b 100644 --- a/packages/google-cloud-workflows/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json +++ b/packages/google-cloud-workflows/samples/generated/v1/snippet_metadata_google.cloud.workflows.executions.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-executions", - "version": "5.1.0", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-workflows/samples/generated/v1/snippet_metadata_google.cloud.workflows.v1.json b/packages/google-cloud-workflows/samples/generated/v1/snippet_metadata_google.cloud.workflows.v1.json index cf3b301b5882..5bb0d864ab02 100644 --- a/packages/google-cloud-workflows/samples/generated/v1/snippet_metadata_google.cloud.workflows.v1.json +++ b/packages/google-cloud-workflows/samples/generated/v1/snippet_metadata_google.cloud.workflows.v1.json @@ -1,295 +1,295 @@ { - "clientLibrary": { - "name": "nodejs-workflows", - "version": "5.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.workflows.v1", - "version": "v1" - } - ] - }, - "snippets": [ + "clientLibrary": { + "name": "nodejs-workflows", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.workflows.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "workflows_v1_generated_Workflows_ListWorkflows_async", + "title": "Workflows listWorkflows Sample", + "origin": "API_DEFINITION", + "description": " Lists workflows in a given project and location. The default order is not specified.", + "canonical": true, + "file": "workflows.list_workflows.js", + "language": "JAVASCRIPT", + "segments": [ { - "regionTag": "workflows_v1_generated_Workflows_ListWorkflows_async", - "title": "Workflows listWorkflows Sample", - "origin": "API_DEFINITION", - "description": " Lists workflows in a given project and location. The default order is not specified.", - "canonical": true, - "file": "workflows.list_workflows.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListWorkflows", - "fullName": "google.cloud.workflows.v1.Workflows.ListWorkflows", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workflows.v1.ListWorkflowsResponse", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1.WorkflowsClient" - }, - "method": { - "shortName": "ListWorkflows", - "fullName": "google.cloud.workflows.v1.Workflows.ListWorkflows", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1.Workflows" - } - } - } + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListWorkflows", + "fullName": "google.cloud.workflows.v1.Workflows.ListWorkflows", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workflows.v1.ListWorkflowsResponse", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1.WorkflowsClient" }, + "method": { + "shortName": "ListWorkflows", + "fullName": "google.cloud.workflows.v1.Workflows.ListWorkflows", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1_generated_Workflows_GetWorkflow_async", + "title": "Workflows getWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single workflow.", + "canonical": true, + "file": "workflows.get_workflow.js", + "language": "JAVASCRIPT", + "segments": [ { - "regionTag": "workflows_v1_generated_Workflows_GetWorkflow_async", - "title": "Workflows getWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single workflow.", - "canonical": true, - "file": "workflows.get_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.GetWorkflow", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "revision_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workflows.v1.Workflow", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1.WorkflowsClient" - }, - "method": { - "shortName": "GetWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.GetWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1.Workflows" - } - } - } + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.GetWorkflow", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "revision_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workflows.v1.Workflow", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1.WorkflowsClient" }, + "method": { + "shortName": "GetWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.GetWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1_generated_Workflows_CreateWorkflow_async", + "title": "Workflows createWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.", + "canonical": true, + "file": "workflows.create_workflow.js", + "language": "JAVASCRIPT", + "segments": [ { - "regionTag": "workflows_v1_generated_Workflows_CreateWorkflow_async", - "title": "Workflows createWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation returns a [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.", - "canonical": true, - "file": "workflows.create_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.CreateWorkflow", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "workflow", - "type": ".google.cloud.workflows.v1.Workflow" - }, - { - "name": "workflow_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1.WorkflowsClient" - }, - "method": { - "shortName": "CreateWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.CreateWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1.Workflows" - } - } - } + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.CreateWorkflow", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "workflow", + "type": ".google.cloud.workflows.v1.Workflow" + }, + { + "name": "workflow_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1.WorkflowsClient" }, + "method": { + "shortName": "CreateWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.CreateWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1_generated_Workflows_DeleteWorkflow_async", + "title": "Workflows deleteWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.", + "canonical": true, + "file": "workflows.delete_workflow.js", + "language": "JAVASCRIPT", + "segments": [ { - "regionTag": "workflows_v1_generated_Workflows_DeleteWorkflow_async", - "title": "Workflows deleteWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.", - "canonical": true, - "file": "workflows.delete_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.DeleteWorkflow", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1.WorkflowsClient" - }, - "method": { - "shortName": "DeleteWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.DeleteWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1.Workflows" - } - } - } + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.DeleteWorkflow", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1.WorkflowsClient" }, + "method": { + "shortName": "DeleteWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.DeleteWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1_generated_Workflows_UpdateWorkflow_async", + "title": "Workflows updateWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow might be created as a result of a successful update operation. In that case, the new revision is used in new workflow executions.", + "canonical": true, + "file": "workflows.update_workflow.js", + "language": "JAVASCRIPT", + "segments": [ { - "regionTag": "workflows_v1_generated_Workflows_UpdateWorkflow_async", - "title": "Workflows updateWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow might be created as a result of a successful update operation. In that case, the new revision is used in new workflow executions.", - "canonical": true, - "file": "workflows.update_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.UpdateWorkflow", - "async": true, - "parameters": [ - { - "name": "workflow", - "type": ".google.cloud.workflows.v1.Workflow" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1.WorkflowsClient" - }, - "method": { - "shortName": "UpdateWorkflow", - "fullName": "google.cloud.workflows.v1.Workflows.UpdateWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1.Workflows" - } - } - } + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.UpdateWorkflow", + "async": true, + "parameters": [ + { + "name": "workflow", + "type": ".google.cloud.workflows.v1.Workflow" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1.WorkflowsClient" }, + "method": { + "shortName": "UpdateWorkflow", + "fullName": "google.cloud.workflows.v1.Workflows.UpdateWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1_generated_Workflows_ListWorkflowRevisions_async", + "title": "Workflows listWorkflowRevisions Sample", + "origin": "API_DEFINITION", + "description": " Lists revisions for a given workflow.", + "canonical": true, + "file": "workflows.list_workflow_revisions.js", + "language": "JAVASCRIPT", + "segments": [ { - "regionTag": "workflows_v1_generated_Workflows_ListWorkflowRevisions_async", - "title": "Workflows listWorkflowRevisions Sample", - "origin": "API_DEFINITION", - "description": " Lists revisions for a given workflow.", - "canonical": true, - "file": "workflows.list_workflow_revisions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListWorkflowRevisions", - "fullName": "google.cloud.workflows.v1.Workflows.ListWorkflowRevisions", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workflows.v1.ListWorkflowRevisionsResponse", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1.WorkflowsClient" - }, - "method": { - "shortName": "ListWorkflowRevisions", - "fullName": "google.cloud.workflows.v1.Workflows.ListWorkflowRevisions", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1.Workflows" - } - } - } + "start": 25, + "end": 67, + "type": "FULL" } - ] + ], + "clientMethod": { + "shortName": "ListWorkflowRevisions", + "fullName": "google.cloud.workflows.v1.Workflows.ListWorkflowRevisions", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workflows.v1.ListWorkflowRevisionsResponse", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1.WorkflowsClient" + }, + "method": { + "shortName": "ListWorkflowRevisions", + "fullName": "google.cloud.workflows.v1.Workflows.ListWorkflowRevisions", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1.Workflows" + } + } + } + } + ] } diff --git a/packages/google-cloud-workflows/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json b/packages/google-cloud-workflows/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json index 3047d1d64146..388d68488334 100644 --- a/packages/google-cloud-workflows/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json +++ b/packages/google-cloud-workflows/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.executions.v1beta.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-executions", - "version": "5.1.0", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-workflows/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.v1beta.json b/packages/google-cloud-workflows/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.v1beta.json index 51ab6caba658..400f73d4c9b7 100644 --- a/packages/google-cloud-workflows/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.v1beta.json +++ b/packages/google-cloud-workflows/samples/generated/v1beta/snippet_metadata_google.cloud.workflows.v1beta.json @@ -1,243 +1,243 @@ { - "clientLibrary": { - "name": "nodejs-workflows", - "version": "5.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.workflows.v1beta", - "version": "v1beta" - } - ] - }, - "snippets": [ + "clientLibrary": { + "name": "nodejs-workflows", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.workflows.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "regionTag": "workflows_v1beta_generated_Workflows_ListWorkflows_async", + "title": "Workflows listWorkflows Sample", + "origin": "API_DEFINITION", + "description": " Lists Workflows in a given project and location. The default order is not specified.", + "canonical": true, + "file": "workflows.list_workflows.js", + "language": "JAVASCRIPT", + "segments": [ { - "regionTag": "workflows_v1beta_generated_Workflows_ListWorkflows_async", - "title": "Workflows listWorkflows Sample", - "origin": "API_DEFINITION", - "description": " Lists Workflows in a given project and location. The default order is not specified.", - "canonical": true, - "file": "workflows.list_workflows.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListWorkflows", - "fullName": "google.cloud.workflows.v1beta.Workflows.ListWorkflows", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workflows.v1beta.ListWorkflowsResponse", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" - }, - "method": { - "shortName": "ListWorkflows", - "fullName": "google.cloud.workflows.v1beta.Workflows.ListWorkflows", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1beta.Workflows" - } - } - } + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListWorkflows", + "fullName": "google.cloud.workflows.v1beta.Workflows.ListWorkflows", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workflows.v1beta.ListWorkflowsResponse", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" }, + "method": { + "shortName": "ListWorkflows", + "fullName": "google.cloud.workflows.v1beta.Workflows.ListWorkflows", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1beta.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1beta_generated_Workflows_GetWorkflow_async", + "title": "Workflows getWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Workflow.", + "canonical": true, + "file": "workflows.get_workflow.js", + "language": "JAVASCRIPT", + "segments": [ { - "regionTag": "workflows_v1beta_generated_Workflows_GetWorkflow_async", - "title": "Workflows getWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Workflow.", - "canonical": true, - "file": "workflows.get_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.GetWorkflow", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.workflows.v1beta.Workflow", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" - }, - "method": { - "shortName": "GetWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.GetWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1beta.Workflows" - } - } - } + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.GetWorkflow", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.workflows.v1beta.Workflow", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" }, + "method": { + "shortName": "GetWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.GetWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1beta.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1beta_generated_Workflows_CreateWorkflow_async", + "title": "Workflows createWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.", + "canonical": true, + "file": "workflows.create_workflow.js", + "language": "JAVASCRIPT", + "segments": [ { - "regionTag": "workflows_v1beta_generated_Workflows_CreateWorkflow_async", - "title": "Workflows createWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.", - "canonical": true, - "file": "workflows.create_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.CreateWorkflow", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "workflow", - "type": ".google.cloud.workflows.v1beta.Workflow" - }, - { - "name": "workflow_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" - }, - "method": { - "shortName": "CreateWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.CreateWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1beta.Workflows" - } - } - } + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.CreateWorkflow", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "workflow", + "type": ".google.cloud.workflows.v1beta.Workflow" + }, + { + "name": "workflow_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" }, + "method": { + "shortName": "CreateWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.CreateWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1beta.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1beta_generated_Workflows_DeleteWorkflow_async", + "title": "Workflows deleteWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.", + "canonical": true, + "file": "workflows.delete_workflow.js", + "language": "JAVASCRIPT", + "segments": [ { - "regionTag": "workflows_v1beta_generated_Workflows_DeleteWorkflow_async", - "title": "Workflows deleteWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.", - "canonical": true, - "file": "workflows.delete_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.DeleteWorkflow", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" - }, - "method": { - "shortName": "DeleteWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.DeleteWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1beta.Workflows" - } - } - } + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.DeleteWorkflow", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" }, + "method": { + "shortName": "DeleteWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.DeleteWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1beta.Workflows" + } + } + } + }, + { + "regionTag": "workflows_v1beta_generated_Workflows_UpdateWorkflow_async", + "title": "Workflows updateWorkflow Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow may be created as a result of a successful update operation. In that case, such revision will be used in new workflow executions.", + "canonical": true, + "file": "workflows.update_workflow.js", + "language": "JAVASCRIPT", + "segments": [ { - "regionTag": "workflows_v1beta_generated_Workflows_UpdateWorkflow_async", - "title": "Workflows updateWorkflow Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow may be created as a result of a successful update operation. In that case, such revision will be used in new workflow executions.", - "canonical": true, - "file": "workflows.update_workflow.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.UpdateWorkflow", - "async": true, - "parameters": [ - { - "name": "workflow", - "type": ".google.cloud.workflows.v1beta.Workflow" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "WorkflowsClient", - "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" - }, - "method": { - "shortName": "UpdateWorkflow", - "fullName": "google.cloud.workflows.v1beta.Workflows.UpdateWorkflow", - "service": { - "shortName": "Workflows", - "fullName": "google.cloud.workflows.v1beta.Workflows" - } - } - } + "start": 25, + "end": 59, + "type": "FULL" } - ] + ], + "clientMethod": { + "shortName": "UpdateWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.UpdateWorkflow", + "async": true, + "parameters": [ + { + "name": "workflow", + "type": ".google.cloud.workflows.v1beta.Workflow" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "WorkflowsClient", + "fullName": "google.cloud.workflows.v1beta.WorkflowsClient" + }, + "method": { + "shortName": "UpdateWorkflow", + "fullName": "google.cloud.workflows.v1beta.Workflows.UpdateWorkflow", + "service": { + "shortName": "Workflows", + "fullName": "google.cloud.workflows.v1beta.Workflows" + } + } + } + } + ] } diff --git a/packages/google-cloud-workflows/src/index.ts b/packages/google-cloud-workflows/src/index.ts index f3d2ac138a70..3da6e23164d3 100644 --- a/packages/google-cloud-workflows/src/index.ts +++ b/packages/google-cloud-workflows/src/index.ts @@ -16,13 +16,15 @@ // ** https://github.com/googleapis/synthtool ** // ** All changes to this file may be overwritten. ** +import * as v1 from './v1'; +import * as v1beta from './v1beta'; import * as v1 from './v1'; import * as v1beta from './v1beta'; const ExecutionsClient = v1.ExecutionsClient; type ExecutionsClient = v1.ExecutionsClient; -export {v1, v1beta, ExecutionsClient}; -export default {v1, v1beta, ExecutionsClient}; +export {v1, v1beta, v1, v1beta, ExecutionsClient}; +export default {v1, v1beta, v1, v1beta, ExecutionsClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-workflows/src/v1/executions_client.ts b/packages/google-cloud-workflows/src/v1/executions_client.ts index 5576a3ff3683..86e460f427ee 100644 --- a/packages/google-cloud-workflows/src/v1/executions_client.ts +++ b/packages/google-cloud-workflows/src/v1/executions_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -45,7 +52,7 @@ export class ExecutionsClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('workflows'); @@ -58,9 +65,9 @@ export class ExecutionsClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - executionsStub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + executionsStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of ExecutionsClient. @@ -101,21 +108,42 @@ export class ExecutionsClient { * const client = new ExecutionsClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ExecutionsClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'workflowexecutions.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. if (servicePath !== this._servicePath && !('scopes' in opts)) { @@ -137,7 +165,7 @@ export class ExecutionsClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -151,10 +179,7 @@ export class ExecutionsClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -176,10 +201,10 @@ export class ExecutionsClient { // Create useful helper objects for these. this.pathTemplates = { executionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}' + 'projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}', ), workflowPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflows/{workflow}' + 'projects/{project}/locations/{location}/workflows/{workflow}', ), }; @@ -187,14 +212,20 @@ export class ExecutionsClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listExecutions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions') + listExecutions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'executions', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.executions.v1.Executions', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.workflows.executions.v1.Executions', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -225,37 +256,45 @@ export class ExecutionsClient { // Put together the "service stub" for // google.cloud.workflows.executions.v1.Executions. this.executionsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workflows.executions.v1.Executions') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.workflows.executions.v1.Executions', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.workflows.executions.v1.Executions, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const executionsStubMethods = - ['listExecutions', 'createExecution', 'getExecution', 'cancelExecution']; + const executionsStubMethods = [ + 'listExecutions', + 'createExecution', + 'getExecution', + 'cancelExecution', + ]; for (const methodName of executionsStubMethods) { const callPromise = this.executionsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -270,8 +309,14 @@ export class ExecutionsClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'workflowexecutions.googleapis.com'; } @@ -282,8 +327,14 @@ export class ExecutionsClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'workflowexecutions.googleapis.com'; } @@ -314,9 +365,7 @@ export class ExecutionsClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -325,8 +374,9 @@ export class ExecutionsClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -337,409 +387,581 @@ export class ExecutionsClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Creates a new execution using the latest revision of the given workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * @param {google.cloud.workflows.executions.v1.Execution} request.execution - * Required. Execution to be created. - * @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 protos.google.cloud.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.create_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_CreateExecution_async - */ + /** + * Creates a new execution using the latest revision of the given workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * @param {google.cloud.workflows.executions.v1.Execution} request.execution + * Required. Execution to be created. + * @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 protos.google.cloud.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.create_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_CreateExecution_async + */ createExecution( - request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest + | undefined + ), + {} | undefined, + ] + >; createExecution( - request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createExecution( - request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createExecution( - request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createExecution request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createExecution response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createExecution(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest|undefined, - {}|undefined - ]) => { - this._log.info('createExecution response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createExecution(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.ICreateExecutionRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createExecution response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Returns an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * execution. The API will default to the FULL view. - * @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 protos.google.cloud.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.get_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_GetExecution_async - */ + /** + * Returns an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * execution. The API will default to the FULL view. + * @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 protos.google.cloud.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.get_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_GetExecution_async + */ getExecution( - request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest + | undefined + ), + {} | undefined, + ] + >; getExecution( - request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getExecution( - request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getExecution( - request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.workflows.executions.v1.IGetExecutionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getExecution request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getExecution response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getExecution(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.IGetExecutionRequest|undefined, - {}|undefined - ]) => { - this._log.info('getExecution response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getExecution(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.IGetExecutionRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getExecution response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Cancels an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @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 protos.google.cloud.workflows.executions.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.cancel_execution.js - * region_tag:workflowexecutions_v1_generated_Executions_CancelExecution_async - */ + /** + * Cancels an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @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 protos.google.cloud.workflows.executions.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.cancel_execution.js + * region_tag:workflowexecutions_v1_generated_Executions_CancelExecution_async + */ cancelExecution( - request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest + | undefined + ), + {} | undefined, + ] + >; cancelExecution( - request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; cancelExecution( - request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; cancelExecution( - request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('cancelExecution request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.workflows.executions.v1.IExecution, + | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('cancelExecution response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.cancelExecution(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.workflows.executions.v1.IExecution, - protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest|undefined, - {}|undefined - ]) => { - this._log.info('cancelExecution response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .cancelExecution(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.workflows.executions.v1.IExecution, + ( + | protos.google.cloud.workflows.executions.v1.ICancelExecutionRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('cancelExecution response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } - /** - * Returns a list of executions which belong to the workflow with - * the given name. The method returns executions of all workflow - * revisions. Returned executions are ordered by their start time (newest - * first). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @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 Array of {@link protos.google.cloud.workflows.executions.v1.Execution|Execution}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Returns a list of executions which belong to the workflow with + * the given name. The method returns executions of all workflow + * revisions. Returned executions are ordered by their start time (newest + * first). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @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 Array of {@link protos.google.cloud.workflows.executions.v1.Execution|Execution}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutions( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution[], - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse - ]>; + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution[], + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest | null, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse, + ] + >; listExecutions( - request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>): void; + request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + | protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1.IExecution + >, + ): void; listExecutions( - request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>): void; + request: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + | protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1.IExecution + >, + ): void; listExecutions( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>, - callback?: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>): - Promise<[ - protos.google.cloud.workflows.executions.v1.IExecution[], - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse - ]>|void { + | protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1.IExecution + >, + callback?: PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + | protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1.IExecution + >, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1.IExecution[], + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest | null, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1.IExecution>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + | protos.google.cloud.workflows.executions.v1.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1.IExecution + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listExecutions values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -748,156 +970,160 @@ export class ExecutionsClient { this._log.info('listExecutions request %j', request); return this.innerApiCalls .listExecutions(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.workflows.executions.v1.IExecution[], - protos.google.cloud.workflows.executions.v1.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1.IListExecutionsResponse - ]) => { - this._log.info('listExecutions values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.workflows.executions.v1.IExecution[], + protos.google.cloud.workflows.executions.v1.IListExecutionsRequest | null, + protos.google.cloud.workflows.executions.v1.IListExecutionsResponse, + ]) => { + this._log.info('listExecutions values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listExecutions`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.workflows.executions.v1.Execution|Execution} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listExecutions`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.workflows.executions.v1.Execution|Execution} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutionsStream( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutions']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listExecutions stream %j', request); return this.descriptors.page.listExecutions.createStream( this.innerApiCalls.listExecutions as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listExecutions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 1000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Note that pagination is applied to dynamic data. The list of executions - * returned can change between page requests. - * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned - * executions. The API will default to the BASIC view. - * @param {string} [request.filter] - * Optional. Filters applied to the [Executions.ListExecutions] results. - * The following fields are supported for filtering: - * executionID, state, startTime, endTime, duration, workflowRevisionID, - * stepName, and label. - * @param {string} [request.orderBy] - * Optional. The ordering applied to the [Executions.ListExecutions] results. - * By default the ordering is based on descending start time. - * The following fields are supported for order by: - * executionID, startTime, endTime, duration, state, and workflowRevisionID. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.workflows.executions.v1.Execution|Execution}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/executions.list_executions.js - * region_tag:workflowexecutions_v1_generated_Executions_ListExecutions_async - */ + /** + * Equivalent to `listExecutions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 1000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * + * Note that pagination is applied to dynamic data. The list of executions + * returned can change between page requests. + * @param {google.cloud.workflows.executions.v1.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned + * executions. The API will default to the BASIC view. + * @param {string} [request.filter] + * Optional. Filters applied to the [Executions.ListExecutions] results. + * The following fields are supported for filtering: + * executionID, state, startTime, endTime, duration, workflowRevisionID, + * stepName, and label. + * @param {string} [request.orderBy] + * Optional. The ordering applied to the [Executions.ListExecutions] results. + * By default the ordering is based on descending start time. + * The following fields are supported for order by: + * executionID, startTime, endTime, duration, state, and workflowRevisionID. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.workflows.executions.v1.Execution|Execution}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/executions.list_executions.js + * region_tag:workflowexecutions_v1_generated_Executions_ListExecutions_async + */ listExecutionsAsync( - request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.workflows.executions.v1.IListExecutionsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutions']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listExecutions iterate %j', request); return this.descriptors.page.listExecutions.asyncIterate( this.innerApiCalls['listExecutions'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } // -------------------- @@ -913,7 +1139,12 @@ export class ExecutionsClient { * @param {string} execution * @returns {string} Resource name string. */ - executionPath(project:string,location:string,workflow:string,execution:string) { + executionPath( + project: string, + location: string, + workflow: string, + execution: string, + ) { return this.pathTemplates.executionPathTemplate.render({ project: project, location: location, @@ -930,7 +1161,8 @@ export class ExecutionsClient { * @returns {string} A string representing the project. */ matchProjectFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).project; + return this.pathTemplates.executionPathTemplate.match(executionName) + .project; } /** @@ -941,7 +1173,8 @@ export class ExecutionsClient { * @returns {string} A string representing the location. */ matchLocationFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).location; + return this.pathTemplates.executionPathTemplate.match(executionName) + .location; } /** @@ -952,7 +1185,8 @@ export class ExecutionsClient { * @returns {string} A string representing the workflow. */ matchWorkflowFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).workflow; + return this.pathTemplates.executionPathTemplate.match(executionName) + .workflow; } /** @@ -963,7 +1197,8 @@ export class ExecutionsClient { * @returns {string} A string representing the execution. */ matchExecutionFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).execution; + return this.pathTemplates.executionPathTemplate.match(executionName) + .execution; } /** @@ -974,7 +1209,7 @@ export class ExecutionsClient { * @param {string} workflow * @returns {string} Resource name string. */ - workflowPath(project:string,location:string,workflow:string) { + workflowPath(project: string, location: string, workflow: string) { return this.pathTemplates.workflowPathTemplate.render({ project: project, location: location, @@ -1023,7 +1258,7 @@ export class ExecutionsClient { */ close(): Promise { if (this.executionsStub && !this._terminated) { - return this.executionsStub.then(stub => { + return this.executionsStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -1031,4 +1266,4 @@ export class ExecutionsClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-workflows/src/v1/index.ts b/packages/google-cloud-workflows/src/v1/index.ts index 413ec64c3867..20485377c45c 100644 --- a/packages/google-cloud-workflows/src/v1/index.ts +++ b/packages/google-cloud-workflows/src/v1/index.ts @@ -16,4 +16,4 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {ExecutionsClient} from './executions_client'; +export { ExecutionsClient } from './executions_client'; diff --git a/packages/google-cloud-workflows/src/v1/workflows_client.ts b/packages/google-cloud-workflows/src/v1/workflows_client.ts new file mode 100644 index 000000000000..5c1903180b68 --- /dev/null +++ b/packages/google-cloud-workflows/src/v1/workflows_client.ts @@ -0,0 +1,2260 @@ +// Copyright 2026 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. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform } from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/workflows_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './workflows_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Workflows is used to deploy and execute workflow programs. + * Workflows makes sure the program executes reliably, despite hardware and + * networking interruptions. + * @class + * @memberof v1 + */ +export class WorkflowsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('workflows'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + operationsClient: gax.OperationsClient; + workflowsStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of WorkflowsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new WorkflowsClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof WorkflowsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'workflows.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}', + ), + cryptoKeyVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}', + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}', + ), + workflowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflows/{workflow}', + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listWorkflows: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'workflows', + ), + listWorkflowRevisions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'workflows', + ), + }; + + const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createWorkflowResponse = protoFilesRoot.lookup( + '.google.cloud.workflows.v1.Workflow', + ) as gax.protobuf.Type; + const createWorkflowMetadata = protoFilesRoot.lookup( + '.google.cloud.workflows.v1.OperationMetadata', + ) as gax.protobuf.Type; + const deleteWorkflowResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty', + ) as gax.protobuf.Type; + const deleteWorkflowMetadata = protoFilesRoot.lookup( + '.google.cloud.workflows.v1.OperationMetadata', + ) as gax.protobuf.Type; + const updateWorkflowResponse = protoFilesRoot.lookup( + '.google.cloud.workflows.v1.Workflow', + ) as gax.protobuf.Type; + const updateWorkflowMetadata = protoFilesRoot.lookup( + '.google.cloud.workflows.v1.OperationMetadata', + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createWorkflow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createWorkflowResponse.decode.bind(createWorkflowResponse), + createWorkflowMetadata.decode.bind(createWorkflowMetadata), + ), + deleteWorkflow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteWorkflowResponse.decode.bind(deleteWorkflowResponse), + deleteWorkflowMetadata.decode.bind(deleteWorkflowMetadata), + ), + updateWorkflow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateWorkflowResponse.decode.bind(updateWorkflowResponse), + updateWorkflowMetadata.decode.bind(updateWorkflowMetadata), + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.workflows.v1.Workflows', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.workflowsStub) { + return this.workflowsStub; + } + + // Put together the "service stub" for + // google.cloud.workflows.v1.Workflows. + this.workflowsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.workflows.v1.Workflows', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.workflows.v1.Workflows, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const workflowsStubMethods = [ + 'listWorkflows', + 'getWorkflow', + 'createWorkflow', + 'deleteWorkflow', + 'updateWorkflow', + 'listWorkflowRevisions', + ]; + for (const methodName of workflowsStubMethods) { + const callPromise = this.workflowsStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.workflowsStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'workflows.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'workflows.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Gets details of a single workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow for which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {string} [request.revisionId] + * Optional. The revision of the workflow to retrieve. If the revision_id is + * empty, the latest revision is retrieved. + * The format is "000001-a4d", where the first six characters define + * the zero-padded decimal revision number. They are followed by a hyphen and + * three hexadecimal characters. + * @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 protos.google.cloud.workflows.v1.Workflow|Workflow}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.get_workflow.js + * region_tag:workflows_v1_generated_Workflows_GetWorkflow_async + */ + getWorkflow( + request?: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest | undefined, + {} | undefined, + ] + >; + getWorkflow( + request: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest | null | undefined, + {} | null | undefined + >, + ): void; + getWorkflow( + request: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + callback: Callback< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest | null | undefined, + {} | null | undefined + >, + ): void; + getWorkflow( + request?: protos.google.cloud.workflows.v1.IGetWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.workflows.v1.IWorkflow, + | protos.google.cloud.workflows.v1.IGetWorkflowRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest | 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 || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getWorkflow request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.workflows.v1.IWorkflow, + | protos.google.cloud.workflows.v1.IGetWorkflowRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getWorkflow response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getWorkflow(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IGetWorkflowRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getWorkflow response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Creates a new workflow. If a workflow with the specified name already + * exists in the specified project and location, the long running operation + * returns a {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS} error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * @param {google.cloud.workflows.v1.Workflow} request.workflow + * Required. Workflow to be created. + * @param {string} request.workflowId + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and location. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.create_workflow.js + * region_tag:workflows_v1_generated_Workflows_CreateWorkflow_async + */ + createWorkflow( + request?: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + createWorkflow( + request: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createWorkflow( + request: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createWorkflow( + request?: protos.google.cloud.workflows.v1.ICreateWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | 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 || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('createWorkflow response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('createWorkflow request %j', request); + return this.innerApiCalls + .createWorkflow(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createWorkflow response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `createWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.create_workflow.js + * region_tag:workflows_v1_generated_Workflows_CreateWorkflow_async + */ + async checkCreateWorkflowProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.workflows.v1.Workflow, + protos.google.cloud.workflows.v1.OperationMetadata + > + > { + this._log.info('createWorkflow long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createWorkflow, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.workflows.v1.Workflow, + protos.google.cloud.workflows.v1.OperationMetadata + >; + } + /** + * Deletes a workflow with the specified name. + * This method also cancels and deletes all running executions of the + * workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.delete_workflow.js + * region_tag:workflows_v1_generated_Workflows_DeleteWorkflow_async + */ + deleteWorkflow( + request?: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + deleteWorkflow( + request: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteWorkflow( + request: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteWorkflow( + request?: protos.google.cloud.workflows.v1.IDeleteWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | 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 || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('deleteWorkflow response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('deleteWorkflow request %j', request); + return this.innerApiCalls + .deleteWorkflow(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteWorkflow response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `deleteWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.delete_workflow.js + * region_tag:workflows_v1_generated_Workflows_DeleteWorkflow_async + */ + async checkDeleteWorkflowProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.workflows.v1.OperationMetadata + > + > { + this._log.info('deleteWorkflow long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteWorkflow, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.workflows.v1.OperationMetadata + >; + } + /** + * Updates an existing workflow. + * Running this method has no impact on already running executions of the + * workflow. A new revision of the workflow might be created as a result of a + * successful update operation. In that case, the new revision is used + * in new workflow executions. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.workflows.v1.Workflow} request.workflow + * Required. Workflow to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * List of fields to be updated. If not present, the entire workflow + * will be updated. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.update_workflow.js + * region_tag:workflows_v1_generated_Workflows_UpdateWorkflow_async + */ + updateWorkflow( + request?: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + updateWorkflow( + request: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateWorkflow( + request: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateWorkflow( + request?: protos.google.cloud.workflows.v1.IUpdateWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | 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 || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'workflow.name': request.workflow!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('updateWorkflow response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('updateWorkflow request %j', request); + return this.innerApiCalls + .updateWorkflow(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateWorkflow response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `updateWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.update_workflow.js + * region_tag:workflows_v1_generated_Workflows_UpdateWorkflow_async + */ + async checkUpdateWorkflowProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.workflows.v1.Workflow, + protos.google.cloud.workflows.v1.OperationMetadata + > + > { + this._log.info('updateWorkflow long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateWorkflow, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.workflows.v1.Workflow, + protos.google.cloud.workflows.v1.OperationMetadata + >; + } + /** + * Lists workflows in a given project and location. + * The default order is not specified. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * For details, see AIP-160. + * + * For example, if you are using the Google APIs Explorer: + * + * `state="SUCCEEDED"` + * + * or + * + * `createTime>"2023-08-01" AND state="FAILED"` + * @param {string} request.orderBy + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified order. + * @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 Array of {@link protos.google.cloud.workflows.v1.Workflow|Workflow}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkflows( + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workflows.v1.IWorkflow[], + protos.google.cloud.workflows.v1.IListWorkflowsRequest | null, + protos.google.cloud.workflows.v1.IListWorkflowsResponse, + ] + >; + listWorkflows( + request: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1.IWorkflow + >, + ): void; + listWorkflows( + request: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1.IWorkflow + >, + ): void; + listWorkflows( + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1.IWorkflow + >, + callback?: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1.IWorkflow + >, + ): Promise< + [ + protos.google.cloud.workflows.v1.IWorkflow[], + protos.google.cloud.workflows.v1.IListWorkflowsRequest | null, + protos.google.cloud.workflows.v1.IListWorkflowsResponse, + ] + > | 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 || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1.IWorkflow + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listWorkflows values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listWorkflows request %j', request); + return this.innerApiCalls + .listWorkflows(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.cloud.workflows.v1.IWorkflow[], + protos.google.cloud.workflows.v1.IListWorkflowsRequest | null, + protos.google.cloud.workflows.v1.IListWorkflowsResponse, + ]) => { + this._log.info('listWorkflows values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listWorkflows`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * For details, see AIP-160. + * + * For example, if you are using the Google APIs Explorer: + * + * `state="SUCCEEDED"` + * + * or + * + * `createTime>"2023-08-01" AND state="FAILED"` + * @param {string} request.orderBy + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.workflows.v1.Workflow|Workflow} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkflowsStream( + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + options?: CallOptions, + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listWorkflows']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listWorkflows stream %j', request); + return this.descriptors.page.listWorkflows.createStream( + this.innerApiCalls.listWorkflows as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listWorkflows`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service might return + * fewer than this value even if not at the end of the collection. If a value + * is not specified, a default value of 500 is used. The maximum permitted + * value is 1000 and values greater than 1000 are coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * For details, see AIP-160. + * + * For example, if you are using the Google APIs Explorer: + * + * `state="SUCCEEDED"` + * + * or + * + * `createTime>"2023-08-01" AND state="FAILED"` + * @param {string} request.orderBy + * Comma-separated list of fields that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a "desc" suffix. + * If not specified, the results are returned in an unspecified order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.workflows.v1.Workflow|Workflow}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.list_workflows.js + * region_tag:workflows_v1_generated_Workflows_ListWorkflows_async + */ + listWorkflowsAsync( + request?: protos.google.cloud.workflows.v1.IListWorkflowsRequest, + options?: CallOptions, + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listWorkflows']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listWorkflows iterate %j', request); + return this.descriptors.page.listWorkflows.asyncIterate( + this.innerApiCalls['listWorkflows'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + /** + * Lists revisions for a given workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Workflow for which the revisions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * The maximum number of revisions to return per page. If a value is not + * specified, a default value of 20 is used. The maximum permitted value is + * 100. Values greater than 100 are coerced down to 100. + * @param {string} request.pageToken + * The page token, received from a previous ListWorkflowRevisions call. + * Provide this to retrieve the subsequent page. + * @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 Array of {@link protos.google.cloud.workflows.v1.Workflow|Workflow}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listWorkflowRevisionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkflowRevisions( + request?: protos.google.cloud.workflows.v1.IListWorkflowRevisionsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workflows.v1.IWorkflow[], + protos.google.cloud.workflows.v1.IListWorkflowRevisionsRequest | null, + protos.google.cloud.workflows.v1.IListWorkflowRevisionsResponse, + ] + >; + listWorkflowRevisions( + request: protos.google.cloud.workflows.v1.IListWorkflowRevisionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowRevisionsRequest, + | protos.google.cloud.workflows.v1.IListWorkflowRevisionsResponse + | null + | undefined, + protos.google.cloud.workflows.v1.IWorkflow + >, + ): void; + listWorkflowRevisions( + request: protos.google.cloud.workflows.v1.IListWorkflowRevisionsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowRevisionsRequest, + | protos.google.cloud.workflows.v1.IListWorkflowRevisionsResponse + | null + | undefined, + protos.google.cloud.workflows.v1.IWorkflow + >, + ): void; + listWorkflowRevisions( + request?: protos.google.cloud.workflows.v1.IListWorkflowRevisionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowRevisionsRequest, + | protos.google.cloud.workflows.v1.IListWorkflowRevisionsResponse + | null + | undefined, + protos.google.cloud.workflows.v1.IWorkflow + >, + callback?: PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowRevisionsRequest, + | protos.google.cloud.workflows.v1.IListWorkflowRevisionsResponse + | null + | undefined, + protos.google.cloud.workflows.v1.IWorkflow + >, + ): Promise< + [ + protos.google.cloud.workflows.v1.IWorkflow[], + protos.google.cloud.workflows.v1.IListWorkflowRevisionsRequest | null, + protos.google.cloud.workflows.v1.IListWorkflowRevisionsResponse, + ] + > | 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 || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.workflows.v1.IListWorkflowRevisionsRequest, + | protos.google.cloud.workflows.v1.IListWorkflowRevisionsResponse + | null + | undefined, + protos.google.cloud.workflows.v1.IWorkflow + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listWorkflowRevisions values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listWorkflowRevisions request %j', request); + return this.innerApiCalls + .listWorkflowRevisions(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.cloud.workflows.v1.IWorkflow[], + protos.google.cloud.workflows.v1.IListWorkflowRevisionsRequest | null, + protos.google.cloud.workflows.v1.IListWorkflowRevisionsResponse, + ]) => { + this._log.info('listWorkflowRevisions values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listWorkflowRevisions`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Workflow for which the revisions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * The maximum number of revisions to return per page. If a value is not + * specified, a default value of 20 is used. The maximum permitted value is + * 100. Values greater than 100 are coerced down to 100. + * @param {string} request.pageToken + * The page token, received from a previous ListWorkflowRevisions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.workflows.v1.Workflow|Workflow} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listWorkflowRevisionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkflowRevisionsStream( + request?: protos.google.cloud.workflows.v1.IListWorkflowRevisionsRequest, + options?: CallOptions, + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + const defaultCallSettings = this._defaults['listWorkflowRevisions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listWorkflowRevisions stream %j', request); + return this.descriptors.page.listWorkflowRevisions.createStream( + this.innerApiCalls.listWorkflowRevisions as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listWorkflowRevisions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Workflow for which the revisions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * The maximum number of revisions to return per page. If a value is not + * specified, a default value of 20 is used. The maximum permitted value is + * 100. Values greater than 100 are coerced down to 100. + * @param {string} request.pageToken + * The page token, received from a previous ListWorkflowRevisions call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.workflows.v1.Workflow|Workflow}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workflows.list_workflow_revisions.js + * region_tag:workflows_v1_generated_Workflows_ListWorkflowRevisions_async + */ + listWorkflowRevisionsAsync( + request?: protos.google.cloud.workflows.v1.IListWorkflowRevisionsRequest, + options?: CallOptions, + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + const defaultCallSettings = this._defaults['listWorkflowRevisions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listWorkflowRevisions iterate %j', request); + return this.descriptors.page.listWorkflowRevisions.asyncIterate( + this.innerApiCalls['listWorkflowRevisions'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + ): Promise<[protos.google.longrunning.Operation]> { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions, + ): AsyncIterable { + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + >, + ): Promise { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + return this.operationsClient.cancelOperation(request, options, callback); + } + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + ): Promise { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cryptoKey resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} keyRing + * @param {string} cryptoKey + * @returns {string} Resource name string. + */ + cryptoKeyPath( + project: string, + location: string, + keyRing: string, + cryptoKey: string, + ) { + return this.pathTemplates.cryptoKeyPathTemplate.render({ + project: project, + location: location, + keyRing: keyRing, + cryptoKey: cryptoKey, + }); + } + + /** + * Parse the project from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .project; + } + + /** + * Parse the location from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .location; + } + + /** + * Parse the keyRing from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the keyRing. + */ + matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .keyRing; + } + + /** + * Parse the cryptoKey from CryptoKey resource. + * + * @param {string} cryptoKeyName + * A fully-qualified path representing CryptoKey resource. + * @returns {string} A string representing the cryptoKey. + */ + matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .cryptoKey; + } + + /** + * Return a fully-qualified cryptoKeyVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} keyRing + * @param {string} cryptoKey + * @param {string} cryptoKeyVersion + * @returns {string} Resource name string. + */ + cryptoKeyVersionPath( + project: string, + location: string, + keyRing: string, + cryptoKey: string, + cryptoKeyVersion: string, + ) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.render({ + project: project, + location: location, + keyRing: keyRing, + cryptoKey: cryptoKey, + cryptoKeyVersion: cryptoKeyVersion, + }); + } + + /** + * Parse the project from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName, + ).project; + } + + /** + * Parse the location from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName, + ).location; + } + + /** + * Parse the keyRing from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the keyRing. + */ + matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName, + ).keyRing; + } + + /** + * Parse the cryptoKey from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the cryptoKey. + */ + matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName, + ).cryptoKey; + } + + /** + * Parse the cryptoKeyVersion from CryptoKeyVersion resource. + * + * @param {string} cryptoKeyVersionName + * A fully-qualified path representing CryptoKeyVersion resource. + * @returns {string} A string representing the cryptoKeyVersion. + */ + matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName: string) { + return this.pathTemplates.cryptoKeyVersionPathTemplate.match( + cryptoKeyVersionName, + ).cryptoKeyVersion; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified workflow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow + * @returns {string} Resource name string. + */ + workflowPath(project: string, location: string, workflow: string) { + return this.pathTemplates.workflowPathTemplate.render({ + project: project, + location: location, + workflow: workflow, + }); + } + + /** + * Parse the project from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).project; + } + + /** + * Parse the location from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).location; + } + + /** + * Parse the workflow from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the workflow. + */ + matchWorkflowFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).workflow; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.workflowsStub && !this._terminated) { + return this.workflowsStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + void this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-workflows/src/v1/workflows_client_config.json b/packages/google-cloud-workflows/src/v1/workflows_client_config.json new file mode 100644 index 000000000000..a748088aa9af --- /dev/null +++ b/packages/google-cloud-workflows/src/v1/workflows_client_config.json @@ -0,0 +1,50 @@ +{ + "interfaces": { + "google.cloud.workflows.v1.Workflows": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListWorkflows": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListWorkflowRevisions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-workflows/src/v1/workflows_proto_list.json b/packages/google-cloud-workflows/src/v1/workflows_proto_list.json new file mode 100644 index 000000000000..46c65a972d70 --- /dev/null +++ b/packages/google-cloud-workflows/src/v1/workflows_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/workflows/v1/workflows.proto" +] diff --git a/packages/google-cloud-workflows/src/v1beta/executions_client.ts b/packages/google-cloud-workflows/src/v1beta/executions_client.ts index e24ec271af65..2ff8aaf8fa3f 100644 --- a/packages/google-cloud-workflows/src/v1beta/executions_client.ts +++ b/packages/google-cloud-workflows/src/v1beta/executions_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -45,7 +52,7 @@ export class ExecutionsClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('workflows'); @@ -58,9 +65,9 @@ export class ExecutionsClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - executionsStub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + executionsStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of ExecutionsClient. @@ -101,21 +108,42 @@ export class ExecutionsClient { * const client = new ExecutionsClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof ExecutionsClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'workflowexecutions.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. if (servicePath !== this._servicePath && !('scopes' in opts)) { @@ -137,7 +165,7 @@ export class ExecutionsClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -151,10 +179,7 @@ export class ExecutionsClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -176,10 +201,10 @@ export class ExecutionsClient { // Create useful helper objects for these. this.pathTemplates = { executionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}' + 'projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}', ), workflowPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/workflows/{workflow}' + 'projects/{project}/locations/{location}/workflows/{workflow}', ), }; @@ -187,14 +212,20 @@ export class ExecutionsClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listExecutions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions') + listExecutions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'executions', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workflows.executions.v1beta.Executions', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.workflows.executions.v1beta.Executions', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -225,37 +256,46 @@ export class ExecutionsClient { // Put together the "service stub" for // google.cloud.workflows.executions.v1beta.Executions. this.executionsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workflows.executions.v1beta.Executions') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.workflows.executions.v1beta.Executions, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.workflows.executions.v1beta.Executions', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.workflows.executions.v1beta + .Executions, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const executionsStubMethods = - ['listExecutions', 'createExecution', 'getExecution', 'cancelExecution']; + const executionsStubMethods = [ + 'listExecutions', + 'createExecution', + 'getExecution', + 'cancelExecution', + ]; for (const methodName of executionsStubMethods) { const callPromise = this.executionsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -270,8 +310,14 @@ export class ExecutionsClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'workflowexecutions.googleapis.com'; } @@ -282,8 +328,14 @@ export class ExecutionsClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'workflowexecutions.googleapis.com'; } @@ -314,9 +366,7 @@ export class ExecutionsClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -325,8 +375,9 @@ export class ExecutionsClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -337,396 +388,568 @@ export class ExecutionsClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Creates a new execution using the latest revision of the given workflow. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * @param {google.cloud.workflows.executions.v1beta.Execution} request.execution - * Required. Execution to be created. - * @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 protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/executions.create_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_CreateExecution_async - */ + /** + * Creates a new execution using the latest revision of the given workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which an execution should be created. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * The latest revision of the workflow will be used. + * @param {google.cloud.workflows.executions.v1beta.Execution} request.execution + * Required. Execution to be created. + * @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 protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/executions.create_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_CreateExecution_async + */ createExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest + | undefined + ), + {} | undefined, + ] + >; createExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createExecution request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createExecution response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createExecution(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest|undefined, - {}|undefined - ]) => { - this._log.info('createExecution response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createExecution(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.ICreateExecutionRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createExecution response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Returns an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned execution. - * The API will default to the FULL view. - * @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 protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/executions.get_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_GetExecution_async - */ + /** + * Returns an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be retrieved. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned execution. + * The API will default to the FULL view. + * @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 protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/executions.get_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_GetExecution_async + */ getExecution( - request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest + | undefined + ), + {} | undefined, + ] + >; getExecution( - request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getExecution( - request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getExecution( - request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getExecution request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getExecution response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getExecution(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest|undefined, - {}|undefined - ]) => { - this._log.info('getExecution response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getExecution(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.IGetExecutionRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getExecution response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Cancels an execution of the given name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @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 protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/executions.cancel_execution.js - * region_tag:workflowexecutions_v1beta_generated_Executions_CancelExecution_async - */ + /** + * Cancels an execution of the given name. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the execution to be cancelled. + * Format: + * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + * @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 protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/executions.cancel_execution.js + * region_tag:workflowexecutions_v1beta_generated_Executions_CancelExecution_async + */ cancelExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest + | undefined + ), + {} | undefined, + ] + >; cancelExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; cancelExecution( - request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - callback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + callback: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; cancelExecution( - request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('cancelExecution request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.workflows.executions.v1beta.IExecution, + | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('cancelExecution response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.cancelExecution(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.workflows.executions.v1beta.IExecution, - protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest|undefined, - {}|undefined - ]) => { - this._log.info('cancelExecution response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .cancelExecution(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.workflows.executions.v1beta.IExecution, + ( + | protos.google.cloud.workflows.executions.v1beta.ICancelExecutionRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('cancelExecution response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } - /** - * Returns a list of executions which belong to the workflow with - * the given name. The method returns executions of all workflow - * revisions. Returned executions are ordered by their start time (newest - * first). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC view. - * @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 Array of {@link protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Returns a list of executions which belong to the workflow with + * the given name. The method returns executions of all workflow + * revisions. Returned executions are ordered by their start time (newest + * first). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC view. + * @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 Array of {@link protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutions( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution[], - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse - ]>; + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution[], + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest | null, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse, + ] + >; listExecutions( - request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>): void; + request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + | protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution + >, + ): void; listExecutions( - request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - callback: PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>): void; + request: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + | protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution + >, + ): void; listExecutions( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>, - callback?: PaginationCallback< + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>): - Promise<[ - protos.google.cloud.workflows.executions.v1beta.IExecution[], - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse - ]>|void { + | protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution + >, + callback?: PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + | protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution + >, + ): Promise< + [ + protos.google.cloud.workflows.executions.v1beta.IExecution[], + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest | null, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse|null|undefined, - protos.google.cloud.workflows.executions.v1beta.IExecution>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + | protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workflows.executions.v1beta.IExecution + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listExecutions values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -735,130 +958,134 @@ export class ExecutionsClient { this._log.info('listExecutions request %j', request); return this.innerApiCalls .listExecutions(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.workflows.executions.v1beta.IExecution[], - protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest|null, - protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse - ]) => { - this._log.info('listExecutions values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.workflows.executions.v1beta.IExecution[], + protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest | null, + protos.google.cloud.workflows.executions.v1beta.IListExecutionsResponse, + ]) => { + this._log.info('listExecutions values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listExecutions`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC view. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.workflows.executions.v1beta.Execution|Execution} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listExecutions`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC view. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.workflows.executions.v1beta.Execution|Execution} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutionsStream( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutions']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listExecutions stream %j', request); return this.descriptors.page.listExecutions.createStream( this.innerApiCalls.listExecutions as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listExecutions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @param {number} request.pageSize - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @param {string} request.pageToken - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC view. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta/executions.list_executions.js - * region_tag:workflowexecutions_v1beta_generated_Executions_ListExecutions_async - */ + /** + * Equivalent to `listExecutions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Name of the workflow for which the executions should be listed. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @param {number} request.pageSize + * Maximum number of executions to return per call. + * Max supported value depends on the selected Execution view: it's 10000 for + * BASIC and 100 for FULL. The default value used if the field is not + * specified is 100, regardless of the selected view. Values greater than + * the max value will be coerced down to it. + * @param {string} request.pageToken + * A page token, received from a previous `ListExecutions` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListExecutions` must + * match the call that provided the page token. + * @param {google.cloud.workflows.executions.v1beta.ExecutionView} [request.view] + * Optional. A view defining which fields should be filled in the returned executions. + * The API will default to the BASIC view. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.workflows.executions.v1beta.Execution|Execution}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/executions.list_executions.js + * region_tag:workflowexecutions_v1beta_generated_Executions_ListExecutions_async + */ listExecutionsAsync( - request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.workflows.executions.v1beta.IListExecutionsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutions']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listExecutions iterate %j', request); return this.descriptors.page.listExecutions.asyncIterate( this.innerApiCalls['listExecutions'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } // -------------------- @@ -874,7 +1101,12 @@ export class ExecutionsClient { * @param {string} execution * @returns {string} Resource name string. */ - executionPath(project:string,location:string,workflow:string,execution:string) { + executionPath( + project: string, + location: string, + workflow: string, + execution: string, + ) { return this.pathTemplates.executionPathTemplate.render({ project: project, location: location, @@ -891,7 +1123,8 @@ export class ExecutionsClient { * @returns {string} A string representing the project. */ matchProjectFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).project; + return this.pathTemplates.executionPathTemplate.match(executionName) + .project; } /** @@ -902,7 +1135,8 @@ export class ExecutionsClient { * @returns {string} A string representing the location. */ matchLocationFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).location; + return this.pathTemplates.executionPathTemplate.match(executionName) + .location; } /** @@ -913,7 +1147,8 @@ export class ExecutionsClient { * @returns {string} A string representing the workflow. */ matchWorkflowFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).workflow; + return this.pathTemplates.executionPathTemplate.match(executionName) + .workflow; } /** @@ -924,7 +1159,8 @@ export class ExecutionsClient { * @returns {string} A string representing the execution. */ matchExecutionFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).execution; + return this.pathTemplates.executionPathTemplate.match(executionName) + .execution; } /** @@ -935,7 +1171,7 @@ export class ExecutionsClient { * @param {string} workflow * @returns {string} Resource name string. */ - workflowPath(project:string,location:string,workflow:string) { + workflowPath(project: string, location: string, workflow: string) { return this.pathTemplates.workflowPathTemplate.render({ project: project, location: location, @@ -984,7 +1220,7 @@ export class ExecutionsClient { */ close(): Promise { if (this.executionsStub && !this._terminated) { - return this.executionsStub.then(stub => { + return this.executionsStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -992,4 +1228,4 @@ export class ExecutionsClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-workflows/src/v1beta/index.ts b/packages/google-cloud-workflows/src/v1beta/index.ts index 413ec64c3867..20485377c45c 100644 --- a/packages/google-cloud-workflows/src/v1beta/index.ts +++ b/packages/google-cloud-workflows/src/v1beta/index.ts @@ -16,4 +16,4 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {ExecutionsClient} from './executions_client'; +export { ExecutionsClient } from './executions_client'; diff --git a/packages/google-cloud-workflows/src/v1beta/workflows_client.ts b/packages/google-cloud-workflows/src/v1beta/workflows_client.ts new file mode 100644 index 000000000000..ad693e65d860 --- /dev/null +++ b/packages/google-cloud-workflows/src/v1beta/workflows_client.ts @@ -0,0 +1,1824 @@ +// Copyright 2026 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. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform } from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1beta/workflows_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './workflows_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Workflows is used to deploy and execute workflow programs. + * Workflows makes sure the program executes reliably, despite hardware and + * networking interruptions. + * @class + * @memberof v1beta + */ +export class WorkflowsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('workflows'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + operationsClient: gax.OperationsClient; + workflowsStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of WorkflowsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new WorkflowsClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof WorkflowsClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'workflows.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}', + ), + workflowPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/workflows/{workflow}', + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listWorkflows: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'workflows', + ), + }; + + const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1beta/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1beta/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1beta/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1beta/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1beta/{name=projects/*/locations/*}/operations', + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createWorkflowResponse = protoFilesRoot.lookup( + '.google.cloud.workflows.v1beta.Workflow', + ) as gax.protobuf.Type; + const createWorkflowMetadata = protoFilesRoot.lookup( + '.google.cloud.workflows.v1beta.OperationMetadata', + ) as gax.protobuf.Type; + const deleteWorkflowResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty', + ) as gax.protobuf.Type; + const deleteWorkflowMetadata = protoFilesRoot.lookup( + '.google.cloud.workflows.v1beta.OperationMetadata', + ) as gax.protobuf.Type; + const updateWorkflowResponse = protoFilesRoot.lookup( + '.google.cloud.workflows.v1beta.Workflow', + ) as gax.protobuf.Type; + const updateWorkflowMetadata = protoFilesRoot.lookup( + '.google.cloud.workflows.v1beta.OperationMetadata', + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createWorkflow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createWorkflowResponse.decode.bind(createWorkflowResponse), + createWorkflowMetadata.decode.bind(createWorkflowMetadata), + ), + deleteWorkflow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteWorkflowResponse.decode.bind(deleteWorkflowResponse), + deleteWorkflowMetadata.decode.bind(deleteWorkflowMetadata), + ), + updateWorkflow: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateWorkflowResponse.decode.bind(updateWorkflowResponse), + updateWorkflowMetadata.decode.bind(updateWorkflowMetadata), + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.workflows.v1beta.Workflows', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.workflowsStub) { + return this.workflowsStub; + } + + // Put together the "service stub" for + // google.cloud.workflows.v1beta.Workflows. + this.workflowsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.workflows.v1beta.Workflows', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.workflows.v1beta.Workflows, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const workflowsStubMethods = [ + 'listWorkflows', + 'getWorkflow', + 'createWorkflow', + 'deleteWorkflow', + 'updateWorkflow', + ]; + for (const methodName of workflowsStubMethods) { + const callPromise = this.workflowsStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.workflowsStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'workflows.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'workflows.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Gets details of a single Workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow which information should be retrieved. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @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 protos.google.cloud.workflows.v1beta.Workflow|Workflow}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/workflows.get_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_GetWorkflow_async + */ + getWorkflow( + request?: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest | undefined, + {} | undefined, + ] + >; + getWorkflow( + request: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + | protos.google.cloud.workflows.v1beta.IGetWorkflowRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getWorkflow( + request: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + callback: Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + | protos.google.cloud.workflows.v1beta.IGetWorkflowRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getWorkflow( + request?: protos.google.cloud.workflows.v1beta.IGetWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + | protos.google.cloud.workflows.v1beta.IGetWorkflowRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + | protos.google.cloud.workflows.v1beta.IGetWorkflowRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest | 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 || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getWorkflow request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.workflows.v1beta.IWorkflow, + | protos.google.cloud.workflows.v1beta.IGetWorkflowRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getWorkflow response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getWorkflow(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IGetWorkflowRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getWorkflow response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Creates a new workflow. If a workflow with the specified name already + * exists in the specified project and location, the long running operation + * will return {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS} error. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location in which the workflow should be created. + * Format: projects/{project}/locations/{location} + * @param {google.cloud.workflows.v1beta.Workflow} request.workflow + * Required. Workflow to be created. + * @param {string} request.workflowId + * Required. The ID of the workflow to be created. It has to fulfill the + * following requirements: + * + * * Must contain only letters, numbers, underscores and hyphens. + * * Must start with a letter. + * * Must be between 1-64 characters. + * * Must end with a number or a letter. + * * Must be unique within the customer project and location. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/workflows.create_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_CreateWorkflow_async + */ + createWorkflow( + request?: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + createWorkflow( + request: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createWorkflow( + request: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createWorkflow( + request?: protos.google.cloud.workflows.v1beta.ICreateWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | 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 || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('createWorkflow response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('createWorkflow request %j', request); + return this.innerApiCalls + .createWorkflow(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createWorkflow response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `createWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/workflows.create_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_CreateWorkflow_async + */ + async checkCreateWorkflowProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.workflows.v1beta.Workflow, + protos.google.cloud.workflows.v1beta.OperationMetadata + > + > { + this._log.info('createWorkflow long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createWorkflow, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.workflows.v1beta.Workflow, + protos.google.cloud.workflows.v1beta.OperationMetadata + >; + } + /** + * Deletes a workflow with the specified name. + * This method also cancels and deletes all running executions of the + * workflow. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the workflow to be deleted. + * Format: projects/{project}/locations/{location}/workflows/{workflow} + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/workflows.delete_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_DeleteWorkflow_async + */ + deleteWorkflow( + request?: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + deleteWorkflow( + request: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteWorkflow( + request: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteWorkflow( + request?: protos.google.cloud.workflows.v1beta.IDeleteWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | 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 || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('deleteWorkflow response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('deleteWorkflow request %j', request); + return this.innerApiCalls + .deleteWorkflow(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteWorkflow response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `deleteWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/workflows.delete_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_DeleteWorkflow_async + */ + async checkDeleteWorkflowProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.workflows.v1beta.OperationMetadata + > + > { + this._log.info('deleteWorkflow long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteWorkflow, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.workflows.v1beta.OperationMetadata + >; + } + /** + * Updates an existing workflow. + * Running this method has no impact on already running executions of the + * workflow. A new revision of the workflow may be created as a result of a + * successful update operation. In that case, such revision will be used + * in new workflow executions. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.workflows.v1beta.Workflow} request.workflow + * Required. Workflow to be updated. + * @param {google.protobuf.FieldMask} request.updateMask + * List of fields to be updated. If not present, the entire workflow + * will be updated. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/workflows.update_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_UpdateWorkflow_async + */ + updateWorkflow( + request?: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + updateWorkflow( + request: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateWorkflow( + request: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + callback: Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateWorkflow( + request?: protos.google.cloud.workflows.v1beta.IUpdateWorkflowRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | 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 || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'workflow.name': request.workflow!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('updateWorkflow response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('updateWorkflow request %j', request); + return this.innerApiCalls + .updateWorkflow(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateWorkflow response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `updateWorkflow()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/workflows.update_workflow.js + * region_tag:workflows_v1beta_generated_Workflows_UpdateWorkflow_async + */ + async checkUpdateWorkflowProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.workflows.v1beta.Workflow, + protos.google.cloud.workflows.v1beta.OperationMetadata + > + > { + this._log.info('updateWorkflow long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateWorkflow, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.workflows.v1beta.Workflow, + protos.google.cloud.workflows.v1beta.OperationMetadata + >; + } + /** + * Lists Workflows in a given project and location. + * The default order is not specified. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified order. + * @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 Array of {@link protos.google.cloud.workflows.v1beta.Workflow|Workflow}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkflows( + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workflows.v1beta.IWorkflow[], + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest | null, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse, + ] + >; + listWorkflows( + request: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1beta.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1beta.IWorkflow + >, + ): void; + listWorkflows( + request: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + callback: PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1beta.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1beta.IWorkflow + >, + ): void; + listWorkflows( + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1beta.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1beta.IWorkflow + >, + callback?: PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1beta.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1beta.IWorkflow + >, + ): Promise< + [ + protos.google.cloud.workflows.v1beta.IWorkflow[], + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest | null, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse, + ] + > | 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 || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + | protos.google.cloud.workflows.v1beta.IListWorkflowsResponse + | null + | undefined, + protos.google.cloud.workflows.v1beta.IWorkflow + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listWorkflows values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listWorkflows request %j', request); + return this.innerApiCalls + .listWorkflows(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.cloud.workflows.v1beta.IWorkflow[], + protos.google.cloud.workflows.v1beta.IListWorkflowsRequest | null, + protos.google.cloud.workflows.v1beta.IListWorkflowsResponse, + ]) => { + this._log.info('listWorkflows values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listWorkflows`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.workflows.v1beta.Workflow|Workflow} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listWorkflowsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listWorkflowsStream( + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + options?: CallOptions, + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listWorkflows']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listWorkflows stream %j', request); + return this.descriptors.page.listWorkflows.createStream( + this.innerApiCalls.listWorkflows as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listWorkflows`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Project and location from which the workflows should be listed. + * Format: projects/{project}/locations/{location} + * @param {number} request.pageSize + * Maximum number of workflows to return per call. The service may return + * fewer than this value. If the value is not specified, a default value of + * 500 will be used. The maximum permitted value is 1000 and values greater + * than 1000 will be coerced down to 1000. + * @param {string} request.pageToken + * A page token, received from a previous `ListWorkflows` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListWorkflows` must + * match the call that provided the page token. + * @param {string} request.filter + * Filter to restrict results to specific workflows. + * @param {string} request.orderBy + * Comma-separated list of fields that that specify the order of the results. + * Default sorting order for a field is ascending. To specify descending order + * for a field, append a " desc" suffix. + * If not specified, the results will be returned in an unspecified order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.workflows.v1beta.Workflow|Workflow}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta/workflows.list_workflows.js + * region_tag:workflows_v1beta_generated_Workflows_ListWorkflows_async + */ + listWorkflowsAsync( + request?: protos.google.cloud.workflows.v1beta.IListWorkflowsRequest, + options?: CallOptions, + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listWorkflows']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listWorkflows iterate %j', request); + return this.descriptors.page.listWorkflows.asyncIterate( + this.innerApiCalls['listWorkflows'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + ): Promise<[protos.google.longrunning.Operation]> { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions, + ): AsyncIterable { + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + >, + ): Promise { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + return this.operationsClient.cancelOperation(request, options, callback); + } + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + ): Promise { + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified workflow resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} workflow + * @returns {string} Resource name string. + */ + workflowPath(project: string, location: string, workflow: string) { + return this.pathTemplates.workflowPathTemplate.render({ + project: project, + location: location, + workflow: workflow, + }); + } + + /** + * Parse the project from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the project. + */ + matchProjectFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).project; + } + + /** + * Parse the location from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the location. + */ + matchLocationFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).location; + } + + /** + * Parse the workflow from Workflow resource. + * + * @param {string} workflowName + * A fully-qualified path representing Workflow resource. + * @returns {string} A string representing the workflow. + */ + matchWorkflowFromWorkflowName(workflowName: string) { + return this.pathTemplates.workflowPathTemplate.match(workflowName).workflow; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.workflowsStub && !this._terminated) { + return this.workflowsStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + void this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-workflows/src/v1beta/workflows_client_config.json b/packages/google-cloud-workflows/src/v1beta/workflows_client_config.json new file mode 100644 index 000000000000..bccc9e1babbb --- /dev/null +++ b/packages/google-cloud-workflows/src/v1beta/workflows_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.workflows.v1beta.Workflows": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListWorkflows": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateWorkflow": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-workflows/src/v1beta/workflows_proto_list.json b/packages/google-cloud-workflows/src/v1beta/workflows_proto_list.json new file mode 100644 index 000000000000..c9d0fa6bc07a --- /dev/null +++ b/packages/google-cloud-workflows/src/v1beta/workflows_proto_list.json @@ -0,0 +1,3 @@ +[ + "../../protos/google/cloud/workflows/v1beta/workflows.proto" +] diff --git a/packages/google-cloud-workflows/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-workflows/system-test/fixtures/sample/src/index.ts index 7ce7a4fddcb4..266587e20a0d 100644 --- a/packages/google-cloud-workflows/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-workflows/system-test/fixtures/sample/src/index.ts @@ -16,7 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {ExecutionsClient} from '@google-cloud/workflows'; +import { ExecutionsClient } from '@google-cloud/workflows'; // check that the client class type name can be used function doStuffWithExecutionsClient(client: ExecutionsClient) { diff --git a/packages/google-cloud-workflows/system-test/install.ts b/packages/google-cloud-workflows/system-test/install.ts index 394f3362d203..ccf167042d2e 100644 --- a/packages/google-cloud-workflows/system-test/install.ts +++ b/packages/google-cloud-workflows/system-test/install.ts @@ -16,34 +16,36 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { + it('TypeScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts', + ).toString(), + }, }; await packNTest(options); }); - it('JavaScript code', async function() { + it('JavaScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } + cjs: readFileSync( + './system-test/fixtures/sample/src/index.js', + ).toString(), + }, }; await packNTest(options); }); - }); diff --git a/packages/google-cloud-workflows/test/gapic_executions_v1.ts b/packages/google-cloud-workflows/test/gapic_executions_v1.ts index 24682833c4e6..fcb4cb8219a7 100644 --- a/packages/google-cloud-workflows/test/gapic_executions_v1.ts +++ b/packages/google-cloud-workflows/test/gapic_executions_v1.ts @@ -19,915 +19,1171 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as executionsModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf} from 'google-gax'; +import { protobuf } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.ExecutionsClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new executionsModule.v1.ExecutionsClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'workflowexecutions.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new executionsModule.v1.ExecutionsClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new executionsModule.v1.ExecutionsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'workflowexecutions.googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = executionsModule.v1.ExecutionsClient.servicePath; - assert.strictEqual(servicePath, 'workflowexecutions.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = executionsModule.v1.ExecutionsClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'workflowexecutions.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new executionsModule.v1.ExecutionsClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'workflowexecutions.example.com'); - }); + it('has universeDomain', () => { + const client = new executionsModule.v1.ExecutionsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new executionsModule.v1.ExecutionsClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'workflowexecutions.example.com'); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = executionsModule.v1.ExecutionsClient.servicePath; + assert.strictEqual(servicePath, 'workflowexecutions.googleapis.com'); + assert(stub.called); + stub.restore(); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new executionsModule.v1.ExecutionsClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'workflowexecutions.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new executionsModule.v1.ExecutionsClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'workflowexecutions.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new executionsModule.v1.ExecutionsClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = executionsModule.v1.ExecutionsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'workflowexecutions.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new executionsModule.v1.ExecutionsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workflowexecutions.example.com'); + }); - it('has port', () => { - const port = executionsModule.v1.ExecutionsClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new executionsModule.v1.ExecutionsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workflowexecutions.example.com'); + }); - it('should create a client with no option', () => { - const client = new executionsModule.v1.ExecutionsClient(); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new executionsModule.v1.ExecutionsClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workflowexecutions.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('should create a client with gRPC fallback', () => { - const client = new executionsModule.v1.ExecutionsClient({ - fallback: true, - }); - assert(client); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new executionsModule.v1.ExecutionsClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'workflowexecutions.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - await client.initialize(); - assert(client.executionsStub); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new executionsModule.v1.ExecutionsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has close method for the initialized client', done => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.executionsStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has port', () => { + const port = executionsModule.v1.ExecutionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has close method for the non-initialized client', done => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with no option', () => { + const client = new executionsModule.v1.ExecutionsClient(); + assert(client); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + it('should create a client with gRPC fallback', () => { + const client = new executionsModule.v1.ExecutionsClient({ + fallback: true, + }); + assert(client); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + await client.initialize(); + assert(client.executionsStub); }); - describe('createExecution', () => { - it('invokes createExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); - const [response] = await client.createExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.executionsStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes createExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes createExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes createExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createExecution(request), expectedError); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); + }); - describe('getExecution', () => { - it('invokes getExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); - const [response] = await client.getExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('createExecution', () => { + it('invokes createExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CreateExecutionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ); + client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); + const [response] = await client.createExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CreateExecutionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ); + client.innerApiCalls.createExecution = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createExecution( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.executions.v1.IExecution | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CreateExecutionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExecution = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createExecution(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getExecution(request), expectedError); - }); + it('invokes createExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CreateExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CreateExecutionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createExecution(request), expectedError); }); + }); - describe('cancelExecution', () => { - it('invokes cancelExecution without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); - const [response] = await client.cancelExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('getExecution', () => { + it('invokes getExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.GetExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ); + client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); + const [response] = await client.getExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.GetExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ); + client.innerApiCalls.getExecution = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExecution( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.executions.v1.IExecution | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.GetExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExecution = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getExecution(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution with closed client', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.cancelExecution(request), expectedError); - }); + it('invokes getExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.GetExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.GetExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getExecution(request), expectedError); }); + }); - describe('listExecutions', () => { - it('invokes listExecutions without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); - const [response] = await client.listExecutions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('cancelExecution', () => { + it('invokes cancelExecution without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CancelExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ); + client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); + const [response] = await client.cancelExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutions without error using callback', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExecutions( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1.IExecution[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cancelExecution without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CancelExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ); + client.innerApiCalls.cancelExecution = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelExecution( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.executions.v1.IExecution | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutions with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExecutions(request), expectedError); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cancelExecution with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CancelExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelExecution = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.cancelExecution(request), expectedError); + const actualRequest = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutionsStream without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1.Execution) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes cancelExecution with closed client', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.CancelExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.CancelExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.cancelExecution(request), expectedError); + }); + }); - it('invokes listExecutionsStream with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1.Execution) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('listExecutions', () => { + it('invokes listExecutions without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ), + ]; + client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); + const [response] = await client.listExecutions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listExecutions without error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1.Execution()), - ]; - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = []; - const iterable = client.listExecutionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listExecutions without error using callback', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ), + ]; + client.innerApiCalls.listExecutions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExecutions( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.workflows.executions.v1.IExecution[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listExecutions with error', async () => { - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExecutionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listExecutions with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExecutions = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listExecutions(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('Path templates', () => { - - describe('execution', async () => { - const fakePath = "/rendered/path/execution"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - execution: "executionValue", - }; - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.executionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.executionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('executionPath', () => { - const result = client.executionPath("projectValue", "locationValue", "workflowValue", "executionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.executionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromExecutionName', () => { - const result = client.matchProjectFromExecutionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromExecutionName', () => { - const result = client.matchLocationFromExecutionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromExecutionName', () => { - const result = client.matchWorkflowFromExecutionName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExecutionFromExecutionName', () => { - const result = client.matchExecutionFromExecutionName(fakePath); - assert.strictEqual(result, "executionValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listExecutionsStream without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ), + ]; + client.descriptors.page.listExecutions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1.Execution[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.workflows.executions.v1.Execution) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listExecutions, request), + ); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - describe('workflow', async () => { - const fakePath = "/rendered/path/workflow"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - }; - const client = new executionsModule.v1.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.workflowPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listExecutionsStream with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1.Execution[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.workflows.executions.v1.Execution) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listExecutions, request), + ); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listExecutions without error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.Execution(), + ), + ]; + client.descriptors.page.listExecutions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = + []; + const iterable = client.listExecutionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listExecutions.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listExecutions with error', async () => { + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExecutionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.executions.v1.IExecution[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listExecutions.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('Path templates', () => { + describe('execution', async () => { + const fakePath = '/rendered/path/execution'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + workflow: 'workflowValue', + execution: 'executionValue', + }; + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.executionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.executionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('executionPath', () => { + const result = client.executionPath( + 'projectValue', + 'locationValue', + 'workflowValue', + 'executionValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.executionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromExecutionName', () => { + const result = client.matchProjectFromExecutionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromExecutionName', () => { + const result = client.matchLocationFromExecutionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchWorkflowFromExecutionName', () => { + const result = client.matchWorkflowFromExecutionName(fakePath); + assert.strictEqual(result, 'workflowValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchExecutionFromExecutionName', () => { + const result = client.matchExecutionFromExecutionName(fakePath); + assert.strictEqual(result, 'executionValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('workflow', async () => { + const fakePath = '/rendered/path/workflow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + workflow: 'workflowValue', + }; + const client = new executionsModule.v1.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.workflowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath( + 'projectValue', + 'locationValue', + 'workflowValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, 'workflowValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-workflows/test/gapic_executions_v1beta.ts b/packages/google-cloud-workflows/test/gapic_executions_v1beta.ts index 08d2f69367ac..32829ae65ea8 100644 --- a/packages/google-cloud-workflows/test/gapic_executions_v1beta.ts +++ b/packages/google-cloud-workflows/test/gapic_executions_v1beta.ts @@ -19,915 +19,1177 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as executionsModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf} from 'google-gax'; +import { protobuf } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1beta.ExecutionsClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new executionsModule.v1beta.ExecutionsClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'workflowexecutions.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new executionsModule.v1beta.ExecutionsClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new executionsModule.v1beta.ExecutionsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'workflowexecutions.googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = executionsModule.v1beta.ExecutionsClient.servicePath; - assert.strictEqual(servicePath, 'workflowexecutions.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = executionsModule.v1beta.ExecutionsClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'workflowexecutions.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new executionsModule.v1beta.ExecutionsClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'workflowexecutions.example.com'); - }); + it('has universeDomain', () => { + const client = new executionsModule.v1beta.ExecutionsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new executionsModule.v1beta.ExecutionsClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'workflowexecutions.example.com'); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + executionsModule.v1beta.ExecutionsClient.servicePath; + assert.strictEqual(servicePath, 'workflowexecutions.googleapis.com'); + assert(stub.called); + stub.restore(); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new executionsModule.v1beta.ExecutionsClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'workflowexecutions.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new executionsModule.v1beta.ExecutionsClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'workflowexecutions.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new executionsModule.v1beta.ExecutionsClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + executionsModule.v1beta.ExecutionsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'workflowexecutions.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workflowexecutions.example.com'); + }); - it('has port', () => { - const port = executionsModule.v1beta.ExecutionsClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workflowexecutions.example.com'); + }); - it('should create a client with no option', () => { - const client = new executionsModule.v1beta.ExecutionsClient(); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new executionsModule.v1beta.ExecutionsClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workflowexecutions.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('should create a client with gRPC fallback', () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - fallback: true, - }); - assert(client); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new executionsModule.v1beta.ExecutionsClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'workflowexecutions.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - await client.initialize(); - assert(client.executionsStub); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new executionsModule.v1beta.ExecutionsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has close method for the initialized client', done => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.executionsStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has port', () => { + const port = executionsModule.v1beta.ExecutionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has close method for the non-initialized client', done => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.executionsStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with no option', () => { + const client = new executionsModule.v1beta.ExecutionsClient(); + assert(client); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + it('should create a client with gRPC fallback', () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + fallback: true, + }); + assert(client); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + await client.initialize(); + assert(client.executionsStub); }); - describe('createExecution', () => { - it('invokes createExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); - const [response] = await client.createExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.executionsStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes createExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.createExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.executionsStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes createExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes createExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createExecution(request), expectedError); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); + }); - describe('getExecution', () => { - it('invokes getExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); - const [response] = await client.getExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('createExecution', () => { + it('invokes createExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ); + client.innerApiCalls.createExecution = stubSimpleCall(expectedResponse); + const [response] = await client.createExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ); + client.innerApiCalls.createExecution = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createExecution( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.executions.v1beta.IExecution | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createExecution = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createExecution(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getExecution(request), expectedError); - }); + it('invokes createExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CreateExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CreateExecutionRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createExecution(request), expectedError); }); + }); - describe('cancelExecution', () => { - it('invokes cancelExecution without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); - const [response] = await client.cancelExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('getExecution', () => { + it('invokes getExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.GetExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ); + client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); + const [response] = await client.getExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.Execution() - ); - client.innerApiCalls.cancelExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.GetExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ); + client.innerApiCalls.getExecution = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExecution( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.executions.v1beta.IExecution | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.GetExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExecution = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getExecution(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes cancelExecution with closed client', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.cancelExecution(request), expectedError); - }); + it('invokes getExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.GetExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.GetExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getExecution(request), expectedError); }); + }); - describe('listExecutions', () => { - it('invokes listExecutions without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); - const [response] = await client.listExecutions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('cancelExecution', () => { + it('invokes cancelExecution without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ); + client.innerApiCalls.cancelExecution = stubSimpleCall(expectedResponse); + const [response] = await client.cancelExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutions without error using callback', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExecutions( - request, - (err?: Error|null, result?: protos.google.cloud.workflows.executions.v1beta.IExecution[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cancelExecution without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ); + client.innerApiCalls.cancelExecution = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancelExecution( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.executions.v1beta.IExecution | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutions with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExecutions(request), expectedError); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes cancelExecution with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancelExecution = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.cancelExecution(request), expectedError); + const actualRequest = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancelExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutionsStream without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1beta.Execution) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes cancelExecution with closed client', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.CancelExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.CancelExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.cancelExecution(request), expectedError); + }); + }); - it('invokes listExecutionsStream with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workflows.executions.v1beta.Execution) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('listExecutions', () => { + it('invokes listExecutions without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ), + ]; + client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); + const [response] = await client.listExecutions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listExecutions without error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - generateSampleMessage(new protos.google.cloud.workflows.executions.v1beta.Execution()), - ]; - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = []; - const iterable = client.listExecutionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listExecutions without error using callback', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ), + ]; + client.innerApiCalls.listExecutions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExecutions( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.workflows.executions.v1beta.IExecution[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listExecutions with error', async () => { - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExecutionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listExecutions with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExecutions = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listExecutions(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('Path templates', () => { - - describe('execution', async () => { - const fakePath = "/rendered/path/execution"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - execution: "executionValue", - }; - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.executionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.executionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('executionPath', () => { - const result = client.executionPath("projectValue", "locationValue", "workflowValue", "executionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.executionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromExecutionName', () => { - const result = client.matchProjectFromExecutionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromExecutionName', () => { - const result = client.matchLocationFromExecutionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromExecutionName', () => { - const result = client.matchWorkflowFromExecutionName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExecutionFromExecutionName', () => { - const result = client.matchExecutionFromExecutionName(fakePath); - assert.strictEqual(result, "executionValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listExecutionsStream without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ), + ]; + client.descriptors.page.listExecutions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.workflows.executions.v1beta.Execution, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listExecutions, request), + ); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - describe('workflow', async () => { - const fakePath = "/rendered/path/workflow"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - workflow: "workflowValue", - }; - const client = new executionsModule.v1beta.ExecutionsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.workflowPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.workflowPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('workflowPath', () => { - const result = client.workflowPath("projectValue", "locationValue", "workflowValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.workflowPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromWorkflowName', () => { - const result = client.matchProjectFromWorkflowName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromWorkflowName', () => { - const result = client.matchLocationFromWorkflowName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchWorkflowFromWorkflowName', () => { - const result = client.matchWorkflowFromWorkflowName(fakePath); - assert.strictEqual(result, "workflowValue"); - assert((client.pathTemplates.workflowPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes listExecutionsStream with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.executions.v1beta.Execution[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.workflows.executions.v1beta.Execution, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listExecutions, request), + ); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listExecutions without error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.Execution(), + ), + ]; + client.descriptors.page.listExecutions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = + []; + const iterable = client.listExecutionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listExecutions.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listExecutions with error', async () => { + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.executions.v1beta.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.executions.v1beta.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExecutionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.executions.v1beta.IExecution[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listExecutions.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('Path templates', () => { + describe('execution', async () => { + const fakePath = '/rendered/path/execution'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + workflow: 'workflowValue', + execution: 'executionValue', + }; + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.executionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.executionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('executionPath', () => { + const result = client.executionPath( + 'projectValue', + 'locationValue', + 'workflowValue', + 'executionValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.executionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromExecutionName', () => { + const result = client.matchProjectFromExecutionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromExecutionName', () => { + const result = client.matchLocationFromExecutionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchWorkflowFromExecutionName', () => { + const result = client.matchWorkflowFromExecutionName(fakePath); + assert.strictEqual(result, 'workflowValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchExecutionFromExecutionName', () => { + const result = client.matchExecutionFromExecutionName(fakePath); + assert.strictEqual(result, 'executionValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('workflow', async () => { + const fakePath = '/rendered/path/workflow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + workflow: 'workflowValue', + }; + const client = new executionsModule.v1beta.ExecutionsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.workflowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath( + 'projectValue', + 'locationValue', + 'workflowValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, 'workflowValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-workflows/test/gapic_workflows_v1.ts b/packages/google-cloud-workflows/test/gapic_workflows_v1.ts new file mode 100644 index 000000000000..9cb56fc169fd --- /dev/null +++ b/packages/google-cloud-workflows/test/gapic_workflows_v1.ts @@ -0,0 +1,2494 @@ +// Copyright 2026 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. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as workflowsModule from '../src'; + +import { PassThrough } from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.WorkflowsClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new workflowsModule.v1.WorkflowsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'workflows.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new workflowsModule.v1.WorkflowsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = workflowsModule.v1.WorkflowsClient.servicePath; + assert.strictEqual(servicePath, 'workflows.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = workflowsModule.v1.WorkflowsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'workflows.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new workflowsModule.v1.WorkflowsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workflows.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new workflowsModule.v1.WorkflowsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workflows.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new workflowsModule.v1.WorkflowsClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workflows.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new workflowsModule.v1.WorkflowsClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workflows.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new workflowsModule.v1.WorkflowsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = workflowsModule.v1.WorkflowsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new workflowsModule.v1.WorkflowsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new workflowsModule.v1.WorkflowsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + await client.initialize(); + assert(client.workflowsStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.workflowsStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getWorkflow', () => { + it('invokes getWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.GetWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1.Workflow(), + ); + client.innerApiCalls.getWorkflow = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkflow(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.GetWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1.Workflow(), + ); + client.innerApiCalls.getWorkflow = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkflow( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.v1.IWorkflow | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflow with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.GetWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkflow = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflow with closed client', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.GetWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.GetWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getWorkflow(request), expectedError); + }); + }); + + describe('createWorkflow', () => { + it('invokes createWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.CreateWorkflowRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createWorkflow = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.CreateWorkflowRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createWorkflow = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkflow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflow with call error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.CreateWorkflowRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflow with LRO error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.CreateWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.CreateWorkflowRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkflowProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateWorkflowProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteWorkflow', () => { + it('invokes deleteWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.DeleteWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteWorkflow = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.DeleteWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteWorkflow = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkflow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflow with call error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.DeleteWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflow with LRO error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.DeleteWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.DeleteWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteWorkflowProgress without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkflowProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteWorkflowProgress with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteWorkflowProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateWorkflow', () => { + it('invokes updateWorkflow without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest(), + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.UpdateWorkflowRequest', + ['workflow', 'name'], + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateWorkflow = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflow without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest(), + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.UpdateWorkflowRequest', + ['workflow', 'name'], + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateWorkflow = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkflow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.workflows.v1.IWorkflow, + protos.google.cloud.workflows.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflow with call error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest(), + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.UpdateWorkflowRequest', + ['workflow', 'name'], + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflow with LRO error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.UpdateWorkflowRequest(), + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.UpdateWorkflowRequest', + ['workflow', 'name'], + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkflowProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateWorkflowProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listWorkflows', () => { + it('invokes listWorkflows without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.innerApiCalls.listWorkflows = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkflows(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflows without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.innerApiCalls.listWorkflows = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkflows( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.v1.IWorkflow[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflows with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkflows = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listWorkflows(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflowsStream without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.descriptors.page.listWorkflows.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1.Workflow[] = []; + stream.on( + 'data', + (response: protos.google.cloud.workflows.v1.Workflow) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listWorkflows, request), + ); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listWorkflowsStream with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1.Workflow[] = []; + stream.on( + 'data', + (response: protos.google.cloud.workflows.v1.Workflow) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listWorkflows, request), + ); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listWorkflows without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.descriptors.page.listWorkflows.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; + const iterable = client.listWorkflowsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listWorkflows.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listWorkflows with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkflowsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listWorkflows.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listWorkflowRevisions', () => { + it('invokes listWorkflowRevisions without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowRevisionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowRevisionsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.innerApiCalls.listWorkflowRevisions = + stubSimpleCall(expectedResponse); + const [response] = await client.listWorkflowRevisions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listWorkflowRevisions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflowRevisions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflowRevisions without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowRevisionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowRevisionsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.innerApiCalls.listWorkflowRevisions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkflowRevisions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.v1.IWorkflow[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listWorkflowRevisions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflowRevisions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflowRevisions with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowRevisionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowRevisionsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkflowRevisions = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listWorkflowRevisions(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listWorkflowRevisions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflowRevisions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflowRevisionsStream without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowRevisionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowRevisionsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.descriptors.page.listWorkflowRevisions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listWorkflowRevisionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1.Workflow[] = []; + stream.on( + 'data', + (response: protos.google.cloud.workflows.v1.Workflow) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listWorkflowRevisions + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listWorkflowRevisions, request), + ); + assert( + ( + client.descriptors.page.listWorkflowRevisions + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + + it('invokes listWorkflowRevisionsStream with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowRevisionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowRevisionsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflowRevisions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkflowRevisionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1.Workflow[] = []; + stream.on( + 'data', + (response: protos.google.cloud.workflows.v1.Workflow) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listWorkflowRevisions + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listWorkflowRevisions, request), + ); + assert( + ( + client.descriptors.page.listWorkflowRevisions + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + + it('uses async iteration with listWorkflowRevisions without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowRevisionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowRevisionsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + generateSampleMessage(new protos.google.cloud.workflows.v1.Workflow()), + ]; + client.descriptors.page.listWorkflowRevisions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; + const iterable = client.listWorkflowRevisionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listWorkflowRevisions + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listWorkflowRevisions + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + + it('uses async iteration with listWorkflowRevisions with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1.ListWorkflowRevisionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1.ListWorkflowRevisionsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflowRevisions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkflowRevisionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.v1.IWorkflow[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listWorkflowRevisions + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.descriptors.page.listWorkflowRevisions + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.IOperation[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.IOperation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + }); + + describe('Path templates', () => { + describe('cryptoKey', async () => { + const fakePath = '/rendered/path/cryptoKey'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + keyRing: 'keyRingValue', + cryptoKey: 'cryptoKeyValue', + }; + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath( + 'projectValue', + 'locationValue', + 'keyRingValue', + 'cryptoKeyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchKeyRingFromCryptoKeyName', () => { + const result = client.matchKeyRingFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCryptoKeyFromCryptoKeyName', () => { + const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'cryptoKeyValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('cryptoKeyVersion', async () => { + const fakePath = '/rendered/path/cryptoKeyVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + keyRing: 'keyRingValue', + cryptoKey: 'cryptoKeyValue', + cryptoKeyVersion: 'cryptoKeyVersionValue', + }; + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.cryptoKeyVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.cryptoKeyVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('cryptoKeyVersionPath', () => { + const result = client.cryptoKeyVersionPath( + 'projectValue', + 'locationValue', + 'keyRingValue', + 'cryptoKeyValue', + 'cryptoKeyVersionValue', + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.cryptoKeyVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromCryptoKeyVersionName', () => { + const result = client.matchProjectFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCryptoKeyVersionName', () => { + const result = client.matchLocationFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchKeyRingFromCryptoKeyVersionName', () => { + const result = client.matchKeyRingFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCryptoKeyFromCryptoKeyVersionName', () => { + const result = client.matchCryptoKeyFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'cryptoKeyValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCryptoKeyVersionFromCryptoKeyVersionName', () => { + const result = + client.matchCryptoKeyVersionFromCryptoKeyVersionName(fakePath); + assert.strictEqual(result, 'cryptoKeyVersionValue'); + assert( + (client.pathTemplates.cryptoKeyVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('workflow', async () => { + const fakePath = '/rendered/path/workflow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + workflow: 'workflowValue', + }; + const client = new workflowsModule.v1.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.workflowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath( + 'projectValue', + 'locationValue', + 'workflowValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, 'workflowValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-workflows/test/gapic_workflows_v1beta.ts b/packages/google-cloud-workflows/test/gapic_workflows_v1beta.ts new file mode 100644 index 000000000000..2cf762706360 --- /dev/null +++ b/packages/google-cloud-workflows/test/gapic_workflows_v1beta.ts @@ -0,0 +1,2025 @@ +// Copyright 2026 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. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as workflowsModule from '../src'; + +import { PassThrough } from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta.WorkflowsClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new workflowsModule.v1beta.WorkflowsClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'workflows.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new workflowsModule.v1beta.WorkflowsClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = workflowsModule.v1beta.WorkflowsClient.servicePath; + assert.strictEqual(servicePath, 'workflows.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = workflowsModule.v1beta.WorkflowsClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'workflows.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workflows.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workflows.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new workflowsModule.v1beta.WorkflowsClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workflows.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new workflowsModule.v1beta.WorkflowsClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workflows.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new workflowsModule.v1beta.WorkflowsClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = workflowsModule.v1beta.WorkflowsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new workflowsModule.v1beta.WorkflowsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + await client.initialize(); + assert(client.workflowsStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.workflowsStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.workflowsStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getWorkflow', () => { + it('invokes getWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.GetWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow(), + ); + client.innerApiCalls.getWorkflow = stubSimpleCall(expectedResponse); + const [response] = await client.getWorkflow(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.GetWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow(), + ); + client.innerApiCalls.getWorkflow = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getWorkflow( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.v1beta.IWorkflow | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflow with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.GetWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getWorkflow = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getWorkflow with closed client', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.GetWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.GetWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getWorkflow(request), expectedError); + }); + }); + + describe('createWorkflow', () => { + it('invokes createWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.CreateWorkflowRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createWorkflow = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.CreateWorkflowRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createWorkflow = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createWorkflow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflow with call error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.CreateWorkflowRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createWorkflow with LRO error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.CreateWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.CreateWorkflowRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createWorkflow = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateWorkflowProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateWorkflowProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteWorkflow', () => { + it('invokes deleteWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.DeleteWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteWorkflow = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.DeleteWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteWorkflow = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteWorkflow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflow with call error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.DeleteWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteWorkflow with LRO error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.DeleteWorkflowRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.DeleteWorkflowRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteWorkflow = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteWorkflowProgress without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteWorkflowProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteWorkflowProgress with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteWorkflowProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateWorkflow', () => { + it('invokes updateWorkflow without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest(), + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.UpdateWorkflowRequest', + ['workflow', 'name'], + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateWorkflow = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateWorkflow(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflow without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest(), + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.UpdateWorkflowRequest', + ['workflow', 'name'], + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateWorkflow = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateWorkflow( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.workflows.v1beta.IWorkflow, + protos.google.cloud.workflows.v1beta.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflow with call error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest(), + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.UpdateWorkflowRequest', + ['workflow', 'name'], + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateWorkflow(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateWorkflow with LRO error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.UpdateWorkflowRequest(), + ); + request.workflow ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.UpdateWorkflowRequest', + ['workflow', 'name'], + ); + request.workflow.name = defaultValue1; + const expectedHeaderRequestParams = `workflow.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateWorkflow = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateWorkflow(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateWorkflow as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateWorkflowProgress without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateWorkflowProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateWorkflowProgress with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateWorkflowProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listWorkflows', () => { + it('invokes listWorkflows without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.ListWorkflowsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow(), + ), + ]; + client.innerApiCalls.listWorkflows = stubSimpleCall(expectedResponse); + const [response] = await client.listWorkflows(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflows without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.ListWorkflowsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow(), + ), + ]; + client.innerApiCalls.listWorkflows = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listWorkflows( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workflows.v1beta.IWorkflow[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflows with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.ListWorkflowsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listWorkflows = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listWorkflows(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listWorkflows as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listWorkflowsStream without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.ListWorkflowsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow(), + ), + ]; + client.descriptors.page.listWorkflows.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1beta.Workflow[] = []; + stream.on( + 'data', + (response: protos.google.cloud.workflows.v1beta.Workflow) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listWorkflows, request), + ); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listWorkflowsStream with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.ListWorkflowsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listWorkflowsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workflows.v1beta.Workflow[] = []; + stream.on( + 'data', + (response: protos.google.cloud.workflows.v1beta.Workflow) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listWorkflows, request), + ); + assert( + (client.descriptors.page.listWorkflows.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listWorkflows without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.ListWorkflowsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow(), + ), + generateSampleMessage( + new protos.google.cloud.workflows.v1beta.Workflow(), + ), + ]; + client.descriptors.page.listWorkflows.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workflows.v1beta.IWorkflow[] = []; + const iterable = client.listWorkflowsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listWorkflows.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listWorkflows with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workflows.v1beta.ListWorkflowsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workflows.v1beta.ListWorkflowsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listWorkflows.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listWorkflowsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workflows.v1beta.IWorkflow[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listWorkflows.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listWorkflows.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.IOperation[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.IOperation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + }); + + describe('Path templates', () => { + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('workflow', async () => { + const fakePath = '/rendered/path/workflow'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + workflow: 'workflowValue', + }; + const client = new workflowsModule.v1beta.WorkflowsClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.workflowPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.workflowPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('workflowPath', () => { + const result = client.workflowPath( + 'projectValue', + 'locationValue', + 'workflowValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.workflowPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromWorkflowName', () => { + const result = client.matchProjectFromWorkflowName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromWorkflowName', () => { + const result = client.matchLocationFromWorkflowName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchWorkflowFromWorkflowName', () => { + const result = client.matchWorkflowFromWorkflowName(fakePath); + assert.strictEqual(result, 'workflowValue'); + assert( + (client.pathTemplates.workflowPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-workflows/webpack.config.js b/packages/google-cloud-workflows/webpack.config.js index 62e0f8e811a6..7de187a074a9 100644 --- a/packages/google-cloud-workflows/webpack.config.js +++ b/packages/google-cloud-workflows/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2026 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. diff --git a/packages/google-cloud-workloadmanager/.eslintignore b/packages/google-cloud-workloadmanager/.eslintignore new file mode 100644 index 000000000000..cfc348ec4d11 --- /dev/null +++ b/packages/google-cloud-workloadmanager/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/packages/google-cloud-workloadmanager/.eslintrc.json b/packages/google-cloud-workloadmanager/.eslintrc.json new file mode 100644 index 000000000000..3e8d97ccb390 --- /dev/null +++ b/packages/google-cloud-workloadmanager/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "./node_modules/gts", + "root": true +} diff --git a/packages/google-cloud-workloadmanager/README.md b/packages/google-cloud-workloadmanager/README.md index 70ee43de4011..777272b05d41 100644 --- a/packages/google-cloud-workloadmanager/README.md +++ b/packages/google-cloud-workloadmanager/README.md @@ -103,7 +103,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workloadmanager/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). Please note that this `README.md` and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) @@ -113,7 +113,7 @@ are generated from a central template. Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workloadmanager/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project diff --git a/packages/google-cloud-workloadmanager/protos/protos.d.ts b/packages/google-cloud-workloadmanager/protos/protos.d.ts index fa299bc7bded..33d05a45330c 100644 --- a/packages/google-cloud-workloadmanager/protos/protos.d.ts +++ b/packages/google-cloud-workloadmanager/protos/protos.d.ts @@ -5021,6 +5021,9 @@ export namespace google { /** CommonLanguageSettings destinations */ destinations?: (google.api.ClientLibraryDestination[]|null); + + /** CommonLanguageSettings selectiveGapicGeneration */ + selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); } /** Represents a CommonLanguageSettings. */ @@ -5038,6 +5041,9 @@ export namespace google { /** CommonLanguageSettings destinations. */ public destinations: google.api.ClientLibraryDestination[]; + /** CommonLanguageSettings selectiveGapicGeneration. */ + public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @param [properties] Properties to set @@ -5738,6 +5744,9 @@ export namespace google { /** PythonSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures */ + experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); } /** Represents a PythonSettings. */ @@ -5752,6 +5761,9 @@ export namespace google { /** PythonSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** PythonSettings experimentalFeatures. */ + public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + /** * Creates a new PythonSettings instance using the specified properties. * @param [properties] Properties to set @@ -5830,6 +5842,118 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace PythonSettings { + + /** Properties of an ExperimentalFeatures. */ + interface IExperimentalFeatures { + + /** ExperimentalFeatures restAsyncIoEnabled */ + restAsyncIoEnabled?: (boolean|null); + + /** ExperimentalFeatures protobufPythonicTypesEnabled */ + protobufPythonicTypesEnabled?: (boolean|null); + + /** ExperimentalFeatures unversionedPackageDisabled */ + unversionedPackageDisabled?: (boolean|null); + } + + /** Represents an ExperimentalFeatures. */ + class ExperimentalFeatures implements IExperimentalFeatures { + + /** + * Constructs a new ExperimentalFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); + + /** ExperimentalFeatures restAsyncIoEnabled. */ + public restAsyncIoEnabled: boolean; + + /** ExperimentalFeatures protobufPythonicTypesEnabled. */ + public protobufPythonicTypesEnabled: boolean; + + /** ExperimentalFeatures unversionedPackageDisabled. */ + public unversionedPackageDisabled: boolean; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns ExperimentalFeatures instance + */ + public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Verifies an ExperimentalFeatures 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 an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExperimentalFeatures + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @param message ExperimentalFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExperimentalFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Properties of a NodeSettings. */ interface INodeSettings { @@ -6156,6 +6280,9 @@ export namespace google { /** GoSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); } /** Represents a GoSettings. */ @@ -6170,6 +6297,9 @@ export namespace google { /** GoSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** GoSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + /** * Creates a new GoSettings instance using the specified properties. * @param [properties] Properties to set @@ -6494,6 +6624,109 @@ export namespace google { PACKAGE_MANAGER = 20 } + /** Properties of a SelectiveGapicGeneration. */ + interface ISelectiveGapicGeneration { + + /** SelectiveGapicGeneration methods */ + methods?: (string[]|null); + + /** SelectiveGapicGeneration generateOmittedAsInternal */ + generateOmittedAsInternal?: (boolean|null); + } + + /** Represents a SelectiveGapicGeneration. */ + class SelectiveGapicGeneration implements ISelectiveGapicGeneration { + + /** + * Constructs a new SelectiveGapicGeneration. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ISelectiveGapicGeneration); + + /** SelectiveGapicGeneration methods. */ + public methods: string[]; + + /** SelectiveGapicGeneration generateOmittedAsInternal. */ + public generateOmittedAsInternal: boolean; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectiveGapicGeneration instance + */ + public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Verifies a SelectiveGapicGeneration 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 SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectiveGapicGeneration + */ + public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @param message SelectiveGapicGeneration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** LaunchStage enum. */ enum LaunchStage { LAUNCH_STAGE_UNSPECIFIED = 0, @@ -6875,6 +7108,7 @@ export namespace google { /** Edition enum. */ enum Edition { EDITION_UNKNOWN = 0, + EDITION_LEGACY = 900, EDITION_PROTO2 = 998, EDITION_PROTO3 = 999, EDITION_2023 = 1000, @@ -6905,6 +7139,9 @@ export namespace google { /** FileDescriptorProto weakDependency */ weakDependency?: (number[]|null); + /** FileDescriptorProto optionDependency */ + optionDependency?: (string[]|null); + /** FileDescriptorProto messageType */ messageType?: (google.protobuf.IDescriptorProto[]|null); @@ -6954,6 +7191,9 @@ export namespace google { /** FileDescriptorProto weakDependency. */ public weakDependency: number[]; + /** FileDescriptorProto optionDependency. */ + public optionDependency: string[]; + /** FileDescriptorProto messageType. */ public messageType: google.protobuf.IDescriptorProto[]; @@ -7088,6 +7328,9 @@ export namespace google { /** DescriptorProto reservedName */ reservedName?: (string[]|null); + + /** DescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents a DescriptorProto. */ @@ -7129,6 +7372,9 @@ export namespace google { /** DescriptorProto reservedName. */ public reservedName: string[]; + /** DescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new DescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -7976,6 +8222,9 @@ export namespace google { /** EnumDescriptorProto reservedName */ reservedName?: (string[]|null); + + /** EnumDescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents an EnumDescriptorProto. */ @@ -8002,6 +8251,9 @@ export namespace google { /** EnumDescriptorProto reservedName. */ public reservedName: string[]; + /** EnumDescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -8936,6 +9188,9 @@ export namespace google { /** FieldOptions features */ features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); @@ -8991,6 +9246,9 @@ export namespace google { /** FieldOptions features. */ public features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -9211,6 +9469,121 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a FeatureSupport. */ + interface IFeatureSupport { + + /** FeatureSupport editionIntroduced */ + editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport editionDeprecated */ + editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport deprecationWarning */ + deprecationWarning?: (string|null); + + /** FeatureSupport editionRemoved */ + editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSupport. */ + class FeatureSupport implements IFeatureSupport { + + /** + * Constructs a new FeatureSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); + + /** FeatureSupport editionIntroduced. */ + public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport editionDeprecated. */ + public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport deprecationWarning. */ + public deprecationWarning: string; + + /** FeatureSupport editionRemoved. */ + public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSupport instance + */ + public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Verifies a FeatureSupport 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 FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSupport + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @param message FeatureSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of an OneofOptions. */ @@ -9449,6 +9822,9 @@ export namespace google { /** EnumValueOptions debugRedact */ debugRedact?: (boolean|null); + /** EnumValueOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); } @@ -9471,6 +9847,9 @@ export namespace google { /** EnumValueOptions debugRedact. */ public debugRedact: boolean; + /** EnumValueOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -10063,6 +10442,12 @@ export namespace google { /** FeatureSet jsonFormat */ jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); + + /** FeatureSet enforceNamingStyle */ + enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); + + /** FeatureSet defaultSymbolVisibility */ + defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); } /** Represents a FeatureSet. */ @@ -10092,6 +10477,12 @@ export namespace google { /** FeatureSet jsonFormat. */ public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); + /** FeatureSet enforceNamingStyle. */ + public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); + + /** FeatureSet defaultSymbolVisibility. */ + public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); + /** * Creates a new FeatureSet instance using the specified properties. * @param [properties] Properties to set @@ -10214,6 +10605,116 @@ export namespace google { ALLOW = 1, LEGACY_BEST_EFFORT = 2 } + + /** EnforceNamingStyle enum. */ + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2 + } + + /** Properties of a VisibilityFeature. */ + interface IVisibilityFeature { + } + + /** Represents a VisibilityFeature. */ + class VisibilityFeature implements IVisibilityFeature { + + /** + * Constructs a new VisibilityFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns VisibilityFeature instance + */ + public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Verifies a VisibilityFeature 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 VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisibilityFeature + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @param message VisibilityFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisibilityFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisibilityFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VisibilityFeature { + + /** DefaultSymbolVisibility enum. */ + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + EXPORT_ALL = 1, + EXPORT_TOP_LEVEL = 2, + LOCAL_ALL = 3, + STRICT = 4 + } + } } /** Properties of a FeatureSetDefaults. */ @@ -10333,8 +10834,11 @@ export namespace google { /** FeatureSetEditionDefault edition */ edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - /** FeatureSetEditionDefault features */ - features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures */ + overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures */ + fixedFeatures?: (google.protobuf.IFeatureSet|null); } /** Represents a FeatureSetEditionDefault. */ @@ -10349,8 +10853,11 @@ export namespace google { /** FeatureSetEditionDefault edition. */ public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - /** FeatureSetEditionDefault features. */ - public features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures. */ + public overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures. */ + public fixedFeatures?: (google.protobuf.IFeatureSet|null); /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -10883,6 +11390,13 @@ export namespace google { } } + /** SymbolVisibility enum. */ + enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2 + } + /** Properties of a Duration. */ interface IDuration { diff --git a/packages/google-cloud-workloadmanager/protos/protos.js b/packages/google-cloud-workloadmanager/protos/protos.js index 9ad77deb81af..a16f28f95078 100644 --- a/packages/google-cloud-workloadmanager/protos/protos.js +++ b/packages/google-cloud-workloadmanager/protos/protos.js @@ -12825,6 +12825,7 @@ * @interface ICommonLanguageSettings * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri * @property {Array.|null} [destinations] CommonLanguageSettings destinations + * @property {google.api.ISelectiveGapicGeneration|null} [selectiveGapicGeneration] CommonLanguageSettings selectiveGapicGeneration */ /** @@ -12859,6 +12860,14 @@ */ CommonLanguageSettings.prototype.destinations = $util.emptyArray; + /** + * CommonLanguageSettings selectiveGapicGeneration. + * @member {google.api.ISelectiveGapicGeneration|null|undefined} selectiveGapicGeneration + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.selectiveGapicGeneration = null; + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @function create @@ -12891,6 +12900,8 @@ writer.int32(message.destinations[i]); writer.ldelim(); } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -12942,6 +12953,10 @@ message.destinations.push(reader.int32()); break; } + case 3: { + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -12993,6 +13008,11 @@ break; } } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { + var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration); + if (error) + return "selectiveGapicGeneration." + error; + } return null; }; @@ -13035,6 +13055,11 @@ break; } } + if (object.selectiveGapicGeneration != null) { + if (typeof object.selectiveGapicGeneration !== "object") + throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration); + } return message; }; @@ -13053,8 +13078,10 @@ var object = {}; if (options.arrays || options.defaults) object.destinations = []; - if (options.defaults) + if (options.defaults) { object.referenceDocsUri = ""; + object.selectiveGapicGeneration = null; + } if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) object.referenceDocsUri = message.referenceDocsUri; if (message.destinations && message.destinations.length) { @@ -13062,6 +13089,8 @@ for (var j = 0; j < message.destinations.length; ++j) object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) + object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options); return object; }; @@ -14884,6 +14913,7 @@ * @memberof google.api * @interface IPythonSettings * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common + * @property {google.api.PythonSettings.IExperimentalFeatures|null} [experimentalFeatures] PythonSettings experimentalFeatures */ /** @@ -14909,6 +14939,14 @@ */ PythonSettings.prototype.common = null; + /** + * PythonSettings experimentalFeatures. + * @member {google.api.PythonSettings.IExperimentalFeatures|null|undefined} experimentalFeatures + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.experimentalFeatures = null; + /** * Creates a new PythonSettings instance using the specified properties. * @function create @@ -14935,6 +14973,8 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -14975,6 +15015,10 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -15015,6 +15059,11 @@ if (error) return "common." + error; } + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { + var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures); + if (error) + return "experimentalFeatures." + error; + } return null; }; @@ -15035,6 +15084,11 @@ throw TypeError(".google.api.PythonSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.experimentalFeatures != null) { + if (typeof object.experimentalFeatures !== "object") + throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures); + } return message; }; @@ -15051,10 +15105,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.common = null; + object.experimentalFeatures = null; + } if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) + object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options); return object; }; @@ -15084,6 +15142,258 @@ return typeUrlPrefix + "/google.api.PythonSettings"; }; + PythonSettings.ExperimentalFeatures = (function() { + + /** + * Properties of an ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @interface IExperimentalFeatures + * @property {boolean|null} [restAsyncIoEnabled] ExperimentalFeatures restAsyncIoEnabled + * @property {boolean|null} [protobufPythonicTypesEnabled] ExperimentalFeatures protobufPythonicTypesEnabled + * @property {boolean|null} [unversionedPackageDisabled] ExperimentalFeatures unversionedPackageDisabled + */ + + /** + * Constructs a new ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @classdesc Represents an ExperimentalFeatures. + * @implements IExperimentalFeatures + * @constructor + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + */ + function ExperimentalFeatures(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]]; + } + + /** + * ExperimentalFeatures restAsyncIoEnabled. + * @member {boolean} restAsyncIoEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.restAsyncIoEnabled = false; + + /** + * ExperimentalFeatures protobufPythonicTypesEnabled. + * @member {boolean} protobufPythonicTypesEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.protobufPythonicTypesEnabled = false; + + /** + * ExperimentalFeatures unversionedPackageDisabled. + * @member {boolean} unversionedPackageDisabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.unversionedPackageDisabled = false; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures instance + */ + ExperimentalFeatures.create = function create(properties) { + return new ExperimentalFeatures(properties); + }; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.protobufPythonicTypesEnabled); + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unversionedPackageDisabled); + return writer; + }; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restAsyncIoEnabled = reader.bool(); + break; + } + case 2: { + message.protobufPythonicTypesEnabled = reader.bool(); + break; + } + case 3: { + message.unversionedPackageDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExperimentalFeatures message. + * @function verify + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExperimentalFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + if (typeof message.restAsyncIoEnabled !== "boolean") + return "restAsyncIoEnabled: boolean expected"; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + if (typeof message.protobufPythonicTypesEnabled !== "boolean") + return "protobufPythonicTypesEnabled: boolean expected"; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + if (typeof message.unversionedPackageDisabled !== "boolean") + return "unversionedPackageDisabled: boolean expected"; + return null; + }; + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + */ + ExperimentalFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) + return object; + var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + if (object.restAsyncIoEnabled != null) + message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); + if (object.protobufPythonicTypesEnabled != null) + message.protobufPythonicTypesEnabled = Boolean(object.protobufPythonicTypesEnabled); + if (object.unversionedPackageDisabled != null) + message.unversionedPackageDisabled = Boolean(object.unversionedPackageDisabled); + return message; + }; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.ExperimentalFeatures} message ExperimentalFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExperimentalFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.restAsyncIoEnabled = false; + object.protobufPythonicTypesEnabled = false; + object.unversionedPackageDisabled = false; + } + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + object.restAsyncIoEnabled = message.restAsyncIoEnabled; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + object.unversionedPackageDisabled = message.unversionedPackageDisabled; + return object; + }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @function toJSON + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + * @returns {Object.} JSON object + */ + ExperimentalFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExperimentalFeatures + * @function getTypeUrl + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExperimentalFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings.ExperimentalFeatures"; + }; + + return ExperimentalFeatures; + })(); + return PythonSettings; })(); @@ -15960,6 +16270,7 @@ * @memberof google.api * @interface IGoSettings * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common + * @property {Object.|null} [renamedServices] GoSettings renamedServices */ /** @@ -15971,6 +16282,7 @@ * @param {google.api.IGoSettings=} [properties] Properties to set */ function GoSettings(properties) { + this.renamedServices = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -15985,6 +16297,14 @@ */ GoSettings.prototype.common = null; + /** + * GoSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.renamedServices = $util.emptyObject; + /** * Creates a new GoSettings instance using the specified properties. * @function create @@ -16011,6 +16331,9 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); return writer; }; @@ -16041,7 +16364,7 @@ GoSettings.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) @@ -16051,6 +16374,29 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedServices[key] = value; + break; + } default: reader.skipType(tag & 7); break; @@ -16091,6 +16437,14 @@ if (error) return "common." + error; } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } return null; }; @@ -16111,6 +16465,13 @@ throw TypeError(".google.api.GoSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.GoSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } return message; }; @@ -16127,10 +16488,18 @@ if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) + object.renamedServices = {}; if (options.defaults) object.common = null; if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } return object; }; @@ -16769,30 +17138,275 @@ return values; })(); - /** - * LaunchStage enum. - * @name google.api.LaunchStage - * @enum {number} - * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value - * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value - * @property {number} PRELAUNCH=7 PRELAUNCH value - * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value - * @property {number} ALPHA=2 ALPHA value - * @property {number} BETA=3 BETA value - * @property {number} GA=4 GA value - * @property {number} DEPRECATED=5 DEPRECATED value - */ - api.LaunchStage = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; - values[valuesById[6] = "UNIMPLEMENTED"] = 6; - values[valuesById[7] = "PRELAUNCH"] = 7; - values[valuesById[1] = "EARLY_ACCESS"] = 1; - values[valuesById[2] = "ALPHA"] = 2; - values[valuesById[3] = "BETA"] = 3; - values[valuesById[4] = "GA"] = 4; - values[valuesById[5] = "DEPRECATED"] = 5; - return values; + api.SelectiveGapicGeneration = (function() { + + /** + * Properties of a SelectiveGapicGeneration. + * @memberof google.api + * @interface ISelectiveGapicGeneration + * @property {Array.|null} [methods] SelectiveGapicGeneration methods + * @property {boolean|null} [generateOmittedAsInternal] SelectiveGapicGeneration generateOmittedAsInternal + */ + + /** + * Constructs a new SelectiveGapicGeneration. + * @memberof google.api + * @classdesc Represents a SelectiveGapicGeneration. + * @implements ISelectiveGapicGeneration + * @constructor + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + */ + function SelectiveGapicGeneration(properties) { + this.methods = []; + 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]]; + } + + /** + * SelectiveGapicGeneration methods. + * @member {Array.} methods + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.methods = $util.emptyArray; + + /** + * SelectiveGapicGeneration generateOmittedAsInternal. + * @member {boolean} generateOmittedAsInternal + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.generateOmittedAsInternal = false; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @function create + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration instance + */ + SelectiveGapicGeneration.create = function create(properties) { + return new SelectiveGapicGeneration(properties); + }; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methods != null && message.methods.length) + for (var i = 0; i < message.methods.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.generateOmittedAsInternal); + return writer; + }; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @function decode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.methods && message.methods.length)) + message.methods = []; + message.methods.push(reader.string()); + break; + } + case 2: { + message.generateOmittedAsInternal = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectiveGapicGeneration message. + * @function verify + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectiveGapicGeneration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methods != null && message.hasOwnProperty("methods")) { + if (!Array.isArray(message.methods)) + return "methods: array expected"; + for (var i = 0; i < message.methods.length; ++i) + if (!$util.isString(message.methods[i])) + return "methods: string[] expected"; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + if (typeof message.generateOmittedAsInternal !== "boolean") + return "generateOmittedAsInternal: boolean expected"; + return null; + }; + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} object Plain object + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + */ + SelectiveGapicGeneration.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.SelectiveGapicGeneration) + return object; + var message = new $root.google.api.SelectiveGapicGeneration(); + if (object.methods) { + if (!Array.isArray(object.methods)) + throw TypeError(".google.api.SelectiveGapicGeneration.methods: array expected"); + message.methods = []; + for (var i = 0; i < object.methods.length; ++i) + message.methods[i] = String(object.methods[i]); + } + if (object.generateOmittedAsInternal != null) + message.generateOmittedAsInternal = Boolean(object.generateOmittedAsInternal); + return message; + }; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.SelectiveGapicGeneration} message SelectiveGapicGeneration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectiveGapicGeneration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.methods = []; + if (options.defaults) + object.generateOmittedAsInternal = false; + if (message.methods && message.methods.length) { + object.methods = []; + for (var j = 0; j < message.methods.length; ++j) + object.methods[j] = message.methods[j]; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + object.generateOmittedAsInternal = message.generateOmittedAsInternal; + return object; + }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @function toJSON + * @memberof google.api.SelectiveGapicGeneration + * @instance + * @returns {Object.} JSON object + */ + SelectiveGapicGeneration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @function getTypeUrl + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectiveGapicGeneration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.SelectiveGapicGeneration"; + }; + + return SelectiveGapicGeneration; + })(); + + /** + * LaunchStage enum. + * @name google.api.LaunchStage + * @enum {number} + * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value + * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value + * @property {number} PRELAUNCH=7 PRELAUNCH value + * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + */ + api.LaunchStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; + values[valuesById[6] = "UNIMPLEMENTED"] = 6; + values[valuesById[7] = "PRELAUNCH"] = 7; + values[valuesById[1] = "EARLY_ACCESS"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + return values; })(); /** @@ -17754,6 +18368,7 @@ * @name google.protobuf.Edition * @enum {number} * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_LEGACY=900 EDITION_LEGACY value * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value * @property {number} EDITION_2023=1000 EDITION_2023 value @@ -17768,6 +18383,7 @@ protobuf.Edition = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[900] = "EDITION_LEGACY"] = 900; values[valuesById[998] = "EDITION_PROTO2"] = 998; values[valuesById[999] = "EDITION_PROTO3"] = 999; values[valuesById[1000] = "EDITION_2023"] = 1000; @@ -17792,6 +18408,7 @@ * @property {Array.|null} [dependency] FileDescriptorProto dependency * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [optionDependency] FileDescriptorProto optionDependency * @property {Array.|null} [messageType] FileDescriptorProto messageType * @property {Array.|null} [enumType] FileDescriptorProto enumType * @property {Array.|null} [service] FileDescriptorProto service @@ -17814,6 +18431,7 @@ this.dependency = []; this.publicDependency = []; this.weakDependency = []; + this.optionDependency = []; this.messageType = []; this.enumType = []; this.service = []; @@ -17864,6 +18482,14 @@ */ FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + /** + * FileDescriptorProto optionDependency. + * @member {Array.} optionDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.optionDependency = $util.emptyArray; + /** * FileDescriptorProto messageType. * @member {Array.} messageType @@ -17985,6 +18611,9 @@ writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + if (message.optionDependency != null && message.optionDependency.length) + for (var i = 0; i < message.optionDependency.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.optionDependency[i]); return writer; }; @@ -18057,6 +18686,12 @@ message.weakDependency.push(reader.int32()); break; } + case 15: { + if (!(message.optionDependency && message.optionDependency.length)) + message.optionDependency = []; + message.optionDependency.push(reader.string()); + break; + } case 4: { if (!(message.messageType && message.messageType.length)) message.messageType = []; @@ -18159,6 +18794,13 @@ if (!$util.isInteger(message.weakDependency[i])) return "weakDependency: integer[] expected"; } + if (message.optionDependency != null && message.hasOwnProperty("optionDependency")) { + if (!Array.isArray(message.optionDependency)) + return "optionDependency: array expected"; + for (var i = 0; i < message.optionDependency.length; ++i) + if (!$util.isString(message.optionDependency[i])) + return "optionDependency: string[] expected"; + } if (message.messageType != null && message.hasOwnProperty("messageType")) { if (!Array.isArray(message.messageType)) return "messageType: array expected"; @@ -18213,6 +18855,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -18265,6 +18908,13 @@ for (var i = 0; i < object.weakDependency.length; ++i) message.weakDependency[i] = object.weakDependency[i] | 0; } + if (object.optionDependency) { + if (!Array.isArray(object.optionDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.optionDependency: array expected"); + message.optionDependency = []; + for (var i = 0; i < object.optionDependency.length; ++i) + message.optionDependency[i] = String(object.optionDependency[i]); + } if (object.messageType) { if (!Array.isArray(object.messageType)) throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); @@ -18328,6 +18978,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -18393,6 +19047,7 @@ object.extension = []; object.publicDependency = []; object.weakDependency = []; + object.optionDependency = []; } if (options.defaults) { object.name = ""; @@ -18449,6 +19104,11 @@ object.syntax = message.syntax; if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.optionDependency && message.optionDependency.length) { + object.optionDependency = []; + for (var j = 0; j < message.optionDependency.length; ++j) + object.optionDependency[j] = message.optionDependency[j]; + } return object; }; @@ -18497,6 +19157,7 @@ * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options * @property {Array.|null} [reservedRange] DescriptorProto reservedRange * @property {Array.|null} [reservedName] DescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] DescriptorProto visibility */ /** @@ -18602,6 +19263,14 @@ */ DescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * DescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.visibility = 0; + /** * Creates a new DescriptorProto instance using the specified properties. * @function create @@ -18654,6 +19323,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.visibility); return writer; }; @@ -18746,6 +19417,10 @@ message.reservedName.push(reader.string()); break; } + case 11: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -18859,6 +19534,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -18958,6 +19642,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -18987,6 +19691,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -19032,6 +19737,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -21076,6 +21783,7 @@ * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] EnumDescriptorProto visibility */ /** @@ -21136,6 +21844,14 @@ */ EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * EnumDescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.visibility = 0; + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @function create @@ -21173,6 +21889,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.visibility); return writer; }; @@ -21235,6 +21953,10 @@ message.reservedName.push(reader.string()); break; } + case 6: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -21303,6 +22025,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -21352,6 +22083,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -21376,6 +22127,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -21396,6 +22148,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -23714,6 +24468,7 @@ * @property {Array.|null} [targets] FieldOptions targets * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] FieldOptions featureSupport * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference @@ -23834,6 +24589,14 @@ */ FieldOptions.prototype.features = null; + /** + * FieldOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.featureSupport = null; + /** * FieldOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -23908,6 +24671,8 @@ $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); if (message.features != null && Object.hasOwnProperty.call(message, "features")) $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -24009,6 +24774,10 @@ message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } + case 22: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -24144,6 +24913,11 @@ if (error) return "features." + error; } + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -24332,6 +25106,11 @@ throw TypeError(".google.protobuf.FieldOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); } + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); @@ -24429,6 +25208,7 @@ object.debugRedact = false; object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; object.features = null; + object.featureSupport = null; object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) @@ -24461,6 +25241,8 @@ } if (message.features != null && message.hasOwnProperty("features")) object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -24733,6 +25515,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -24774,103 +25557,589 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; break; case "EDITION_PROTO3": case 999: - message.edition = 999; + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EditionDefault.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + return object; + }; + + /** + * Converts this EditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + * @returns {Object.} JSON object + */ + EditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + }; + + return EditionDefault; + })(); + + FieldOptions.FeatureSupport = (function() { + + /** + * Properties of a FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @interface IFeatureSupport + * @property {google.protobuf.Edition|null} [editionIntroduced] FeatureSupport editionIntroduced + * @property {google.protobuf.Edition|null} [editionDeprecated] FeatureSupport editionDeprecated + * @property {string|null} [deprecationWarning] FeatureSupport deprecationWarning + * @property {google.protobuf.Edition|null} [editionRemoved] FeatureSupport editionRemoved + */ + + /** + * Constructs a new FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents a FeatureSupport. + * @implements IFeatureSupport + * @constructor + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + */ + function FeatureSupport(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]]; + } + + /** + * FeatureSupport editionIntroduced. + * @member {google.protobuf.Edition} editionIntroduced + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionIntroduced = 0; + + /** + * FeatureSupport editionDeprecated. + * @member {google.protobuf.Edition} editionDeprecated + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionDeprecated = 0; + + /** + * FeatureSupport deprecationWarning. + * @member {string} deprecationWarning + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.deprecationWarning = ""; + + /** + * FeatureSupport editionRemoved. + * @member {google.protobuf.Edition} editionRemoved + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionRemoved = 0; + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport instance + */ + FeatureSupport.create = function create(properties) { + return new FeatureSupport(properties); + }; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editionDeprecated); + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.deprecationWarning); + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.editionRemoved); + return writer; + }; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.editionIntroduced = reader.int32(); + break; + } + case 2: { + message.editionDeprecated = reader.int32(); + break; + } + case 3: { + message.deprecationWarning = reader.string(); + break; + } + case 4: { + message.editionRemoved = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSupport message. + * @function verify + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSupport.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + switch (message.editionIntroduced) { + default: + return "editionIntroduced: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + switch (message.editionDeprecated) { + default: + return "editionDeprecated: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + if (!$util.isString(message.deprecationWarning)) + return "deprecationWarning: string expected"; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + switch (message.editionRemoved) { + default: + return "editionRemoved: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + */ + FeatureSupport.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) + return object; + var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + switch (object.editionIntroduced) { + default: + if (typeof object.editionIntroduced === "number") { + message.editionIntroduced = object.editionIntroduced; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionIntroduced = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionIntroduced = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionIntroduced = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionIntroduced = 999; + break; + case "EDITION_2023": + case 1000: + message.editionIntroduced = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionIntroduced = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionIntroduced = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionIntroduced = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionIntroduced = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionIntroduced = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionIntroduced = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionIntroduced = 2147483647; + break; + } + switch (object.editionDeprecated) { + default: + if (typeof object.editionDeprecated === "number") { + message.editionDeprecated = object.editionDeprecated; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionDeprecated = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionDeprecated = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionDeprecated = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionDeprecated = 999; + break; + case "EDITION_2023": + case 1000: + message.editionDeprecated = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionDeprecated = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionDeprecated = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionDeprecated = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionDeprecated = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionDeprecated = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionDeprecated = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionDeprecated = 2147483647; + break; + } + if (object.deprecationWarning != null) + message.deprecationWarning = String(object.deprecationWarning); + switch (object.editionRemoved) { + default: + if (typeof object.editionRemoved === "number") { + message.editionRemoved = object.editionRemoved; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionRemoved = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionRemoved = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionRemoved = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionRemoved = 999; break; case "EDITION_2023": case 1000: - message.edition = 1000; + message.editionRemoved = 1000; break; case "EDITION_2024": case 1001: - message.edition = 1001; + message.editionRemoved = 1001; break; case "EDITION_1_TEST_ONLY": case 1: - message.edition = 1; + message.editionRemoved = 1; break; case "EDITION_2_TEST_ONLY": case 2: - message.edition = 2; + message.editionRemoved = 2; break; case "EDITION_99997_TEST_ONLY": case 99997: - message.edition = 99997; + message.editionRemoved = 99997; break; case "EDITION_99998_TEST_ONLY": case 99998: - message.edition = 99998; + message.editionRemoved = 99998; break; case "EDITION_99999_TEST_ONLY": case 99999: - message.edition = 99999; + message.editionRemoved = 99999; break; case "EDITION_MAX": case 2147483647: - message.edition = 2147483647; + message.editionRemoved = 2147483647; break; } - if (object.value != null) - message.value = String(object.value); return message; }; /** - * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {google.protobuf.FieldOptions.FeatureSupport} message FeatureSupport * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EditionDefault.toObject = function toObject(message, options) { + FeatureSupport.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.value = ""; - object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; - } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionDeprecated = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.deprecationWarning = ""; + object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + object.deprecationWarning = message.deprecationWarning; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; return object; }; /** - * Converts this EditionDefault to JSON. + * Converts this FeatureSupport to JSON. * @function toJSON - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @instance * @returns {Object.} JSON object */ - EditionDefault.prototype.toJSON = function toJSON() { + FeatureSupport.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for EditionDefault + * Gets the default type url for FeatureSupport * @function getTypeUrl - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FeatureSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + return typeUrlPrefix + "/google.protobuf.FieldOptions.FeatureSupport"; }; - return EditionDefault; + return FeatureSupport; })(); return FieldOptions; @@ -25465,6 +26734,7 @@ * @property {boolean|null} [deprecated] EnumValueOptions deprecated * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] EnumValueOptions featureSupport * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption */ @@ -25508,6 +26778,14 @@ */ EnumValueOptions.prototype.debugRedact = false; + /** + * EnumValueOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.featureSupport = null; + /** * EnumValueOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -25546,6 +26824,8 @@ $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -25597,6 +26877,10 @@ message.debugRedact = reader.bool(); break; } + case 4: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -25649,6 +26933,11 @@ if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) if (typeof message.debugRedact !== "boolean") return "debugRedact: boolean expected"; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -25682,6 +26971,11 @@ } if (object.debugRedact != null) message.debugRedact = Boolean(object.debugRedact); + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); @@ -25714,6 +27008,7 @@ object.deprecated = false; object.features = null; object.debugRedact = false; + object.featureSupport = null; } if (message.deprecated != null && message.hasOwnProperty("deprecated")) object.deprecated = message.deprecated; @@ -25721,6 +27016,8 @@ object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) object.debugRedact = message.debugRedact; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -27188,6 +28485,8 @@ * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + * @property {google.protobuf.FeatureSet.EnforceNamingStyle|null} [enforceNamingStyle] FeatureSet enforceNamingStyle + * @property {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null} [defaultSymbolVisibility] FeatureSet defaultSymbolVisibility */ /** @@ -27253,6 +28552,22 @@ */ FeatureSet.prototype.jsonFormat = 0; + /** + * FeatureSet enforceNamingStyle. + * @member {google.protobuf.FeatureSet.EnforceNamingStyle} enforceNamingStyle + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enforceNamingStyle = 0; + + /** + * FeatureSet defaultSymbolVisibility. + * @member {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility} defaultSymbolVisibility + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.defaultSymbolVisibility = 0; + /** * Creates a new FeatureSet instance using the specified properties. * @function create @@ -27289,6 +28604,10 @@ writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enforceNamingStyle); + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.defaultSymbolVisibility); return writer; }; @@ -27349,6 +28668,14 @@ message.jsonFormat = reader.int32(); break; } + case 7: { + message.enforceNamingStyle = reader.int32(); + break; + } + case 8: { + message.defaultSymbolVisibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -27439,6 +28766,26 @@ case 2: break; } + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + switch (message.enforceNamingStyle) { + default: + return "enforceNamingStyle: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + switch (message.defaultSymbolVisibility) { + default: + return "defaultSymbolVisibility: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } return null; }; @@ -27578,6 +28925,54 @@ message.jsonFormat = 2; break; } + switch (object.enforceNamingStyle) { + default: + if (typeof object.enforceNamingStyle === "number") { + message.enforceNamingStyle = object.enforceNamingStyle; + break; + } + break; + case "ENFORCE_NAMING_STYLE_UNKNOWN": + case 0: + message.enforceNamingStyle = 0; + break; + case "STYLE2024": + case 1: + message.enforceNamingStyle = 1; + break; + case "STYLE_LEGACY": + case 2: + message.enforceNamingStyle = 2; + break; + } + switch (object.defaultSymbolVisibility) { + default: + if (typeof object.defaultSymbolVisibility === "number") { + message.defaultSymbolVisibility = object.defaultSymbolVisibility; + break; + } + break; + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + case 0: + message.defaultSymbolVisibility = 0; + break; + case "EXPORT_ALL": + case 1: + message.defaultSymbolVisibility = 1; + break; + case "EXPORT_TOP_LEVEL": + case 2: + message.defaultSymbolVisibility = 2; + break; + case "LOCAL_ALL": + case 3: + message.defaultSymbolVisibility = 3; + break; + case "STRICT": + case 4: + message.defaultSymbolVisibility = 4; + break; + } return message; }; @@ -27601,6 +28996,8 @@ object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; + object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; } if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; @@ -27614,6 +29011,10 @@ object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; return object; }; @@ -27741,6 +29142,219 @@ return values; })(); + /** + * EnforceNamingStyle enum. + * @name google.protobuf.FeatureSet.EnforceNamingStyle + * @enum {number} + * @property {number} ENFORCE_NAMING_STYLE_UNKNOWN=0 ENFORCE_NAMING_STYLE_UNKNOWN value + * @property {number} STYLE2024=1 STYLE2024 value + * @property {number} STYLE_LEGACY=2 STYLE_LEGACY value + */ + FeatureSet.EnforceNamingStyle = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENFORCE_NAMING_STYLE_UNKNOWN"] = 0; + values[valuesById[1] = "STYLE2024"] = 1; + values[valuesById[2] = "STYLE_LEGACY"] = 2; + return values; + })(); + + FeatureSet.VisibilityFeature = (function() { + + /** + * Properties of a VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @interface IVisibilityFeature + */ + + /** + * Constructs a new VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @classdesc Represents a VisibilityFeature. + * @implements IVisibilityFeature + * @constructor + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + */ + function VisibilityFeature(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]]; + } + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature instance + */ + VisibilityFeature.create = function create(properties) { + return new VisibilityFeature(properties); + }; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisibilityFeature message. + * @function verify + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisibilityFeature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + */ + VisibilityFeature.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) + return object; + return new $root.google.protobuf.FeatureSet.VisibilityFeature(); + }; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.VisibilityFeature} message VisibilityFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisibilityFeature.toObject = function toObject() { + return {}; + }; + + /** + * Converts this VisibilityFeature to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @instance + * @returns {Object.} JSON object + */ + VisibilityFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VisibilityFeature + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisibilityFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet.VisibilityFeature"; + }; + + /** + * DefaultSymbolVisibility enum. + * @name google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + * @enum {number} + * @property {number} DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN value + * @property {number} EXPORT_ALL=1 EXPORT_ALL value + * @property {number} EXPORT_TOP_LEVEL=2 EXPORT_TOP_LEVEL value + * @property {number} LOCAL_ALL=3 LOCAL_ALL value + * @property {number} STRICT=4 STRICT value + */ + VisibilityFeature.DefaultSymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0; + values[valuesById[1] = "EXPORT_ALL"] = 1; + values[valuesById[2] = "EXPORT_TOP_LEVEL"] = 2; + values[valuesById[3] = "LOCAL_ALL"] = 3; + values[valuesById[4] = "STRICT"] = 4; + return values; + })(); + + return VisibilityFeature; + })(); + return FeatureSet; })(); @@ -27925,6 +29539,7 @@ default: return "minimumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -27942,6 +29557,7 @@ default: return "maximumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -27990,6 +29606,10 @@ case 0: message.minimumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.minimumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.minimumEdition = 998; @@ -28042,6 +29662,10 @@ case 0: message.maximumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.maximumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.maximumEdition = 998; @@ -28150,7 +29774,8 @@ * @memberof google.protobuf.FeatureSetDefaults * @interface IFeatureSetEditionDefault * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition - * @property {google.protobuf.IFeatureSet|null} [features] FeatureSetEditionDefault features + * @property {google.protobuf.IFeatureSet|null} [overridableFeatures] FeatureSetEditionDefault overridableFeatures + * @property {google.protobuf.IFeatureSet|null} [fixedFeatures] FeatureSetEditionDefault fixedFeatures */ /** @@ -28177,12 +29802,20 @@ FeatureSetEditionDefault.prototype.edition = 0; /** - * FeatureSetEditionDefault features. - * @member {google.protobuf.IFeatureSet|null|undefined} features + * FeatureSetEditionDefault overridableFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} overridableFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.overridableFeatures = null; + + /** + * FeatureSetEditionDefault fixedFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} fixedFeatures * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @instance */ - FeatureSetEditionDefault.prototype.features = null; + FeatureSetEditionDefault.prototype.fixedFeatures = null; /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -28208,10 +29841,12 @@ FeatureSetEditionDefault.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -28252,8 +29887,12 @@ message.edition = reader.int32(); break; } - case 2: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + case 4: { + message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 5: { + message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } default: @@ -28296,6 +29935,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -28308,10 +29948,15 @@ case 2147483647: break; } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures); + if (error) + return "overridableFeatures." + error; + } + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures); if (error) - return "features." + error; + return "fixedFeatures." + error; } return null; }; @@ -28339,6 +29984,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -28380,10 +30029,15 @@ message.edition = 2147483647; break; } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + if (object.overridableFeatures != null) { + if (typeof object.overridableFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); + message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures); + } + if (object.fixedFeatures != null) { + if (typeof object.fixedFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); + message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures); } return message; }; @@ -28402,13 +30056,16 @@ options = {}; var object = {}; if (options.defaults) { - object.features = null; object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.overridableFeatures = null; + object.fixedFeatures = null; } - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) + object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options); + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) + object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options); return object; }; @@ -29623,6 +31280,22 @@ return GeneratedCodeInfo; })(); + /** + * SymbolVisibility enum. + * @name google.protobuf.SymbolVisibility + * @enum {number} + * @property {number} VISIBILITY_UNSET=0 VISIBILITY_UNSET value + * @property {number} VISIBILITY_LOCAL=1 VISIBILITY_LOCAL value + * @property {number} VISIBILITY_EXPORT=2 VISIBILITY_EXPORT value + */ + protobuf.SymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VISIBILITY_UNSET"] = 0; + values[valuesById[1] = "VISIBILITY_LOCAL"] = 1; + values[valuesById[2] = "VISIBILITY_EXPORT"] = 2; + return values; + })(); + protobuf.Duration = (function() { /** diff --git a/packages/google-cloud-workloadmanager/protos/protos.json b/packages/google-cloud-workloadmanager/protos/protos.json index b823af83f300..50744a39363a 100644 --- a/packages/google-cloud-workloadmanager/protos/protos.json +++ b/packages/google-cloud-workloadmanager/protos/protos.json @@ -1376,8 +1376,7 @@ "java_multiple_files": true, "java_outer_classname": "ResourceProto", "java_package": "com.google.api", - "objc_class_prefix": "GAPI", - "cc_enable_arenas": true + "objc_class_prefix": "GAPI" }, "nested": { "http": { @@ -1501,6 +1500,10 @@ "rule": "repeated", "type": "ClientLibraryDestination", "id": 2 + }, + "selectiveGapicGeneration": { + "type": "SelectiveGapicGeneration", + "id": 3 } } }, @@ -1641,6 +1644,28 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "experimentalFeatures": { + "type": "ExperimentalFeatures", + "id": 2 + } + }, + "nested": { + "ExperimentalFeatures": { + "fields": { + "restAsyncIoEnabled": { + "type": "bool", + "id": 1 + }, + "protobufPythonicTypesEnabled": { + "type": "bool", + "id": 2 + }, + "unversionedPackageDisabled": { + "type": "bool", + "id": 3 + } + } } } }, @@ -1698,6 +1723,11 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 } } }, @@ -1759,6 +1789,19 @@ "PACKAGE_MANAGER": 20 } }, + "SelectiveGapicGeneration": { + "fields": { + "methods": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "generateOmittedAsInternal": { + "type": "bool", + "id": 2 + } + } + }, "LaunchStage": { "values": { "LAUNCH_STAGE_UNSPECIFIED": 0, @@ -1891,12 +1934,19 @@ "type": "FileDescriptorProto", "id": 1 } - } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ] }, "Edition": { "edition": "proto2", "values": { "EDITION_UNKNOWN": 0, + "EDITION_LEGACY": 900, "EDITION_PROTO2": 998, "EDITION_PROTO3": 999, "EDITION_2023": 1000, @@ -1935,6 +1985,11 @@ "type": "int32", "id": 11 }, + "optionDependency": { + "rule": "repeated", + "type": "string", + "id": 15 + }, "messageType": { "rule": "repeated", "type": "DescriptorProto", @@ -2023,6 +2078,10 @@ "rule": "repeated", "type": "string", "id": 10 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 11 } }, "nested": { @@ -2248,6 +2307,10 @@ "rule": "repeated", "type": "string", "id": 5 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 6 } }, "nested": { @@ -2298,7 +2361,14 @@ "type": "ServiceOptions", "id": 3 } - } + }, + "reserved": [ + [ + 4, + 4 + ], + "stream" + ] }, "MethodDescriptorProto": { "edition": "proto2", @@ -2462,6 +2532,7 @@ 42, 42 ], + "php_generic_services", [ 38, 38 @@ -2597,7 +2668,8 @@ "type": "bool", "id": 10, "options": { - "default": false + "default": false, + "deprecated": true } }, "debugRedact": { @@ -2625,6 +2697,10 @@ "type": "FeatureSet", "id": 21 }, + "featureSupport": { + "type": "FeatureSupport", + "id": 22 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -2694,6 +2770,26 @@ "id": 2 } } + }, + "FeatureSupport": { + "fields": { + "editionIntroduced": { + "type": "Edition", + "id": 1 + }, + "editionDeprecated": { + "type": "Edition", + "id": 2 + }, + "deprecationWarning": { + "type": "string", + "id": 3 + }, + "editionRemoved": { + "type": "Edition", + "id": 4 + } + } } } }, @@ -2782,6 +2878,10 @@ "default": false } }, + "featureSupport": { + "type": "FieldOptions.FeatureSupport", + "id": 4 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -2924,6 +3024,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_2023", "edition_defaults.value": "EXPLICIT" } @@ -2934,6 +3035,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "OPEN" } @@ -2944,6 +3046,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "PACKED" } @@ -2954,6 +3057,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "VERIFY" } @@ -2964,7 +3068,8 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "EDITION_PROTO2", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_LEGACY", "edition_defaults.value": "LENGTH_PREFIXED" } }, @@ -2974,27 +3079,38 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "ALLOW" } + }, + "enforceNamingStyle": { + "type": "EnforceNamingStyle", + "id": 7, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_METHOD", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "STYLE2024" + } + }, + "defaultSymbolVisibility": { + "type": "VisibilityFeature.DefaultSymbolVisibility", + "id": 8, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "EXPORT_TOP_LEVEL" + } } }, "extensions": [ [ 1000, - 1000 - ], - [ - 1001, - 1001 - ], - [ - 1002, - 1002 - ], - [ - 9990, - 9990 + 9994 ], [ 9995, @@ -3039,7 +3155,13 @@ "UTF8_VALIDATION_UNKNOWN": 0, "VERIFY": 2, "NONE": 3 - } + }, + "reserved": [ + [ + 1, + 1 + ] + ] }, "MessageEncoding": { "values": { @@ -3054,6 +3176,33 @@ "ALLOW": 1, "LEGACY_BEST_EFFORT": 2 } + }, + "EnforceNamingStyle": { + "values": { + "ENFORCE_NAMING_STYLE_UNKNOWN": 0, + "STYLE2024": 1, + "STYLE_LEGACY": 2 + } + }, + "VisibilityFeature": { + "fields": {}, + "reserved": [ + [ + 1, + 536870911 + ] + ], + "nested": { + "DefaultSymbolVisibility": { + "values": { + "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, + "EXPORT_ALL": 1, + "EXPORT_TOP_LEVEL": 2, + "LOCAL_ALL": 3, + "STRICT": 4 + } + } + } } } }, @@ -3081,11 +3230,26 @@ "type": "Edition", "id": 3 }, - "features": { + "overridableFeatures": { "type": "FeatureSet", - "id": 2 + "id": 4 + }, + "fixedFeatures": { + "type": "FeatureSet", + "id": 5 } - } + }, + "reserved": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + "features" + ] } } }, @@ -3098,6 +3262,12 @@ "id": 1 } }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ], "nested": { "Location": { "fields": { @@ -3183,6 +3353,14 @@ } } }, + "SymbolVisibility": { + "edition": "proto2", + "values": { + "VISIBILITY_UNSET": 0, + "VISIBILITY_LOCAL": 1, + "VISIBILITY_EXPORT": 2 + } + }, "Duration": { "fields": { "seconds": { @@ -3241,6 +3419,7 @@ "java_multiple_files": true, "java_outer_classname": "OperationsProto", "java_package": "com.google.longrunning", + "objc_class_prefix": "GLRUN", "php_namespace": "Google\\LongRunning" }, "nested": { diff --git a/packages/google-cloud-workloadmanager/src/v1/index.ts b/packages/google-cloud-workloadmanager/src/v1/index.ts index df88fe1c7889..7dac30e59fe1 100644 --- a/packages/google-cloud-workloadmanager/src/v1/index.ts +++ b/packages/google-cloud-workloadmanager/src/v1/index.ts @@ -16,4 +16,4 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {WorkloadManagerClient} from './workload_manager_client'; +export { WorkloadManagerClient } from './workload_manager_client'; diff --git a/packages/google-cloud-workloadmanager/src/v1/workload_manager_client.ts b/packages/google-cloud-workloadmanager/src/v1/workload_manager_client.ts index 10dda032f1cb..5d5486740deb 100644 --- a/packages/google-cloud-workloadmanager/src/v1/workload_manager_client.ts +++ b/packages/google-cloud-workloadmanager/src/v1/workload_manager_client.ts @@ -18,11 +18,22 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -45,7 +56,7 @@ export class WorkloadManagerClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('workloadmanager'); @@ -58,11 +69,11 @@ export class WorkloadManagerClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - workloadManagerStub?: Promise<{[name: string]: Function}>; + workloadManagerStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of WorkloadManagerClient. @@ -103,21 +114,42 @@ export class WorkloadManagerClient { * const client = new WorkloadManagerClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof WorkloadManagerClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'workloadmanager.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -142,7 +174,7 @@ export class WorkloadManagerClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -156,15 +188,11 @@ export class WorkloadManagerClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -186,22 +214,22 @@ export class WorkloadManagerClient { // Create useful helper objects for these. this.pathTemplates = { cryptoKeyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}' + 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}', ), evaluationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/evaluations/{evaluation}' + 'projects/{project}/locations/{location}/evaluations/{evaluation}', ), executionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/evaluations/{evaluation}/executions/{execution}' + 'projects/{project}/locations/{location}/evaluations/{evaluation}/executions/{execution}', ), locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' + 'projects/{project}/locations/{location}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), rulePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/rules/{rule}' + 'projects/{project}/locations/{location}/rules/{rule}', ), }; @@ -209,14 +237,26 @@ export class WorkloadManagerClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listEvaluations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'evaluations'), - listExecutions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executions'), - listExecutionResults: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'executionResults'), - listScannedResources: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'scannedResources') + listEvaluations: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'evaluations', + ), + listExecutions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'executions', + ), + listExecutionResults: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'executionResults', + ), + listScannedResources: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'scannedResources', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -225,61 +265,107 @@ export class WorkloadManagerClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + lroOptions.httpRules = [ + { + selector: 'google.cloud.location.Locations.GetLocation', + get: '/v1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v1/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + selector: 'google.longrunning.Operations.DeleteOperation', + delete: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v1/{name=projects/*/locations/*/operations/*}', + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v1/{name=projects/*/locations/*}/operations', + }, + ]; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createEvaluationResponse = protoFilesRoot.lookup( - '.google.cloud.workloadmanager.v1.Evaluation') as gax.protobuf.Type; + '.google.cloud.workloadmanager.v1.Evaluation', + ) as gax.protobuf.Type; const createEvaluationMetadata = protoFilesRoot.lookup( - '.google.cloud.workloadmanager.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.workloadmanager.v1.OperationMetadata', + ) as gax.protobuf.Type; const updateEvaluationResponse = protoFilesRoot.lookup( - '.google.cloud.workloadmanager.v1.Evaluation') as gax.protobuf.Type; + '.google.cloud.workloadmanager.v1.Evaluation', + ) as gax.protobuf.Type; const updateEvaluationMetadata = protoFilesRoot.lookup( - '.google.cloud.workloadmanager.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.workloadmanager.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteEvaluationResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteEvaluationMetadata = protoFilesRoot.lookup( - '.google.cloud.workloadmanager.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.workloadmanager.v1.OperationMetadata', + ) as gax.protobuf.Type; const runEvaluationResponse = protoFilesRoot.lookup( - '.google.cloud.workloadmanager.v1.Execution') as gax.protobuf.Type; + '.google.cloud.workloadmanager.v1.Execution', + ) as gax.protobuf.Type; const runEvaluationMetadata = protoFilesRoot.lookup( - '.google.cloud.workloadmanager.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.workloadmanager.v1.OperationMetadata', + ) as gax.protobuf.Type; const deleteExecutionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; + '.google.protobuf.Empty', + ) as gax.protobuf.Type; const deleteExecutionMetadata = protoFilesRoot.lookup( - '.google.cloud.workloadmanager.v1.OperationMetadata') as gax.protobuf.Type; + '.google.cloud.workloadmanager.v1.OperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createEvaluation: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createEvaluationResponse.decode.bind(createEvaluationResponse), - createEvaluationMetadata.decode.bind(createEvaluationMetadata)), + createEvaluationMetadata.decode.bind(createEvaluationMetadata), + ), updateEvaluation: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateEvaluationResponse.decode.bind(updateEvaluationResponse), - updateEvaluationMetadata.decode.bind(updateEvaluationMetadata)), + updateEvaluationMetadata.decode.bind(updateEvaluationMetadata), + ), deleteEvaluation: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteEvaluationResponse.decode.bind(deleteEvaluationResponse), - deleteEvaluationMetadata.decode.bind(deleteEvaluationMetadata)), + deleteEvaluationMetadata.decode.bind(deleteEvaluationMetadata), + ), runEvaluation: new this._gaxModule.LongrunningDescriptor( this.operationsClient, runEvaluationResponse.decode.bind(runEvaluationResponse), - runEvaluationMetadata.decode.bind(runEvaluationMetadata)), + runEvaluationMetadata.decode.bind(runEvaluationMetadata), + ), deleteExecution: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteExecutionResponse.decode.bind(deleteExecutionResponse), - deleteExecutionMetadata.decode.bind(deleteExecutionMetadata)) + deleteExecutionMetadata.decode.bind(deleteExecutionMetadata), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.workloadmanager.v1.WorkloadManager', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.workloadmanager.v1.WorkloadManager', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -310,28 +396,46 @@ export class WorkloadManagerClient { // Put together the "service stub" for // google.cloud.workloadmanager.v1.WorkloadManager. this.workloadManagerStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.workloadmanager.v1.WorkloadManager') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.workloadmanager.v1.WorkloadManager', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.workloadmanager.v1.WorkloadManager, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const workloadManagerStubMethods = - ['listEvaluations', 'getEvaluation', 'createEvaluation', 'updateEvaluation', 'deleteEvaluation', 'listExecutions', 'getExecution', 'runEvaluation', 'deleteExecution', 'listExecutionResults', 'listRules', 'listScannedResources']; + const workloadManagerStubMethods = [ + 'listEvaluations', + 'getEvaluation', + 'createEvaluation', + 'updateEvaluation', + 'deleteEvaluation', + 'listExecutions', + 'getExecution', + 'runEvaluation', + 'deleteExecution', + 'listExecutionResults', + 'listRules', + 'listScannedResources', + ]; for (const methodName of workloadManagerStubMethods) { const callPromise = this.workloadManagerStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); const descriptor = this.descriptors.page[methodName] || @@ -341,7 +445,7 @@ export class WorkloadManagerClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -356,8 +460,14 @@ export class WorkloadManagerClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'workloadmanager.googleapis.com'; } @@ -368,8 +478,14 @@ export class WorkloadManagerClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'workloadmanager.googleapis.com'; } @@ -400,9 +516,7 @@ export class WorkloadManagerClient { * @returns {string[]} List of default scopes. */ static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; + return ['https://www.googleapis.com/auth/cloud-platform']; } getProjectId(): Promise; @@ -411,8 +525,9 @@ export class WorkloadManagerClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -423,1013 +538,1474 @@ export class WorkloadManagerClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Gets details of a single Evaluation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @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 protos.google.cloud.workloadmanager.v1.Evaluation|Evaluation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.get_evaluation.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_GetEvaluation_async - */ + /** + * Gets details of a single Evaluation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @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 protos.google.cloud.workloadmanager.v1.Evaluation|Evaluation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.get_evaluation.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_GetEvaluation_async + */ getEvaluation( - request?: protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workloadmanager.v1.IEvaluation, - protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest | undefined, + {} | undefined, + ] + >; getEvaluation( - request: protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workloadmanager.v1.IEvaluation, - protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workloadmanager.v1.IEvaluation, + | protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getEvaluation( - request: protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest, - callback: Callback< - protos.google.cloud.workloadmanager.v1.IEvaluation, - protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest, + callback: Callback< + protos.google.cloud.workloadmanager.v1.IEvaluation, + | protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getEvaluation( - request?: protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workloadmanager.v1.IEvaluation, - protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workloadmanager.v1.IEvaluation, - protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workloadmanager.v1.IEvaluation, - protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workloadmanager.v1.IEvaluation, + | protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getEvaluation request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.workloadmanager.v1.IEvaluation, - protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.workloadmanager.v1.IEvaluation, + | protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getEvaluation response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getEvaluation(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.workloadmanager.v1.IEvaluation, - protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest|undefined, - {}|undefined - ]) => { - this._log.info('getEvaluation response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getEvaluation(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.workloadmanager.v1.IEvaluation, + ( + | protos.google.cloud.workloadmanager.v1.IGetEvaluationRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getEvaluation response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Gets details of a single Execution. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @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 protos.google.cloud.workloadmanager.v1.Execution|Execution}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.get_execution.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_GetExecution_async - */ + /** + * Gets details of a single Execution. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @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 protos.google.cloud.workloadmanager.v1.Execution|Execution}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.get_execution.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_GetExecution_async + */ getExecution( - request?: protos.google.cloud.workloadmanager.v1.IGetExecutionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workloadmanager.v1.IExecution, - protos.google.cloud.workloadmanager.v1.IGetExecutionRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workloadmanager.v1.IGetExecutionRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workloadmanager.v1.IExecution, + protos.google.cloud.workloadmanager.v1.IGetExecutionRequest | undefined, + {} | undefined, + ] + >; getExecution( - request: protos.google.cloud.workloadmanager.v1.IGetExecutionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workloadmanager.v1.IExecution, - protos.google.cloud.workloadmanager.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.IGetExecutionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workloadmanager.v1.IExecution, + | protos.google.cloud.workloadmanager.v1.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getExecution( - request: protos.google.cloud.workloadmanager.v1.IGetExecutionRequest, - callback: Callback< - protos.google.cloud.workloadmanager.v1.IExecution, - protos.google.cloud.workloadmanager.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.IGetExecutionRequest, + callback: Callback< + protos.google.cloud.workloadmanager.v1.IExecution, + | protos.google.cloud.workloadmanager.v1.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getExecution( - request?: protos.google.cloud.workloadmanager.v1.IGetExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workloadmanager.v1.IExecution, - protos.google.cloud.workloadmanager.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.workloadmanager.v1.IGetExecutionRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workloadmanager.v1.IExecution, - protos.google.cloud.workloadmanager.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workloadmanager.v1.IExecution, - protos.google.cloud.workloadmanager.v1.IGetExecutionRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workloadmanager.v1.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workloadmanager.v1.IExecution, + | protos.google.cloud.workloadmanager.v1.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.workloadmanager.v1.IExecution, + protos.google.cloud.workloadmanager.v1.IGetExecutionRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getExecution request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.workloadmanager.v1.IExecution, - protos.google.cloud.workloadmanager.v1.IGetExecutionRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.workloadmanager.v1.IExecution, + | protos.google.cloud.workloadmanager.v1.IGetExecutionRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getExecution response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getExecution(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.workloadmanager.v1.IExecution, - protos.google.cloud.workloadmanager.v1.IGetExecutionRequest|undefined, - {}|undefined - ]) => { - this._log.info('getExecution response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getExecution(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.workloadmanager.v1.IExecution, + ( + | protos.google.cloud.workloadmanager.v1.IGetExecutionRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getExecution response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists rules in a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The [project] on which to execute the request. The format is: - * projects/{project_id}/locations/{location} - * Currently, the pre-defined rules are global available to all projects and - * all regions. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filter based on primary_category, secondary_category. - * @param {string} request.customRulesBucket - * The Cloud Storage bucket name for custom rules. - * @param {google.cloud.workloadmanager.v1.Evaluation.EvaluationType} [request.evaluationType] - * Optional. The evaluation type of the rules will be applied to. - * The Cloud Storage bucket name for custom rules. - * @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 protos.google.cloud.workloadmanager.v1.ListRulesResponse|ListRulesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.list_rules.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_ListRules_async - */ + /** + * Lists rules in a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The [project] on which to execute the request. The format is: + * projects/{project_id}/locations/{location} + * Currently, the pre-defined rules are global available to all projects and + * all regions. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filter based on primary_category, secondary_category. + * @param {string} request.customRulesBucket + * The Cloud Storage bucket name for custom rules. + * @param {google.cloud.workloadmanager.v1.Evaluation.EvaluationType} [request.evaluationType] + * Optional. The evaluation type of the rules will be applied to. + * The Cloud Storage bucket name for custom rules. + * @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 protos.google.cloud.workloadmanager.v1.ListRulesResponse|ListRulesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.list_rules.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_ListRules_async + */ listRules( - request?: protos.google.cloud.workloadmanager.v1.IListRulesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workloadmanager.v1.IListRulesResponse, - protos.google.cloud.workloadmanager.v1.IListRulesRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workloadmanager.v1.IListRulesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workloadmanager.v1.IListRulesResponse, + protos.google.cloud.workloadmanager.v1.IListRulesRequest | undefined, + {} | undefined, + ] + >; listRules( - request: protos.google.cloud.workloadmanager.v1.IListRulesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.workloadmanager.v1.IListRulesResponse, - protos.google.cloud.workloadmanager.v1.IListRulesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.IListRulesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.workloadmanager.v1.IListRulesResponse, + | protos.google.cloud.workloadmanager.v1.IListRulesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listRules( - request: protos.google.cloud.workloadmanager.v1.IListRulesRequest, - callback: Callback< - protos.google.cloud.workloadmanager.v1.IListRulesResponse, - protos.google.cloud.workloadmanager.v1.IListRulesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.IListRulesRequest, + callback: Callback< + protos.google.cloud.workloadmanager.v1.IListRulesResponse, + | protos.google.cloud.workloadmanager.v1.IListRulesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listRules( - request?: protos.google.cloud.workloadmanager.v1.IListRulesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.workloadmanager.v1.IListRulesResponse, - protos.google.cloud.workloadmanager.v1.IListRulesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.workloadmanager.v1.IListRulesRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.workloadmanager.v1.IListRulesResponse, - protos.google.cloud.workloadmanager.v1.IListRulesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.workloadmanager.v1.IListRulesResponse, - protos.google.cloud.workloadmanager.v1.IListRulesRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.workloadmanager.v1.IListRulesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.workloadmanager.v1.IListRulesResponse, + | protos.google.cloud.workloadmanager.v1.IListRulesRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.workloadmanager.v1.IListRulesResponse, + protos.google.cloud.workloadmanager.v1.IListRulesRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('listRules request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.workloadmanager.v1.IListRulesResponse, - protos.google.cloud.workloadmanager.v1.IListRulesRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.workloadmanager.v1.IListRulesResponse, + | protos.google.cloud.workloadmanager.v1.IListRulesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('listRules response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.listRules(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.workloadmanager.v1.IListRulesResponse, - protos.google.cloud.workloadmanager.v1.IListRulesRequest|undefined, - {}|undefined - ]) => { - this._log.info('listRules response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .listRules(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.workloadmanager.v1.IListRulesResponse, + protos.google.cloud.workloadmanager.v1.IListRulesRequest | undefined, + {} | undefined, + ]) => { + this._log.info('listRules response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new Evaluation in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource prefix of the evaluation location using the form: - * `projects/{project_id}/locations/{location_id}`. - * @param {string} request.evaluationId - * Required. Id of the requesting object. - * @param {google.cloud.workloadmanager.v1.Evaluation} request.evaluation - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.create_evaluation.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_CreateEvaluation_async - */ + /** + * Creates a new Evaluation in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource prefix of the evaluation location using the form: + * `projects/{project_id}/locations/{location_id}`. + * @param {string} request.evaluationId + * Required. Id of the requesting object. + * @param {google.cloud.workloadmanager.v1.Evaluation} request.evaluation + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.create_evaluation.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_CreateEvaluation_async + */ createEvaluation( - request?: protos.google.cloud.workloadmanager.v1.ICreateEvaluationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workloadmanager.v1.ICreateEvaluationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createEvaluation( - request: protos.google.cloud.workloadmanager.v1.ICreateEvaluationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.ICreateEvaluationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createEvaluation( - request: protos.google.cloud.workloadmanager.v1.ICreateEvaluationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.ICreateEvaluationRequest, + callback: Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createEvaluation( - request?: protos.google.cloud.workloadmanager.v1.ICreateEvaluationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.workloadmanager.v1.ICreateEvaluationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createEvaluation response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createEvaluation request %j', request); - return this.innerApiCalls.createEvaluation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createEvaluation response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createEvaluation(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createEvaluation response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createEvaluation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.create_evaluation.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_CreateEvaluation_async - */ - async checkCreateEvaluationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createEvaluation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.create_evaluation.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_CreateEvaluation_async + */ + async checkCreateEvaluationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.workloadmanager.v1.Evaluation, + protos.google.cloud.workloadmanager.v1.OperationMetadata + > + > { this._log.info('createEvaluation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createEvaluation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createEvaluation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.workloadmanager.v1.Evaluation, + protos.google.cloud.workloadmanager.v1.OperationMetadata + >; } -/** - * Updates the parameters of a single Evaluation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask is used to specify the fields to be overwritten in the - * Evaluation resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. - * @param {google.cloud.workloadmanager.v1.Evaluation} request.evaluation - * Required. The resource being updated. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.update_evaluation.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_UpdateEvaluation_async - */ + /** + * Updates the parameters of a single Evaluation. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Field mask is used to specify the fields to be overwritten in the + * Evaluation resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. + * @param {google.cloud.workloadmanager.v1.Evaluation} request.evaluation + * Required. The resource being updated. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.update_evaluation.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_UpdateEvaluation_async + */ updateEvaluation( - request?: protos.google.cloud.workloadmanager.v1.IUpdateEvaluationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workloadmanager.v1.IUpdateEvaluationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateEvaluation( - request: protos.google.cloud.workloadmanager.v1.IUpdateEvaluationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.IUpdateEvaluationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateEvaluation( - request: protos.google.cloud.workloadmanager.v1.IUpdateEvaluationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.IUpdateEvaluationRequest, + callback: Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateEvaluation( - request?: protos.google.cloud.workloadmanager.v1.IUpdateEvaluationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.workloadmanager.v1.IUpdateEvaluationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'evaluation.name': request.evaluation!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'evaluation.name': request.evaluation!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateEvaluation response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateEvaluation request %j', request); - return this.innerApiCalls.updateEvaluation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateEvaluation response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateEvaluation(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateEvaluation response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateEvaluation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.update_evaluation.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_UpdateEvaluation_async - */ - async checkUpdateEvaluationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateEvaluation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.update_evaluation.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_UpdateEvaluation_async + */ + async checkUpdateEvaluationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.workloadmanager.v1.Evaluation, + protos.google.cloud.workloadmanager.v1.OperationMetadata + > + > { this._log.info('updateEvaluation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateEvaluation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateEvaluation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.workloadmanager.v1.Evaluation, + protos.google.cloud.workloadmanager.v1.OperationMetadata + >; } -/** - * Deletes a single Evaluation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.force] - * Optional. Followed the best practice from - * https://aip.dev/135#cascading-delete. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.delete_evaluation.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_DeleteEvaluation_async - */ + /** + * Deletes a single Evaluation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.force] + * Optional. Followed the best practice from + * https://aip.dev/135#cascading-delete. + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.delete_evaluation.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_DeleteEvaluation_async + */ deleteEvaluation( - request?: protos.google.cloud.workloadmanager.v1.IDeleteEvaluationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workloadmanager.v1.IDeleteEvaluationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteEvaluation( - request: protos.google.cloud.workloadmanager.v1.IDeleteEvaluationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.IDeleteEvaluationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteEvaluation( - request: protos.google.cloud.workloadmanager.v1.IDeleteEvaluationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.IDeleteEvaluationRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteEvaluation( - request?: protos.google.cloud.workloadmanager.v1.IDeleteEvaluationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.workloadmanager.v1.IDeleteEvaluationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteEvaluation response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteEvaluation request %j', request); - return this.innerApiCalls.deleteEvaluation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteEvaluation response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteEvaluation(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteEvaluation response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteEvaluation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.delete_evaluation.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_DeleteEvaluation_async - */ - async checkDeleteEvaluationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteEvaluation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.delete_evaluation.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_DeleteEvaluation_async + */ + async checkDeleteEvaluationProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.workloadmanager.v1.OperationMetadata + > + > { this._log.info('deleteEvaluation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteEvaluation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteEvaluation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.workloadmanager.v1.OperationMetadata + >; } -/** - * Creates a new Execution in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Evaluation using the form: - * `projects/{project}/locations/{location}/evaluations/{evaluation}`. - * @param {string} request.executionId - * Required. ID of the execution which will be created. - * @param {google.cloud.workloadmanager.v1.Execution} request.execution - * Required. The resource being created. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.run_evaluation.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_RunEvaluation_async - */ + /** + * Creates a new Execution in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Evaluation using the form: + * `projects/{project}/locations/{location}/evaluations/{evaluation}`. + * @param {string} request.executionId + * Required. ID of the execution which will be created. + * @param {google.cloud.workloadmanager.v1.Execution} request.execution + * Required. The resource being created. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.run_evaluation.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_RunEvaluation_async + */ runEvaluation( - request?: protos.google.cloud.workloadmanager.v1.IRunEvaluationRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workloadmanager.v1.IRunEvaluationRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.cloud.workloadmanager.v1.IExecution, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; runEvaluation( - request: protos.google.cloud.workloadmanager.v1.IRunEvaluationRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.IRunEvaluationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IExecution, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; runEvaluation( - request: protos.google.cloud.workloadmanager.v1.IRunEvaluationRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.IRunEvaluationRequest, + callback: Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IExecution, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; runEvaluation( - request?: protos.google.cloud.workloadmanager.v1.IRunEvaluationRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.workloadmanager.v1.IRunEvaluationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IExecution, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IExecution, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.cloud.workloadmanager.v1.IExecution, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.cloud.workloadmanager.v1.IExecution, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('runEvaluation response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('runEvaluation request %j', request); - return this.innerApiCalls.runEvaluation(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('runEvaluation response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .runEvaluation(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.cloud.workloadmanager.v1.IExecution, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('runEvaluation response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `runEvaluation()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.run_evaluation.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_RunEvaluation_async - */ - async checkRunEvaluationProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `runEvaluation()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.run_evaluation.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_RunEvaluation_async + */ + async checkRunEvaluationProgress( + name: string, + ): Promise< + LROperation< + protos.google.cloud.workloadmanager.v1.Execution, + protos.google.cloud.workloadmanager.v1.OperationMetadata + > + > { this._log.info('runEvaluation long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.runEvaluation, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.runEvaluation, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.cloud.workloadmanager.v1.Execution, + protos.google.cloud.workloadmanager.v1.OperationMetadata + >; } -/** - * Deletes a single Execution. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the resource. - * @param {string} [request.requestId] - * Optional. An optional request ID to identify requests. Specify a unique - * request ID so that if you must retry your request, the server will know to - * ignore the request if it has already been completed. The server will - * guarantee that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and - * the request times out. If you make the request again with the same request - * ID, the server can check if original operation with the same request ID - * was received, and if so, will ignore the second request. This prevents - * clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.delete_execution.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_DeleteExecution_async - */ + /** + * Deletes a single Execution. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource. + * @param {string} [request.requestId] + * Optional. An optional request ID to identify requests. Specify a unique + * request ID so that if you must retry your request, the server will know to + * ignore the request if it has already been completed. The server will + * guarantee that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and + * the request times out. If you make the request again with the same request + * ID, the server can check if original operation with the same request ID + * was received, and if so, will ignore the second request. This prevents + * clients from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @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 + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.delete_execution.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_DeleteExecution_async + */ deleteExecution( - request?: protos.google.cloud.workloadmanager.v1.IDeleteExecutionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.cloud.workloadmanager.v1.IDeleteExecutionRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; deleteExecution( - request: protos.google.cloud.workloadmanager.v1.IDeleteExecutionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.IDeleteExecutionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteExecution( - request: protos.google.cloud.workloadmanager.v1.IDeleteExecutionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.workloadmanager.v1.IDeleteExecutionRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; deleteExecution( - request?: protos.google.cloud.workloadmanager.v1.IDeleteExecutionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.cloud.workloadmanager.v1.IDeleteExecutionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('deleteExecution response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('deleteExecution request %j', request); - return this.innerApiCalls.deleteExecution(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteExecution response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .deleteExecution(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteExecution response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `deleteExecution()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.delete_execution.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_DeleteExecution_async - */ - async checkDeleteExecutionProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `deleteExecution()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.delete_execution.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_DeleteExecution_async + */ + async checkDeleteExecutionProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.workloadmanager.v1.OperationMetadata + > + > { this._log.info('deleteExecution long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteExecution, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Evaluations in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListEvaluationsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filter to be applied when listing the evaluation results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @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 Array of {@link protos.google.cloud.workloadmanager.v1.Evaluation|Evaluation}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listEvaluationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteExecution, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.workloadmanager.v1.OperationMetadata + >; + } + /** + * Lists Evaluations in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListEvaluationsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filter to be applied when listing the evaluation results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @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 Array of {@link protos.google.cloud.workloadmanager.v1.Evaluation|Evaluation}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listEvaluationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listEvaluations( - request?: protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workloadmanager.v1.IEvaluation[], - protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest|null, - protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse - ]>; + request?: protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workloadmanager.v1.IEvaluation[], + protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest | null, + protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse, + ] + >; listEvaluations( - request: protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, - protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IEvaluation>): void; + request: protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, + | protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IEvaluation + >, + ): void; listEvaluations( - request: protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, - callback: PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, - protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IEvaluation>): void; + request: protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, + callback: PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, + | protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IEvaluation + >, + ): void; listEvaluations( - request?: protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, - protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IEvaluation>, - callback?: PaginationCallback< + request?: protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, - protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IEvaluation>): - Promise<[ - protos.google.cloud.workloadmanager.v1.IEvaluation[], - protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest|null, - protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse - ]>|void { + | protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IEvaluation + >, + callback?: PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, + | protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IEvaluation + >, + ): Promise< + [ + protos.google.cloud.workloadmanager.v1.IEvaluation[], + protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest | null, + protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, - protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IEvaluation>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, + | protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IEvaluation + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listEvaluations values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1438,205 +2014,234 @@ export class WorkloadManagerClient { this._log.info('listEvaluations request %j', request); return this.innerApiCalls .listEvaluations(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.workloadmanager.v1.IEvaluation[], - protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest|null, - protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse - ]) => { - this._log.info('listEvaluations values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.workloadmanager.v1.IEvaluation[], + protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest | null, + protos.google.cloud.workloadmanager.v1.IListEvaluationsResponse, + ]) => { + this._log.info('listEvaluations values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listEvaluations`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListEvaluationsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filter to be applied when listing the evaluation results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.workloadmanager.v1.Evaluation|Evaluation} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listEvaluationsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listEvaluations`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListEvaluationsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filter to be applied when listing the evaluation results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.workloadmanager.v1.Evaluation|Evaluation} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listEvaluationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listEvaluationsStream( - request?: protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listEvaluations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listEvaluations stream %j', request); return this.descriptors.page.listEvaluations.createStream( this.innerApiCalls.listEvaluations as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listEvaluations`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent value for ListEvaluationsRequest. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filter to be applied when listing the evaluation results. - * @param {string} request.orderBy - * Hint for how to order the results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.workloadmanager.v1.Evaluation|Evaluation}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.list_evaluations.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_ListEvaluations_async - */ + /** + * Equivalent to `listEvaluations`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListEvaluationsRequest. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filter to be applied when listing the evaluation results. + * @param {string} request.orderBy + * Hint for how to order the results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.workloadmanager.v1.Evaluation|Evaluation}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.list_evaluations.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_ListEvaluations_async + */ listEvaluationsAsync( - request?: protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.workloadmanager.v1.IListEvaluationsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listEvaluations']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listEvaluations iterate %j', request); return this.descriptors.page.listEvaluations.asyncIterate( this.innerApiCalls['listEvaluations'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists Executions in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource prefix of the Execution using the form: - * `projects/{project}/locations/{location}/evaluations/{evaluation}`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @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 Array of {@link protos.google.cloud.workloadmanager.v1.Execution|Execution}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists Executions in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource prefix of the Execution using the form: + * `projects/{project}/locations/{location}/evaluations/{evaluation}`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @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 Array of {@link protos.google.cloud.workloadmanager.v1.Execution|Execution}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutions( - request?: protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workloadmanager.v1.IExecution[], - protos.google.cloud.workloadmanager.v1.IListExecutionsRequest|null, - protos.google.cloud.workloadmanager.v1.IListExecutionsResponse - ]>; + request?: protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workloadmanager.v1.IExecution[], + protos.google.cloud.workloadmanager.v1.IListExecutionsRequest | null, + protos.google.cloud.workloadmanager.v1.IListExecutionsResponse, + ] + >; listExecutions( - request: protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, - protos.google.cloud.workloadmanager.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IExecution>): void; + request: protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, + | protos.google.cloud.workloadmanager.v1.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IExecution + >, + ): void; listExecutions( - request: protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, - callback: PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, - protos.google.cloud.workloadmanager.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IExecution>): void; + request: protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, + callback: PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, + | protos.google.cloud.workloadmanager.v1.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IExecution + >, + ): void; listExecutions( - request?: protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, - protos.google.cloud.workloadmanager.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IExecution>, - callback?: PaginationCallback< + request?: protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, - protos.google.cloud.workloadmanager.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IExecution>): - Promise<[ - protos.google.cloud.workloadmanager.v1.IExecution[], - protos.google.cloud.workloadmanager.v1.IListExecutionsRequest|null, - protos.google.cloud.workloadmanager.v1.IListExecutionsResponse - ]>|void { + | protos.google.cloud.workloadmanager.v1.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IExecution + >, + callback?: PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, + | protos.google.cloud.workloadmanager.v1.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IExecution + >, + ): Promise< + [ + protos.google.cloud.workloadmanager.v1.IExecution[], + protos.google.cloud.workloadmanager.v1.IListExecutionsRequest | null, + protos.google.cloud.workloadmanager.v1.IListExecutionsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, - protos.google.cloud.workloadmanager.v1.IListExecutionsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IExecution>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, + | protos.google.cloud.workloadmanager.v1.IListExecutionsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IExecution + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listExecutions values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1645,205 +2250,234 @@ export class WorkloadManagerClient { this._log.info('listExecutions request %j', request); return this.innerApiCalls .listExecutions(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.workloadmanager.v1.IExecution[], - protos.google.cloud.workloadmanager.v1.IListExecutionsRequest|null, - protos.google.cloud.workloadmanager.v1.IListExecutionsResponse - ]) => { - this._log.info('listExecutions values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.workloadmanager.v1.IExecution[], + protos.google.cloud.workloadmanager.v1.IListExecutionsRequest | null, + protos.google.cloud.workloadmanager.v1.IListExecutionsResponse, + ]) => { + this._log.info('listExecutions values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listExecutions`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource prefix of the Execution using the form: - * `projects/{project}/locations/{location}/evaluations/{evaluation}`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.workloadmanager.v1.Execution|Execution} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listExecutionsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listExecutions`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource prefix of the Execution using the form: + * `projects/{project}/locations/{location}/evaluations/{evaluation}`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.workloadmanager.v1.Execution|Execution} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listExecutionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutionsStream( - request?: protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutions']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listExecutions stream %j', request); return this.descriptors.page.listExecutions.createStream( this.innerApiCalls.listExecutions as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listExecutions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource prefix of the Execution using the form: - * `projects/{project}/locations/{location}/evaluations/{evaluation}`. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.workloadmanager.v1.Execution|Execution}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.list_executions.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_ListExecutions_async - */ + /** + * Equivalent to `listExecutions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource prefix of the Execution using the form: + * `projects/{project}/locations/{location}/evaluations/{evaluation}`. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.workloadmanager.v1.Execution|Execution}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.list_executions.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_ListExecutions_async + */ listExecutionsAsync( - request?: protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.workloadmanager.v1.IListExecutionsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutions']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listExecutions iterate %j', request); return this.descriptors.page.listExecutions.asyncIterate( this.innerApiCalls['listExecutions'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Lists the result of a single evaluation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The execution results. - * Format: {parent}/evaluations/* /executions/* /results. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @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 Array of {@link protos.google.cloud.workloadmanager.v1.ExecutionResult|ExecutionResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listExecutionResultsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists the result of a single evaluation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The execution results. + * Format: {parent}/evaluations/* /executions/* /results. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @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 Array of {@link protos.google.cloud.workloadmanager.v1.ExecutionResult|ExecutionResult}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listExecutionResultsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutionResults( - request?: protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workloadmanager.v1.IExecutionResult[], - protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest|null, - protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse - ]>; + request?: protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workloadmanager.v1.IExecutionResult[], + protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest | null, + protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse, + ] + >; listExecutionResults( - request: protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, - protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IExecutionResult>): void; + request: protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, + | protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IExecutionResult + >, + ): void; listExecutionResults( - request: protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, - callback: PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, - protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IExecutionResult>): void; + request: protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, + callback: PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, + | protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IExecutionResult + >, + ): void; listExecutionResults( - request?: protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, - protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IExecutionResult>, - callback?: PaginationCallback< + request?: protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, - protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IExecutionResult>): - Promise<[ - protos.google.cloud.workloadmanager.v1.IExecutionResult[], - protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest|null, - protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse - ]>|void { + | protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IExecutionResult + >, + callback?: PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, + | protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IExecutionResult + >, + ): Promise< + [ + protos.google.cloud.workloadmanager.v1.IExecutionResult[], + protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest | null, + protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, - protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IExecutionResult>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, + | protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IExecutionResult + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listExecutionResults values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1852,204 +2486,233 @@ export class WorkloadManagerClient { this._log.info('listExecutionResults request %j', request); return this.innerApiCalls .listExecutionResults(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.workloadmanager.v1.IExecutionResult[], - protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest|null, - protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse - ]) => { - this._log.info('listExecutionResults values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.workloadmanager.v1.IExecutionResult[], + protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest | null, + protos.google.cloud.workloadmanager.v1.IListExecutionResultsResponse, + ]) => { + this._log.info('listExecutionResults values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listExecutionResults`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The execution results. - * Format: {parent}/evaluations/* /executions/* /results. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.workloadmanager.v1.ExecutionResult|ExecutionResult} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listExecutionResultsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listExecutionResults`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The execution results. + * Format: {parent}/evaluations/* /executions/* /results. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.workloadmanager.v1.ExecutionResult|ExecutionResult} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listExecutionResultsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listExecutionResultsStream( - request?: protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutionResults']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listExecutionResults stream %j', request); return this.descriptors.page.listExecutionResults.createStream( this.innerApiCalls.listExecutionResults as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listExecutionResults`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The execution results. - * Format: {parent}/evaluations/* /executions/* /results. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.workloadmanager.v1.ExecutionResult|ExecutionResult}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.list_execution_results.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_ListExecutionResults_async - */ + /** + * Equivalent to `listExecutionResults`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The execution results. + * Format: {parent}/evaluations/* /executions/* /results. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.workloadmanager.v1.ExecutionResult|ExecutionResult}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.list_execution_results.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_ListExecutionResults_async + */ listExecutionResultsAsync( - request?: protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.workloadmanager.v1.IListExecutionResultsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listExecutionResults']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listExecutionResults iterate %j', request); return this.descriptors.page.listExecutionResults.asyncIterate( this.innerApiCalls['listExecutionResults'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * List all scanned resources for a single Execution. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent for ListScannedResourcesRequest. - * @param {string} request.rule - * Rule name. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @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 Array of {@link protos.google.cloud.workloadmanager.v1.ScannedResource|ScannedResource}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listScannedResourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * List all scanned resources for a single Execution. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent for ListScannedResourcesRequest. + * @param {string} request.rule + * Rule name. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @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 Array of {@link protos.google.cloud.workloadmanager.v1.ScannedResource|ScannedResource}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listScannedResourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listScannedResources( - request?: protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.workloadmanager.v1.IScannedResource[], - protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest|null, - protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse - ]>; + request?: protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.workloadmanager.v1.IScannedResource[], + protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest | null, + protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse, + ] + >; listScannedResources( - request: protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, - protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IScannedResource>): void; + request: protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, + | protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IScannedResource + >, + ): void; listScannedResources( - request: protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, - callback: PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, - protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IScannedResource>): void; + request: protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, + callback: PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, + | protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IScannedResource + >, + ): void; listScannedResources( - request?: protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, - protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IScannedResource>, - callback?: PaginationCallback< + request?: protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, - protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IScannedResource>): - Promise<[ - protos.google.cloud.workloadmanager.v1.IScannedResource[], - protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest|null, - protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse - ]>|void { + | protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IScannedResource + >, + callback?: PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, + | protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IScannedResource + >, + ): Promise< + [ + protos.google.cloud.workloadmanager.v1.IScannedResource[], + protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest | null, + protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, - protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse|null|undefined, - protos.google.cloud.workloadmanager.v1.IScannedResource>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, + | protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse + | null + | undefined, + protos.google.cloud.workloadmanager.v1.IScannedResource + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listScannedResources values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2058,123 +2721,128 @@ export class WorkloadManagerClient { this._log.info('listScannedResources request %j', request); return this.innerApiCalls .listScannedResources(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.workloadmanager.v1.IScannedResource[], - protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest|null, - protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse - ]) => { - this._log.info('listScannedResources values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.workloadmanager.v1.IScannedResource[], + protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest | null, + protos.google.cloud.workloadmanager.v1.IListScannedResourcesResponse, + ]) => { + this._log.info('listScannedResources values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listScannedResources`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent for ListScannedResourcesRequest. - * @param {string} request.rule - * Rule name. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.workloadmanager.v1.ScannedResource|ScannedResource} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listScannedResourcesAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listScannedResources`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent for ListScannedResourcesRequest. + * @param {string} request.rule + * Rule name. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.workloadmanager.v1.ScannedResource|ScannedResource} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listScannedResourcesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listScannedResourcesStream( - request?: protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listScannedResources']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listScannedResources stream %j', request); return this.descriptors.page.listScannedResources.createStream( this.innerApiCalls.listScannedResources as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listScannedResources`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Parent for ListScannedResourcesRequest. - * @param {string} request.rule - * Rule name. - * @param {number} request.pageSize - * Requested page size. Server may return fewer items than requested. - * If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * A token identifying a page of results the server should return. - * @param {string} request.filter - * Filtering results. - * @param {string} request.orderBy - * Field to sort by. See https://google.aip.dev/132#ordering for more details. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.workloadmanager.v1.ScannedResource|ScannedResource}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/workload_manager.list_scanned_resources.js - * region_tag:workloadmanager_v1_generated_WorkloadManager_ListScannedResources_async - */ + /** + * Equivalent to `listScannedResources`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent for ListScannedResourcesRequest. + * @param {string} request.rule + * Rule name. + * @param {number} request.pageSize + * Requested page size. Server may return fewer items than requested. + * If unspecified, server will pick an appropriate default. + * @param {string} request.pageToken + * A token identifying a page of results the server should return. + * @param {string} request.filter + * Filtering results. + * @param {string} request.orderBy + * Field to sort by. See https://google.aip.dev/132#ordering for more details. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.workloadmanager.v1.ScannedResource|ScannedResource}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/workload_manager.list_scanned_resources.js + * region_tag:workloadmanager_v1_generated_WorkloadManager_ListScannedResources_async + */ listScannedResourcesAsync( - request?: protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.workloadmanager.v1.IListScannedResourcesRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listScannedResources']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listScannedResources iterate %j', request); return this.descriptors.page.listScannedResources.asyncIterate( this.innerApiCalls['listScannedResources'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } -/** + + /** * Gets information about a location. * * @param {Object} request @@ -2209,12 +2877,11 @@ export class WorkloadManagerClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -2247,12 +2914,12 @@ export class WorkloadManagerClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } -/** + /** * Gets the latest state of a long-running operation. Clients can use this * method to poll the operation result at intervals as recommended by the API * service. @@ -2295,22 +2962,22 @@ export class WorkloadManagerClient { protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined - > + >, ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.getOperation(request, options, callback); } /** @@ -2345,15 +3012,15 @@ export class WorkloadManagerClient { */ listOperationsAsync( request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions + options?: gax.CallOptions, ): AsyncIterable { - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.listOperationsAsync(request, options); } /** @@ -2387,7 +3054,7 @@ export class WorkloadManagerClient { * await client.cancelOperation({name: ''}); * ``` */ - cancelOperation( + cancelOperation( request: protos.google.longrunning.CancelOperationRequest, optionsOrCallback?: | gax.CallOptions @@ -2400,25 +3067,24 @@ export class WorkloadManagerClient { protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.cancelOperation(request, options, callback); } - /** * Deletes a long-running operation. This method indicates that the client is * no longer interested in the operation result. It does not cancel the @@ -2457,22 +3123,22 @@ export class WorkloadManagerClient { protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined - > + >, ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); return this.operationsClient.deleteOperation(request, options, callback); } @@ -2489,7 +3155,12 @@ export class WorkloadManagerClient { * @param {string} crypto_key * @returns {string} Resource name string. */ - cryptoKeyPath(project:string,location:string,keyRing:string,cryptoKey:string) { + cryptoKeyPath( + project: string, + location: string, + keyRing: string, + cryptoKey: string, + ) { return this.pathTemplates.cryptoKeyPathTemplate.render({ project: project, location: location, @@ -2506,7 +3177,8 @@ export class WorkloadManagerClient { * @returns {string} A string representing the project. */ matchProjectFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).project; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .project; } /** @@ -2517,7 +3189,8 @@ export class WorkloadManagerClient { * @returns {string} A string representing the location. */ matchLocationFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).location; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .location; } /** @@ -2528,7 +3201,8 @@ export class WorkloadManagerClient { * @returns {string} A string representing the key_ring. */ matchKeyRingFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).key_ring; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .key_ring; } /** @@ -2539,7 +3213,8 @@ export class WorkloadManagerClient { * @returns {string} A string representing the crypto_key. */ matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string) { - return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName).crypto_key; + return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName) + .crypto_key; } /** @@ -2550,7 +3225,7 @@ export class WorkloadManagerClient { * @param {string} evaluation * @returns {string} Resource name string. */ - evaluationPath(project:string,location:string,evaluation:string) { + evaluationPath(project: string, location: string, evaluation: string) { return this.pathTemplates.evaluationPathTemplate.render({ project: project, location: location, @@ -2566,7 +3241,8 @@ export class WorkloadManagerClient { * @returns {string} A string representing the project. */ matchProjectFromEvaluationName(evaluationName: string) { - return this.pathTemplates.evaluationPathTemplate.match(evaluationName).project; + return this.pathTemplates.evaluationPathTemplate.match(evaluationName) + .project; } /** @@ -2577,7 +3253,8 @@ export class WorkloadManagerClient { * @returns {string} A string representing the location. */ matchLocationFromEvaluationName(evaluationName: string) { - return this.pathTemplates.evaluationPathTemplate.match(evaluationName).location; + return this.pathTemplates.evaluationPathTemplate.match(evaluationName) + .location; } /** @@ -2588,7 +3265,8 @@ export class WorkloadManagerClient { * @returns {string} A string representing the evaluation. */ matchEvaluationFromEvaluationName(evaluationName: string) { - return this.pathTemplates.evaluationPathTemplate.match(evaluationName).evaluation; + return this.pathTemplates.evaluationPathTemplate.match(evaluationName) + .evaluation; } /** @@ -2600,7 +3278,12 @@ export class WorkloadManagerClient { * @param {string} execution * @returns {string} Resource name string. */ - executionPath(project:string,location:string,evaluation:string,execution:string) { + executionPath( + project: string, + location: string, + evaluation: string, + execution: string, + ) { return this.pathTemplates.executionPathTemplate.render({ project: project, location: location, @@ -2617,7 +3300,8 @@ export class WorkloadManagerClient { * @returns {string} A string representing the project. */ matchProjectFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).project; + return this.pathTemplates.executionPathTemplate.match(executionName) + .project; } /** @@ -2628,7 +3312,8 @@ export class WorkloadManagerClient { * @returns {string} A string representing the location. */ matchLocationFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).location; + return this.pathTemplates.executionPathTemplate.match(executionName) + .location; } /** @@ -2639,7 +3324,8 @@ export class WorkloadManagerClient { * @returns {string} A string representing the evaluation. */ matchEvaluationFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).evaluation; + return this.pathTemplates.executionPathTemplate.match(executionName) + .evaluation; } /** @@ -2650,7 +3336,8 @@ export class WorkloadManagerClient { * @returns {string} A string representing the execution. */ matchExecutionFromExecutionName(executionName: string) { - return this.pathTemplates.executionPathTemplate.match(executionName).execution; + return this.pathTemplates.executionPathTemplate.match(executionName) + .execution; } /** @@ -2660,7 +3347,7 @@ export class WorkloadManagerClient { * @param {string} location * @returns {string} Resource name string. */ - locationPath(project:string,location:string) { + locationPath(project: string, location: string) { return this.pathTemplates.locationPathTemplate.render({ project: project, location: location, @@ -2695,7 +3382,7 @@ export class WorkloadManagerClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -2720,7 +3407,7 @@ export class WorkloadManagerClient { * @param {string} rule * @returns {string} Resource name string. */ - rulePath(project:string,location:string,rule:string) { + rulePath(project: string, location: string, rule: string) { return this.pathTemplates.rulePathTemplate.render({ project: project, location: location, @@ -2769,14 +3456,16 @@ export class WorkloadManagerClient { */ close(): Promise { if (this.workloadManagerStub && !this._terminated) { - return this.workloadManagerStub.then(stub => { + return this.workloadManagerStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); void this.operationsClient.close(); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-workloadmanager/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-workloadmanager/system-test/fixtures/sample/src/index.ts index 4b6d87ad55b8..7fb3c3f270fc 100644 --- a/packages/google-cloud-workloadmanager/system-test/fixtures/sample/src/index.ts +++ b/packages/google-cloud-workloadmanager/system-test/fixtures/sample/src/index.ts @@ -16,7 +16,7 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {WorkloadManagerClient} from '@google-cloud/workloadmanager'; +import { WorkloadManagerClient } from '@google-cloud/workloadmanager'; // check that the client class type name can be used function doStuffWithWorkloadManagerClient(client: WorkloadManagerClient) { diff --git a/packages/google-cloud-workloadmanager/system-test/install.ts b/packages/google-cloud-workloadmanager/system-test/install.ts index 394f3362d203..ccf167042d2e 100644 --- a/packages/google-cloud-workloadmanager/system-test/install.ts +++ b/packages/google-cloud-workloadmanager/system-test/install.ts @@ -16,34 +16,36 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { + it('TypeScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts', + ).toString(), + }, }; await packNTest(options); }); - it('JavaScript code', async function() { + it('JavaScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } + cjs: readFileSync( + './system-test/fixtures/sample/src/index.js', + ).toString(), + }, }; await packNTest(options); }); - }); diff --git a/packages/google-cloud-workloadmanager/test/gapic_workload_manager_v1.ts b/packages/google-cloud-workloadmanager/test/gapic_workload_manager_v1.ts index 4053dcff71c1..bc985b12a1ea 100644 --- a/packages/google-cloud-workloadmanager/test/gapic_workload_manager_v1.ts +++ b/packages/google-cloud-workloadmanager/test/gapic_workload_manager_v1.ts @@ -19,3029 +19,3921 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as workloadmanagerModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos, LocationProtos} from 'google-gax'; +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); } -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.WorkloadManagerClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'workloadmanager.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = workloadmanagerModule.v1.WorkloadManagerClient.servicePath; - assert.strictEqual(servicePath, 'workloadmanager.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = workloadmanagerModule.v1.WorkloadManagerClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'workloadmanager.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'workloadmanager.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'workloadmanager.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new workloadmanagerModule.v1.WorkloadManagerClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'workloadmanager.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new workloadmanagerModule.v1.WorkloadManagerClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'workloadmanager.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new workloadmanagerModule.v1.WorkloadManagerClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = workloadmanagerModule.v1.WorkloadManagerClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - fallback: true, - }); - assert(client); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'workloadmanager.googleapis.com'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workloadManagerStub, undefined); - await client.initialize(); - assert(client.workloadManagerStub); - }); + it('has universeDomain', () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('has close method for the initialized client', done => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.workloadManagerStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + workloadmanagerModule.v1.WorkloadManagerClient.servicePath; + assert.strictEqual(servicePath, 'workloadmanager.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + workloadmanagerModule.v1.WorkloadManagerClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'workloadmanager.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workloadmanager.example.com'); + }); - it('has close method for the non-initialized client', done => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.workloadManagerStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workloadmanager.example.com'); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new workloadmanagerModule.v1.WorkloadManagerClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'workloadmanager.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual( + servicePath, + 'workloadmanager.configured.example.com', + ); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new workloadmanagerModule.v1.WorkloadManagerClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has port', () => { + const port = workloadmanagerModule.v1.WorkloadManagerClient.port; + assert(port); + assert(typeof port === 'number'); }); - describe('getEvaluation', () => { - it('invokes getEvaluation without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.GetEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.GetEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.Evaluation() - ); - client.innerApiCalls.getEvaluation = stubSimpleCall(expectedResponse); - const [response] = await client.getEvaluation(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with no option', () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient(); + assert(client); + }); - it('invokes getEvaluation without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.GetEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.GetEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.Evaluation() - ); - client.innerApiCalls.getEvaluation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEvaluation( - request, - (err?: Error|null, result?: protos.google.cloud.workloadmanager.v1.IEvaluation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('should create a client with gRPC fallback', () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + fallback: true, + }); + assert(client); + }); - it('invokes getEvaluation with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.GetEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.GetEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getEvaluation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEvaluation(request), expectedError); - const actualRequest = (client.innerApiCalls.getEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.workloadManagerStub, undefined); + await client.initialize(); + assert(client.workloadManagerStub); + }); - it('invokes getEvaluation with closed client', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.GetEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.GetEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getEvaluation(request), expectedError); + it('has close method for the initialized client', (done) => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.workloadManagerStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getExecution', () => { - it('invokes getExecution without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); - const [response] = await client.getExecution(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.workloadManagerStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getExecution without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.Execution() - ); - client.innerApiCalls.getExecution = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExecution( - request, - (err?: Error|null, result?: protos.google.cloud.workloadmanager.v1.IExecution|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes getExecution with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExecution = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getEvaluation', () => { + it('invokes getEvaluation without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.GetEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.GetEvaluationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Evaluation(), + ); + client.innerApiCalls.getEvaluation = stubSimpleCall(expectedResponse); + const [response] = await client.getEvaluation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getExecution with closed client', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.GetExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.GetExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getExecution(request), expectedError); - }); + it('invokes getEvaluation without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.GetEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.GetEvaluationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Evaluation(), + ); + client.innerApiCalls.getEvaluation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEvaluation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workloadmanager.v1.IEvaluation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listRules', () => { - it('invokes listRules without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListRulesResponse() - ); - client.innerApiCalls.listRules = stubSimpleCall(expectedResponse); - const [response] = await client.listRules(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getEvaluation with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.GetEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.GetEvaluationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEvaluation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getEvaluation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listRules without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListRulesResponse() - ); - client.innerApiCalls.listRules = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRules( - request, - (err?: Error|null, result?: protos.google.cloud.workloadmanager.v1.IListRulesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getEvaluation with closed client', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.GetEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.GetEvaluationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getEvaluation(request), expectedError); + }); + }); + + describe('getExecution', () => { + it('invokes getExecution without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.GetExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.GetExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Execution(), + ); + client.innerApiCalls.getExecution = stubSimpleCall(expectedResponse); + const [response] = await client.getExecution(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listRules with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRules = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRules(request), expectedError); - const actualRequest = (client.innerApiCalls.listRules as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRules as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExecution without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.GetExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.GetExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Execution(), + ); + client.innerApiCalls.getExecution = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getExecution( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workloadmanager.v1.IExecution | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listRules with closed client', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListRulesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListRulesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listRules(request), expectedError); - }); + it('invokes getExecution with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.GetExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.GetExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getExecution = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getExecution(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createEvaluation', () => { - it('invokes createEvaluation without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.CreateEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.CreateEvaluationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createEvaluation = stubLongRunningCall(expectedResponse); - const [operation] = await client.createEvaluation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getExecution with closed client', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.GetExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.GetExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getExecution(request), expectedError); + }); + }); + + describe('listRules', () => { + it('invokes listRules without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListRulesResponse(), + ); + client.innerApiCalls.listRules = stubSimpleCall(expectedResponse); + const [response] = await client.listRules(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listRules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createEvaluation without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.CreateEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.CreateEvaluationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createEvaluation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createEvaluation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listRules without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListRulesResponse(), + ); + client.innerApiCalls.listRules = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRules( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workloadmanager.v1.IListRulesResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listRules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createEvaluation with call error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.CreateEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.CreateEvaluationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEvaluation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createEvaluation(request), expectedError); - const actualRequest = (client.innerApiCalls.createEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listRules with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRules = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRules(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listRules as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listRules as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createEvaluation with LRO error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.CreateEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.CreateEvaluationRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEvaluation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createEvaluation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listRules with closed client', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListRulesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListRulesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.listRules(request), expectedError); + }); + }); + + describe('createEvaluation', () => { + it('invokes createEvaluation without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.CreateEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.CreateEvaluationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createEvaluation = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createEvaluation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateEvaluationProgress without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateEvaluationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createEvaluation without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.CreateEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.CreateEvaluationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createEvaluation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEvaluation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateEvaluationProgress with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateEvaluationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes createEvaluation with call error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.CreateEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.CreateEvaluationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEvaluation = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createEvaluation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('updateEvaluation', () => { - it('invokes updateEvaluation without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.UpdateEvaluationRequest() - ); - request.evaluation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.UpdateEvaluationRequest', ['evaluation', 'name']); - request.evaluation.name = defaultValue1; - const expectedHeaderRequestParams = `evaluation.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateEvaluation = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateEvaluation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createEvaluation with LRO error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.CreateEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.CreateEvaluationRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEvaluation = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createEvaluation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateEvaluation without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.UpdateEvaluationRequest() - ); - request.evaluation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.UpdateEvaluationRequest', ['evaluation', 'name']); - request.evaluation.name = defaultValue1; - const expectedHeaderRequestParams = `evaluation.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateEvaluation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateEvaluation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateEvaluationProgress without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateEvaluationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes updateEvaluation with call error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.UpdateEvaluationRequest() - ); - request.evaluation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.UpdateEvaluationRequest', ['evaluation', 'name']); - request.evaluation.name = defaultValue1; - const expectedHeaderRequestParams = `evaluation.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateEvaluation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateEvaluation(request), expectedError); - const actualRequest = (client.innerApiCalls.updateEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateEvaluationProgress with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateEvaluationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateEvaluation', () => { + it('invokes updateEvaluation without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.UpdateEvaluationRequest(), + ); + request.evaluation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.UpdateEvaluationRequest', + ['evaluation', 'name'], + ); + request.evaluation.name = defaultValue1; + const expectedHeaderRequestParams = `evaluation.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateEvaluation = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateEvaluation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateEvaluation with LRO error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.UpdateEvaluationRequest() - ); - request.evaluation ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.UpdateEvaluationRequest', ['evaluation', 'name']); - request.evaluation.name = defaultValue1; - const expectedHeaderRequestParams = `evaluation.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateEvaluation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateEvaluation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateEvaluation without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.UpdateEvaluationRequest(), + ); + request.evaluation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.UpdateEvaluationRequest', + ['evaluation', 'name'], + ); + request.evaluation.name = defaultValue1; + const expectedHeaderRequestParams = `evaluation.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateEvaluation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateEvaluation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.workloadmanager.v1.IEvaluation, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateEvaluationProgress without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateEvaluationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes updateEvaluation with call error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.UpdateEvaluationRequest(), + ); + request.evaluation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.UpdateEvaluationRequest', + ['evaluation', 'name'], + ); + request.evaluation.name = defaultValue1; + const expectedHeaderRequestParams = `evaluation.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEvaluation = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateEvaluation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateEvaluationProgress with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateEvaluationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes updateEvaluation with LRO error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.UpdateEvaluationRequest(), + ); + request.evaluation ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.UpdateEvaluationRequest', + ['evaluation', 'name'], + ); + request.evaluation.name = defaultValue1; + const expectedHeaderRequestParams = `evaluation.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEvaluation = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateEvaluation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteEvaluation', () => { - it('invokes deleteEvaluation without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.DeleteEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.DeleteEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteEvaluation = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteEvaluation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateEvaluationProgress without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateEvaluationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes deleteEvaluation without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.DeleteEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.DeleteEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteEvaluation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteEvaluation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkUpdateEvaluationProgress with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateEvaluationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteEvaluation', () => { + it('invokes deleteEvaluation without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.DeleteEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.DeleteEvaluationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteEvaluation = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteEvaluation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteEvaluation with call error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.DeleteEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.DeleteEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteEvaluation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteEvaluation(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteEvaluation without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.DeleteEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.DeleteEvaluationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteEvaluation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteEvaluation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteEvaluation with LRO error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.DeleteEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.DeleteEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteEvaluation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteEvaluation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteEvaluation with call error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.DeleteEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.DeleteEvaluationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEvaluation = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteEvaluation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteEvaluationProgress without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteEvaluationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes deleteEvaluation with LRO error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.DeleteEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.DeleteEvaluationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEvaluation = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteEvaluation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteEvaluationProgress with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteEvaluationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkDeleteEvaluationProgress without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteEvaluationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('runEvaluation', () => { - it('invokes runEvaluation without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.RunEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.RunEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runEvaluation = stubLongRunningCall(expectedResponse); - const [operation] = await client.runEvaluation(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteEvaluationProgress with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteEvaluationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('runEvaluation', () => { + it('invokes runEvaluation without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.RunEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.RunEvaluationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.runEvaluation = + stubLongRunningCall(expectedResponse); + const [operation] = await client.runEvaluation(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.runEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes runEvaluation without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.RunEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.RunEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.runEvaluation = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runEvaluation( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes runEvaluation without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.RunEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.RunEvaluationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.runEvaluation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.runEvaluation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.workloadmanager.v1.IExecution, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.workloadmanager.v1.IExecution, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.runEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes runEvaluation with call error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.RunEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.RunEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.runEvaluation = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.runEvaluation(request), expectedError); - const actualRequest = (client.innerApiCalls.runEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes runEvaluation with call error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.RunEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.RunEvaluationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runEvaluation = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.runEvaluation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.runEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes runEvaluation with LRO error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.RunEvaluationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.RunEvaluationRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.runEvaluation = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.runEvaluation(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.runEvaluation as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runEvaluation as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes runEvaluation with LRO error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.RunEvaluationRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.RunEvaluationRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.runEvaluation = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.runEvaluation(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.runEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.runEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkRunEvaluationProgress without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRunEvaluationProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkRunEvaluationProgress without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkRunEvaluationProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkRunEvaluationProgress with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRunEvaluationProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkRunEvaluationProgress with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkRunEvaluationProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteExecution', () => { + it('invokes deleteExecution without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.DeleteExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.DeleteExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteExecution = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteExecution(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('deleteExecution', () => { - it('invokes deleteExecution without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.DeleteExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.DeleteExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteExecution = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteExecution(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteExecution without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.DeleteExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.DeleteExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteExecution = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteExecution( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.workloadmanager.v1.IOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteExecution without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.DeleteExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.DeleteExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteExecution = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteExecution( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteExecution with call error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.DeleteExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.DeleteExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteExecution = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteExecution(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteExecution with call error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.DeleteExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.DeleteExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteExecution = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteExecution(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteExecution with LRO error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.DeleteExecutionRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.DeleteExecutionRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteExecution = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteExecution(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteExecution as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteExecution as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteExecution with LRO error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.DeleteExecutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.DeleteExecutionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteExecution = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteExecution(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteExecution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExecution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkDeleteExecutionProgress without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteExecutionProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkDeleteExecutionProgress without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteExecutionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkDeleteExecutionProgress with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteExecutionProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listEvaluations', () => { + it('invokes listEvaluations without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListEvaluationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListEvaluationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Evaluation(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Evaluation(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Evaluation(), + ), + ]; + client.innerApiCalls.listEvaluations = stubSimpleCall(expectedResponse); + const [response] = await client.listEvaluations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEvaluations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEvaluations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkDeleteExecutionProgress with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteExecutionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listEvaluations without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListEvaluationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListEvaluationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Evaluation(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Evaluation(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Evaluation(), + ), + ]; + client.innerApiCalls.listEvaluations = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEvaluations( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.workloadmanager.v1.IEvaluation[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEvaluations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEvaluations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listEvaluations', () => { - it('invokes listEvaluations without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListEvaluationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListEvaluationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Evaluation()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Evaluation()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Evaluation()), - ]; - client.innerApiCalls.listEvaluations = stubSimpleCall(expectedResponse); - const [response] = await client.listEvaluations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEvaluations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEvaluations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listEvaluations with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListEvaluationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListEvaluationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEvaluations = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listEvaluations(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listEvaluations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEvaluations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listEvaluations without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListEvaluationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListEvaluationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Evaluation()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Evaluation()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Evaluation()), - ]; - client.innerApiCalls.listEvaluations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEvaluations( - request, - (err?: Error|null, result?: protos.google.cloud.workloadmanager.v1.IEvaluation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEvaluations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEvaluations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listEvaluationsStream without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListEvaluationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListEvaluationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Evaluation(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Evaluation(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Evaluation(), + ), + ]; + client.descriptors.page.listEvaluations.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listEvaluationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workloadmanager.v1.Evaluation[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.workloadmanager.v1.Evaluation) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listEvaluations.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEvaluations, request), + ); + assert( + (client.descriptors.page.listEvaluations.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listEvaluations with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListEvaluationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListEvaluationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEvaluations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEvaluations(request), expectedError); - const actualRequest = (client.innerApiCalls.listEvaluations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEvaluations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listEvaluationsStream with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListEvaluationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListEvaluationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEvaluations.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listEvaluationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workloadmanager.v1.Evaluation[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.workloadmanager.v1.Evaluation) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listEvaluations.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEvaluations, request), + ); + assert( + (client.descriptors.page.listEvaluations.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listEvaluationsStream without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListEvaluationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListEvaluationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Evaluation()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Evaluation()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Evaluation()), - ]; - client.descriptors.page.listEvaluations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listEvaluationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workloadmanager.v1.Evaluation[] = []; - stream.on('data', (response: protos.google.cloud.workloadmanager.v1.Evaluation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listEvaluations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEvaluations, request)); - assert( - (client.descriptors.page.listEvaluations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listEvaluations without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListEvaluationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListEvaluationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Evaluation(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Evaluation(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Evaluation(), + ), + ]; + client.descriptors.page.listEvaluations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workloadmanager.v1.IEvaluation[] = + []; + const iterable = client.listEvaluationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listEvaluations.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listEvaluations.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listEvaluationsStream with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListEvaluationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListEvaluationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listEvaluations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listEvaluationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workloadmanager.v1.Evaluation[] = []; - stream.on('data', (response: protos.google.cloud.workloadmanager.v1.Evaluation) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listEvaluations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listEvaluations, request)); - assert( - (client.descriptors.page.listEvaluations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listEvaluations with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListEvaluationsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListEvaluationsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEvaluations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listEvaluationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workloadmanager.v1.IEvaluation[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listEvaluations.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listEvaluations.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listExecutions', () => { + it('invokes listExecutions without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Execution(), + ), + ]; + client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); + const [response] = await client.listExecutions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listEvaluations without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListEvaluationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListEvaluationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Evaluation()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Evaluation()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Evaluation()), - ]; - client.descriptors.page.listEvaluations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workloadmanager.v1.IEvaluation[] = []; - const iterable = client.listEvaluationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listExecutions without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Execution(), + ), + ]; + client.innerApiCalls.listExecutions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExecutions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.workloadmanager.v1.IExecution[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listEvaluations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listEvaluations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listEvaluations with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListEvaluationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListEvaluationsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listEvaluations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listEvaluationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workloadmanager.v1.IEvaluation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listEvaluations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listEvaluations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listExecutions', () => { - it('invokes listExecutions without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCall(expectedResponse); - const [response] = await client.listExecutions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExecutions with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExecutions = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listExecutions(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutions without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Execution()), - ]; - client.innerApiCalls.listExecutions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExecutions( - request, - (err?: Error|null, result?: protos.google.cloud.workloadmanager.v1.IExecution[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExecutionsStream without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Execution(), + ), + ]; + client.descriptors.page.listExecutions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workloadmanager.v1.Execution[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.workloadmanager.v1.Execution) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listExecutions, request), + ); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listExecutions with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExecutions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExecutions(request), expectedError); - const actualRequest = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExecutionsStream with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listExecutionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workloadmanager.v1.Execution[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.workloadmanager.v1.Execution) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listExecutions, request), + ); + assert( + (client.descriptors.page.listExecutions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listExecutionsStream without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Execution()), - ]; - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workloadmanager.v1.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workloadmanager.v1.Execution) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listExecutions without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Execution(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.Execution(), + ), + ]; + client.descriptors.page.listExecutions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workloadmanager.v1.IExecution[] = []; + const iterable = client.listExecutionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listExecutions.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listExecutionsStream with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExecutionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workloadmanager.v1.Execution[] = []; - stream.on('data', (response: protos.google.cloud.workloadmanager.v1.Execution) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutions, request)); - assert( - (client.descriptors.page.listExecutions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listExecutions with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListExecutionsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListExecutionsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExecutionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workloadmanager.v1.IExecution[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listExecutions.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listExecutions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listExecutionResults', () => { + it('invokes listExecutionResults without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListExecutionResultsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListExecutionResultsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ExecutionResult(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ExecutionResult(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ExecutionResult(), + ), + ]; + client.innerApiCalls.listExecutionResults = + stubSimpleCall(expectedResponse); + const [response] = await client.listExecutionResults(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExecutionResults as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutionResults as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listExecutions without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Execution()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.Execution()), - ]; - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workloadmanager.v1.IExecution[] = []; - const iterable = client.listExecutionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listExecutionResults without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListExecutionResultsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListExecutionResultsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ExecutionResult(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ExecutionResult(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ExecutionResult(), + ), + ]; + client.innerApiCalls.listExecutionResults = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listExecutionResults( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.workloadmanager.v1.IExecutionResult[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExecutions with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListExecutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListExecutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExecutionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workloadmanager.v1.IExecution[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listExecutionResults as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutionResults as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listExecutionResults', () => { - it('invokes listExecutionResults without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListExecutionResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListExecutionResultsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ExecutionResult()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ExecutionResult()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ExecutionResult()), - ]; - client.innerApiCalls.listExecutionResults = stubSimpleCall(expectedResponse); - const [response] = await client.listExecutionResults(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutionResults as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutionResults as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExecutionResults with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListExecutionResultsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListExecutionResultsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listExecutionResults = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listExecutionResults(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listExecutionResults as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listExecutionResults as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listExecutionResults without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListExecutionResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListExecutionResultsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ExecutionResult()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ExecutionResult()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ExecutionResult()), - ]; - client.innerApiCalls.listExecutionResults = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExecutionResults( - request, - (err?: Error|null, result?: protos.google.cloud.workloadmanager.v1.IExecutionResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExecutionResults as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutionResults as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExecutionResultsStream without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListExecutionResultsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListExecutionResultsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ExecutionResult(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ExecutionResult(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ExecutionResult(), + ), + ]; + client.descriptors.page.listExecutionResults.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listExecutionResultsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workloadmanager.v1.ExecutionResult[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.workloadmanager.v1.ExecutionResult, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listExecutionResults.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listExecutionResults, request), + ); + assert( + (client.descriptors.page.listExecutionResults.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listExecutionResults with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListExecutionResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListExecutionResultsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExecutionResults = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExecutionResults(request), expectedError); - const actualRequest = (client.innerApiCalls.listExecutionResults as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExecutionResults as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listExecutionResultsStream with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListExecutionResultsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListExecutionResultsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutionResults.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listExecutionResultsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workloadmanager.v1.ExecutionResult[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.workloadmanager.v1.ExecutionResult, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listExecutionResults.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listExecutionResults, request), + ); + assert( + (client.descriptors.page.listExecutionResults.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listExecutionResultsStream without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListExecutionResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListExecutionResultsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ExecutionResult()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ExecutionResult()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ExecutionResult()), - ]; - client.descriptors.page.listExecutionResults.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExecutionResultsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workloadmanager.v1.ExecutionResult[] = []; - stream.on('data', (response: protos.google.cloud.workloadmanager.v1.ExecutionResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listExecutionResults.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutionResults, request)); - assert( - (client.descriptors.page.listExecutionResults.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listExecutionResults without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListExecutionResultsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListExecutionResultsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ExecutionResult(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ExecutionResult(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ExecutionResult(), + ), + ]; + client.descriptors.page.listExecutionResults.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workloadmanager.v1.IExecutionResult[] = + []; + const iterable = client.listExecutionResultsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listExecutionResults.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listExecutionResults.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listExecutionResultsStream with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListExecutionResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListExecutionResultsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutionResults.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExecutionResultsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workloadmanager.v1.ExecutionResult[] = []; - stream.on('data', (response: protos.google.cloud.workloadmanager.v1.ExecutionResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExecutionResults.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExecutionResults, request)); - assert( - (client.descriptors.page.listExecutionResults.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listExecutionResults with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListExecutionResultsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListExecutionResultsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listExecutionResults.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listExecutionResultsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workloadmanager.v1.IExecutionResult[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listExecutionResults.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listExecutionResults.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('listScannedResources', () => { + it('invokes listScannedResources without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListScannedResourcesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListScannedResourcesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ScannedResource(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ScannedResource(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ScannedResource(), + ), + ]; + client.innerApiCalls.listScannedResources = + stubSimpleCall(expectedResponse); + const [response] = await client.listScannedResources(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listScannedResources as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScannedResources as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listExecutionResults without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListExecutionResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListExecutionResultsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ExecutionResult()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ExecutionResult()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ExecutionResult()), - ]; - client.descriptors.page.listExecutionResults.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workloadmanager.v1.IExecutionResult[] = []; - const iterable = client.listExecutionResultsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listScannedResources without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListScannedResourcesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListScannedResourcesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ScannedResource(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ScannedResource(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ScannedResource(), + ), + ]; + client.innerApiCalls.listScannedResources = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listScannedResources( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.workloadmanager.v1.IScannedResource[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExecutionResults.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutionResults.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExecutionResults with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListExecutionResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListExecutionResultsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExecutionResults.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExecutionResultsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workloadmanager.v1.IExecutionResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExecutionResults.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExecutionResults.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listScannedResources as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScannedResources as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listScannedResources', () => { - it('invokes listScannedResources without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListScannedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListScannedResourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ScannedResource()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ScannedResource()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ScannedResource()), - ]; - client.innerApiCalls.listScannedResources = stubSimpleCall(expectedResponse); - const [response] = await client.listScannedResources(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScannedResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScannedResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScannedResources without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListScannedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListScannedResourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ScannedResource()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ScannedResource()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ScannedResource()), - ]; - client.innerApiCalls.listScannedResources = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listScannedResources( - request, - (err?: Error|null, result?: protos.google.cloud.workloadmanager.v1.IScannedResource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listScannedResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScannedResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listScannedResources with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListScannedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListScannedResourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listScannedResources = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listScannedResources(request), expectedError); - const actualRequest = (client.innerApiCalls.listScannedResources as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listScannedResources as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listScannedResources with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListScannedResourcesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListScannedResourcesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listScannedResources = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listScannedResources(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listScannedResources as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listScannedResources as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listScannedResourcesStream without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListScannedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListScannedResourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ScannedResource()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ScannedResource()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ScannedResource()), - ]; - client.descriptors.page.listScannedResources.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listScannedResourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workloadmanager.v1.ScannedResource[] = []; - stream.on('data', (response: protos.google.cloud.workloadmanager.v1.ScannedResource) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listScannedResources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScannedResources, request)); - assert( - (client.descriptors.page.listScannedResources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listScannedResourcesStream without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListScannedResourcesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListScannedResourcesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ScannedResource(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ScannedResource(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ScannedResource(), + ), + ]; + client.descriptors.page.listScannedResources.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listScannedResourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workloadmanager.v1.ScannedResource[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.workloadmanager.v1.ScannedResource, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listScannedResources.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listScannedResources, request), + ); + assert( + (client.descriptors.page.listScannedResources.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listScannedResourcesStream with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListScannedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListScannedResourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listScannedResources.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listScannedResourcesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.workloadmanager.v1.ScannedResource[] = []; - stream.on('data', (response: protos.google.cloud.workloadmanager.v1.ScannedResource) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listScannedResources.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listScannedResources, request)); - assert( - (client.descriptors.page.listScannedResources.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listScannedResourcesStream with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListScannedResourcesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListScannedResourcesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScannedResources.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listScannedResourcesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.workloadmanager.v1.ScannedResource[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.workloadmanager.v1.ScannedResource, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listScannedResources.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listScannedResources, request), + ); + assert( + (client.descriptors.page.listScannedResources.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listScannedResources without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListScannedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListScannedResourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ScannedResource()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ScannedResource()), - generateSampleMessage(new protos.google.cloud.workloadmanager.v1.ScannedResource()), - ]; - client.descriptors.page.listScannedResources.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.workloadmanager.v1.IScannedResource[] = []; - const iterable = client.listScannedResourcesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listScannedResources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScannedResources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listScannedResources without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListScannedResourcesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListScannedResourcesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ScannedResource(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ScannedResource(), + ), + generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ScannedResource(), + ), + ]; + client.descriptors.page.listScannedResources.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.workloadmanager.v1.IScannedResource[] = + []; + const iterable = client.listScannedResourcesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listScannedResources.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listScannedResources.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listScannedResources with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.workloadmanager.v1.ListScannedResourcesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.workloadmanager.v1.ListScannedResourcesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listScannedResources.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listScannedResourcesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.workloadmanager.v1.IScannedResource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listScannedResources.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listScannedResources.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listScannedResources with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.workloadmanager.v1.ListScannedResourcesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.workloadmanager.v1.ListScannedResourcesRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listScannedResources.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listScannedResourcesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.workloadmanager.v1.IScannedResource[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listScannedResources.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listScannedResources.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('invokes getLocation with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); + it('uses async iteration with listLocations with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient + .deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ) + .catch((err) => { + throw err; + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request), + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse(), + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.IOperation[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest(), + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.IOperation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + }); + }); + + describe('Path templates', () => { + describe('cryptoKey', async () => { + const fakePath = '/rendered/path/cryptoKey'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + key_ring: 'keyRingValue', + crypto_key: 'cryptoKeyValue', + }; + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.cryptoKeyPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.cryptoKeyPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('cryptoKeyPath', () => { + const result = client.cryptoKeyPath( + 'projectValue', + 'locationValue', + 'keyRingValue', + 'cryptoKeyValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromCryptoKeyName', () => { + const result = client.matchProjectFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromCryptoKeyName', () => { + const result = client.matchLocationFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchKeyRingFromCryptoKeyName', () => { + const result = client.matchKeyRingFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'keyRingValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchCryptoKeyFromCryptoKeyName', () => { + const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); + assert.strictEqual(result, 'cryptoKeyValue'); + assert( + (client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('cryptoKey', async () => { - const fakePath = "/rendered/path/cryptoKey"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - key_ring: "keyRingValue", - crypto_key: "cryptoKeyValue", - }; - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.cryptoKeyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.cryptoKeyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('cryptoKeyPath', () => { - const result = client.cryptoKeyPath("projectValue", "locationValue", "keyRingValue", "cryptoKeyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.cryptoKeyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCryptoKeyName', () => { - const result = client.matchProjectFromCryptoKeyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCryptoKeyName', () => { - const result = client.matchLocationFromCryptoKeyName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchKeyRingFromCryptoKeyName', () => { - const result = client.matchKeyRingFromCryptoKeyName(fakePath); - assert.strictEqual(result, "keyRingValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCryptoKeyFromCryptoKeyName', () => { - const result = client.matchCryptoKeyFromCryptoKeyName(fakePath); - assert.strictEqual(result, "cryptoKeyValue"); - assert((client.pathTemplates.cryptoKeyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('evaluation', async () => { - const fakePath = "/rendered/path/evaluation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - evaluation: "evaluationValue", - }; - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.evaluationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.evaluationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('evaluationPath', () => { - const result = client.evaluationPath("projectValue", "locationValue", "evaluationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.evaluationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromEvaluationName', () => { - const result = client.matchProjectFromEvaluationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.evaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromEvaluationName', () => { - const result = client.matchLocationFromEvaluationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.evaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromEvaluationName', () => { - const result = client.matchEvaluationFromEvaluationName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.evaluationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('evaluation', async () => { + const fakePath = '/rendered/path/evaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + evaluation: 'evaluationValue', + }; + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.evaluationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.evaluationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('evaluationPath', () => { + const result = client.evaluationPath( + 'projectValue', + 'locationValue', + 'evaluationValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.evaluationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromEvaluationName', () => { + const result = client.matchProjectFromEvaluationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.evaluationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromEvaluationName', () => { + const result = client.matchLocationFromEvaluationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.evaluationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchEvaluationFromEvaluationName', () => { + const result = client.matchEvaluationFromEvaluationName(fakePath); + assert.strictEqual(result, 'evaluationValue'); + assert( + (client.pathTemplates.evaluationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('execution', async () => { - const fakePath = "/rendered/path/execution"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - evaluation: "evaluationValue", - execution: "executionValue", - }; - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.executionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.executionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('executionPath', () => { - const result = client.executionPath("projectValue", "locationValue", "evaluationValue", "executionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.executionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromExecutionName', () => { - const result = client.matchProjectFromExecutionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromExecutionName', () => { - const result = client.matchLocationFromExecutionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchEvaluationFromExecutionName', () => { - const result = client.matchEvaluationFromExecutionName(fakePath); - assert.strictEqual(result, "evaluationValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExecutionFromExecutionName', () => { - const result = client.matchExecutionFromExecutionName(fakePath); - assert.strictEqual(result, "executionValue"); - assert((client.pathTemplates.executionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('execution', async () => { + const fakePath = '/rendered/path/execution'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + evaluation: 'evaluationValue', + execution: 'executionValue', + }; + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.executionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.executionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('executionPath', () => { + const result = client.executionPath( + 'projectValue', + 'locationValue', + 'evaluationValue', + 'executionValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.executionPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromExecutionName', () => { + const result = client.matchProjectFromExecutionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromExecutionName', () => { + const result = client.matchLocationFromExecutionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchEvaluationFromExecutionName', () => { + const result = client.matchEvaluationFromExecutionName(fakePath); + assert.strictEqual(result, 'evaluationValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchExecutionFromExecutionName', () => { + const result = client.matchExecutionFromExecutionName(fakePath); + assert.strictEqual(result, 'executionValue'); + assert( + (client.pathTemplates.executionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('location', async () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('rule', async () => { - const fakePath = "/rendered/path/rule"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - rule: "ruleValue", - }; - const client = new workloadmanagerModule.v1.WorkloadManagerClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.rulePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.rulePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('rulePath', () => { - const result = client.rulePath("projectValue", "locationValue", "ruleValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.rulePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRuleName', () => { - const result = client.matchProjectFromRuleName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.rulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromRuleName', () => { - const result = client.matchLocationFromRuleName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.rulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRuleFromRuleName', () => { - const result = client.matchRuleFromRuleName(fakePath); - assert.strictEqual(result, "ruleValue"); - assert((client.pathTemplates.rulePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('rule', async () => { + const fakePath = '/rendered/path/rule'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + rule: 'ruleValue', + }; + const client = new workloadmanagerModule.v1.WorkloadManagerClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.rulePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.rulePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('rulePath', () => { + const result = client.rulePath( + 'projectValue', + 'locationValue', + 'ruleValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.rulePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromRuleName', () => { + const result = client.matchProjectFromRuleName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.rulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromRuleName', () => { + const result = client.matchLocationFromRuleName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.rulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchRuleFromRuleName', () => { + const result = client.matchRuleFromRuleName(fakePath); + assert.strictEqual(result, 'ruleValue'); + assert( + (client.pathTemplates.rulePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-workloadmanager/webpack.config.js b/packages/google-cloud-workloadmanager/webpack.config.js index d9a6b4521d6a..408cec8950ba 100644 --- a/packages/google-cloud-workloadmanager/webpack.config.js +++ b/packages/google-cloud-workloadmanager/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2026 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. diff --git a/packages/google-cloud-workstations/.eslintignore b/packages/google-cloud-workstations/.eslintignore new file mode 100644 index 000000000000..cfc348ec4d11 --- /dev/null +++ b/packages/google-cloud-workstations/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/packages/google-cloud-workstations/.eslintrc.json b/packages/google-cloud-workstations/.eslintrc.json new file mode 100644 index 000000000000..3e8d97ccb390 --- /dev/null +++ b/packages/google-cloud-workstations/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "./node_modules/gts", + "root": true +} diff --git a/packages/google-cloud-workstations/README.md b/packages/google-cloud-workstations/README.md index 3960d8979f8c..fe9578b2a72d 100644 --- a/packages/google-cloud-workstations/README.md +++ b/packages/google-cloud-workstations/README.md @@ -133,7 +133,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workstations/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). Please note that this `README.md` and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) @@ -143,7 +143,7 @@ are generated from a central template. Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-workstations/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project diff --git a/packages/google-cloud-workstations/protos/protos.d.ts b/packages/google-cloud-workstations/protos/protos.d.ts index e07bdb551ecd..14f295555b31 100644 --- a/packages/google-cloud-workstations/protos/protos.d.ts +++ b/packages/google-cloud-workstations/protos/protos.d.ts @@ -11079,6 +11079,9 @@ export namespace google { /** CommonLanguageSettings destinations */ destinations?: (google.api.ClientLibraryDestination[]|null); + + /** CommonLanguageSettings selectiveGapicGeneration */ + selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); } /** Represents a CommonLanguageSettings. */ @@ -11096,6 +11099,9 @@ export namespace google { /** CommonLanguageSettings destinations. */ public destinations: google.api.ClientLibraryDestination[]; + /** CommonLanguageSettings selectiveGapicGeneration. */ + public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @param [properties] Properties to set @@ -11796,6 +11802,9 @@ export namespace google { /** PythonSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures */ + experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); } /** Represents a PythonSettings. */ @@ -11810,6 +11819,9 @@ export namespace google { /** PythonSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** PythonSettings experimentalFeatures. */ + public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + /** * Creates a new PythonSettings instance using the specified properties. * @param [properties] Properties to set @@ -11888,6 +11900,118 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace PythonSettings { + + /** Properties of an ExperimentalFeatures. */ + interface IExperimentalFeatures { + + /** ExperimentalFeatures restAsyncIoEnabled */ + restAsyncIoEnabled?: (boolean|null); + + /** ExperimentalFeatures protobufPythonicTypesEnabled */ + protobufPythonicTypesEnabled?: (boolean|null); + + /** ExperimentalFeatures unversionedPackageDisabled */ + unversionedPackageDisabled?: (boolean|null); + } + + /** Represents an ExperimentalFeatures. */ + class ExperimentalFeatures implements IExperimentalFeatures { + + /** + * Constructs a new ExperimentalFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); + + /** ExperimentalFeatures restAsyncIoEnabled. */ + public restAsyncIoEnabled: boolean; + + /** ExperimentalFeatures protobufPythonicTypesEnabled. */ + public protobufPythonicTypesEnabled: boolean; + + /** ExperimentalFeatures unversionedPackageDisabled. */ + public unversionedPackageDisabled: boolean; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns ExperimentalFeatures instance + */ + public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExperimentalFeatures + * @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.api.PythonSettings.ExperimentalFeatures; + + /** + * Verifies an ExperimentalFeatures 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 an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExperimentalFeatures + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @param message ExperimentalFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExperimentalFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Properties of a NodeSettings. */ interface INodeSettings { @@ -12214,6 +12338,9 @@ export namespace google { /** GoSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); } /** Represents a GoSettings. */ @@ -12228,6 +12355,9 @@ export namespace google { /** GoSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** GoSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + /** * Creates a new GoSettings instance using the specified properties. * @param [properties] Properties to set @@ -12552,6 +12682,109 @@ export namespace google { PACKAGE_MANAGER = 20 } + /** Properties of a SelectiveGapicGeneration. */ + interface ISelectiveGapicGeneration { + + /** SelectiveGapicGeneration methods */ + methods?: (string[]|null); + + /** SelectiveGapicGeneration generateOmittedAsInternal */ + generateOmittedAsInternal?: (boolean|null); + } + + /** Represents a SelectiveGapicGeneration. */ + class SelectiveGapicGeneration implements ISelectiveGapicGeneration { + + /** + * Constructs a new SelectiveGapicGeneration. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ISelectiveGapicGeneration); + + /** SelectiveGapicGeneration methods. */ + public methods: string[]; + + /** SelectiveGapicGeneration generateOmittedAsInternal. */ + public generateOmittedAsInternal: boolean; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectiveGapicGeneration instance + */ + public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectiveGapicGeneration + * @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.api.SelectiveGapicGeneration; + + /** + * Verifies a SelectiveGapicGeneration 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 SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectiveGapicGeneration + */ + public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @param message SelectiveGapicGeneration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** LaunchStage enum. */ enum LaunchStage { LAUNCH_STAGE_UNSPECIFIED = 0, @@ -12933,6 +13166,7 @@ export namespace google { /** Edition enum. */ enum Edition { EDITION_UNKNOWN = 0, + EDITION_LEGACY = 900, EDITION_PROTO2 = 998, EDITION_PROTO3 = 999, EDITION_2023 = 1000, @@ -12963,6 +13197,9 @@ export namespace google { /** FileDescriptorProto weakDependency */ weakDependency?: (number[]|null); + /** FileDescriptorProto optionDependency */ + optionDependency?: (string[]|null); + /** FileDescriptorProto messageType */ messageType?: (google.protobuf.IDescriptorProto[]|null); @@ -13012,6 +13249,9 @@ export namespace google { /** FileDescriptorProto weakDependency. */ public weakDependency: number[]; + /** FileDescriptorProto optionDependency. */ + public optionDependency: string[]; + /** FileDescriptorProto messageType. */ public messageType: google.protobuf.IDescriptorProto[]; @@ -13146,6 +13386,9 @@ export namespace google { /** DescriptorProto reservedName */ reservedName?: (string[]|null); + + /** DescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents a DescriptorProto. */ @@ -13187,6 +13430,9 @@ export namespace google { /** DescriptorProto reservedName. */ public reservedName: string[]; + /** DescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new DescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -14034,6 +14280,9 @@ export namespace google { /** EnumDescriptorProto reservedName */ reservedName?: (string[]|null); + + /** EnumDescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents an EnumDescriptorProto. */ @@ -14060,6 +14309,9 @@ export namespace google { /** EnumDescriptorProto reservedName. */ public reservedName: string[]; + /** EnumDescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -14994,6 +15246,9 @@ export namespace google { /** FieldOptions features */ features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); @@ -15049,6 +15304,9 @@ export namespace google { /** FieldOptions features. */ public features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -15269,6 +15527,121 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a FeatureSupport. */ + interface IFeatureSupport { + + /** FeatureSupport editionIntroduced */ + editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport editionDeprecated */ + editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport deprecationWarning */ + deprecationWarning?: (string|null); + + /** FeatureSupport editionRemoved */ + editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSupport. */ + class FeatureSupport implements IFeatureSupport { + + /** + * Constructs a new FeatureSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); + + /** FeatureSupport editionIntroduced. */ + public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport editionDeprecated. */ + public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport deprecationWarning. */ + public deprecationWarning: string; + + /** FeatureSupport editionRemoved. */ + public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSupport instance + */ + public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSupport + * @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.protobuf.FieldOptions.FeatureSupport; + + /** + * Verifies a FeatureSupport 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 FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSupport + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @param message FeatureSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of an OneofOptions. */ @@ -15507,6 +15880,9 @@ export namespace google { /** EnumValueOptions debugRedact */ debugRedact?: (boolean|null); + /** EnumValueOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); } @@ -15529,6 +15905,9 @@ export namespace google { /** EnumValueOptions debugRedact. */ public debugRedact: boolean; + /** EnumValueOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -16121,6 +16500,12 @@ export namespace google { /** FeatureSet jsonFormat */ jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); + + /** FeatureSet enforceNamingStyle */ + enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); + + /** FeatureSet defaultSymbolVisibility */ + defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); } /** Represents a FeatureSet. */ @@ -16150,6 +16535,12 @@ export namespace google { /** FeatureSet jsonFormat. */ public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); + /** FeatureSet enforceNamingStyle. */ + public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); + + /** FeatureSet defaultSymbolVisibility. */ + public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); + /** * Creates a new FeatureSet instance using the specified properties. * @param [properties] Properties to set @@ -16272,6 +16663,116 @@ export namespace google { ALLOW = 1, LEGACY_BEST_EFFORT = 2 } + + /** EnforceNamingStyle enum. */ + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2 + } + + /** Properties of a VisibilityFeature. */ + interface IVisibilityFeature { + } + + /** Represents a VisibilityFeature. */ + class VisibilityFeature implements IVisibilityFeature { + + /** + * Constructs a new VisibilityFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns VisibilityFeature instance + */ + public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisibilityFeature + * @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.protobuf.FeatureSet.VisibilityFeature; + + /** + * Verifies a VisibilityFeature 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 VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisibilityFeature + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @param message VisibilityFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisibilityFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisibilityFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VisibilityFeature { + + /** DefaultSymbolVisibility enum. */ + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + EXPORT_ALL = 1, + EXPORT_TOP_LEVEL = 2, + LOCAL_ALL = 3, + STRICT = 4 + } + } } /** Properties of a FeatureSetDefaults. */ @@ -16391,8 +16892,11 @@ export namespace google { /** FeatureSetEditionDefault edition */ edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - /** FeatureSetEditionDefault features */ - features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures */ + overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures */ + fixedFeatures?: (google.protobuf.IFeatureSet|null); } /** Represents a FeatureSetEditionDefault. */ @@ -16407,8 +16911,11 @@ export namespace google { /** FeatureSetEditionDefault edition. */ public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - /** FeatureSetEditionDefault features. */ - public features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures. */ + public overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures. */ + public fixedFeatures?: (google.protobuf.IFeatureSet|null{"code":"deadline_exceeded","msg":"operation timed out"}